Skip to content

Commit bb93000

Browse files
LiBaokun96kdave
authored andcommitted
btrfs: send: use list_move_tail instead of list_del/list_add_tail
Use list_move_tail() instead of list_del() + list_add_tail() as it's doing the same thing and allows further cleanups. Open code name_cache_used() as there is only one user. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent b05fbcc commit bb93000

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

fs/btrfs/send.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,16 +2077,6 @@ static struct name_cache_entry *name_cache_search(struct send_ctx *sctx,
20772077
return NULL;
20782078
}
20792079

2080-
/*
2081-
* Removes the entry from the list and adds it back to the end. This marks the
2082-
* entry as recently used so that name_cache_clean_unused does not remove it.
2083-
*/
2084-
static void name_cache_used(struct send_ctx *sctx, struct name_cache_entry *nce)
2085-
{
2086-
list_del(&nce->list);
2087-
list_add_tail(&nce->list, &sctx->name_cache_list);
2088-
}
2089-
20902080
/*
20912081
* Remove some entries from the beginning of name_cache_list.
20922082
*/
@@ -2147,7 +2137,13 @@ static int __get_cur_name_and_parent(struct send_ctx *sctx,
21472137
kfree(nce);
21482138
nce = NULL;
21492139
} else {
2150-
name_cache_used(sctx, nce);
2140+
/*
2141+
* Removes the entry from the list and adds it back to
2142+
* the end. This marks the entry as recently used so
2143+
* that name_cache_clean_unused does not remove it.
2144+
*/
2145+
list_move_tail(&nce->list, &sctx->name_cache_list);
2146+
21512147
*parent_ino = nce->parent_ino;
21522148
*parent_gen = nce->parent_gen;
21532149
ret = fs_path_add(dest, nce->name, nce->name_len);

0 commit comments

Comments
 (0)