btrfs: send: use list_move_tail instead of list_del/list_add_tail
Subsystems (2)
PATCH 1/1 btrfs: send: use list_move_tail instead of list_del/list_add_tail
Using list_move_tail() instead of list_del() + list_add_tail().
--- fs/btrfs/send.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/send.c +1 -2
@@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,*/ 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); +list_move_tail (&nce->list, &sctx->name_cache_list); }/*
Quoted 13 lines · Baokun Li
Using
list_move_tail()instead oflist_del()+list_add_tail().Reported-by Hulk Robot <[email protected]>Signed-off-by Baokun Li <[email protected]>--- fs/btrfs/send.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)fs/btrfs/send.c +0
-0
fs/btrfs/send.c static struct name_cache_entry *name_cache_search(struct send_ctx *sctx, · line 2087
Quoted 7 lines
fs/btrfs/send.c +1
-2@@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,*/ 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); +list_move_tail (&nce->list, &sctx->name_cache_list); }
Looks good.
You can consider open-code name_cache_used() as there is only one user.
Thanks, Anand
Quoted 2 lines
fs/btrfs/send.c +0
-0/*
Quoted 9 lines · Anand Jain
Quoted 8 lines · Baokun Li
Using
list_move_tail()instead oflist_del()+list_add_tail().Reported-by Hulk Robot <[email protected]>Signed-off-by Baokun Li <[email protected]>--- fs/btrfs/send.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 16 lines
fs/btrfs/send.c static struct name_cache_entry *name_cache_search(struct send_ctx *sctx, · line 2087
Quoted 12 lines
fs/btrfs/send.c +1
-2@@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,*/ 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); +list_move_tail (&nce->list, &sctx->name_cache_list); }Looks good.
You can consider open-codename_cache_used()as there is only one user.
Yeah sounds like a good idea, with part of the function comment next to the list_move_tail.
Thank you for your advice.
I'm about to send a patch v2 with the changes suggested by you.
Best Regards
Quoted 28 lines · David Sterba
Quoted 9 lines · Anand Jain
Quoted 8 lines · Baokun Li
Using
list_move_tail()instead oflist_del()+list_add_tail().Reported-by Hulk Robot <[email protected]>Signed-off-by Baokun Li <[email protected]>--- fs/btrfs/send.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)Quoted 15 lines
fs/btrfs/send.c static struct name_cache_entry *name_cache_search(struct send_ctx *sctx, · line 2087
Quoted 12 lines
fs/btrfs/send.c +1
-2@@ -2083,8 +2083,7 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,*/ 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); +list_move_tail (&nce->list, &sctx->name_cache_list); }Looks good.
You can consider open-codename_cache_used()as there is only one user.Yeah sounds like a good idea, with part of the function comment next to the
list_move_tail.
.