Skip to contentSkip to conversation

btrfs: send: use list_move_tail instead of list_del/list_add_tail in send.c

PATCH In review Baokun Li 2 participants 2 messages Jun 11, 2021 Btrfs file system

lore
Share & tools
lore

Baokun Li

author
#0 lore raw

PATCH v2 1/1 btrfs: send: use list_move_tail instead of list_del/list_add_tail in send.c

Using list_move_tail() instead of list_del() + list_add_tail() in send.c. And open-code name_cache_used() as there is only one user.

---
V1->V2:
open-code name_cache_used()

 fs/btrfs/send.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
fs/btrfs/send.c +8 -11
index bd69db72acc5..418ada6139fd 100644
@@ -2077,16 +2077,6 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
 	return NULL;
 }
 
-/*
- * Removes the entry from the list and adds it back to the end. This marks the
- * entry as recently used so that name_cache_clean_unused does not remove it.
- */
-static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
-{
-	list_del(&nce->list);
-	list_add_tail(&nce->list, &sctx->name_cache_list);
-}
-
 /*
  * Remove some entries from the beginning of name_cache_list.
  */
@@ -2147,7 +2137,14 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
 			kfree(nce);
 			nce = NULL;
 		} else {
-			name_cache_used(sctx, nce);
+
+			/*
+			 * Removes the entry from the list and adds it back to the end.
+			 * This marks the entry as recently used so that
+			 * name_cache_clean_unused does not remove it.
+			 */
+			list_move_tail(&nce->list, &sctx->name_cache_list);
+
 			*parent_ino = nce->parent_ino;
 			*parent_gen = nce->parent_gen;
 			ret = fs_path_add(dest, nce->name, nce->name_len);
Signature · 1 line
2.31.1