Re: [PATCH 6/6] btrfs: defrag: remove pointless list_del_init() in defrag_one_cluster()

Anand Suveer Jain <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On 26/6/26 03:20, [email protected] wrote:
> From: Filipe Manana <[email protected]>
> 
> There's no need to call list_del_init() against each entry when freeing
> the list, as the list is local and we are freeing the entry.
> 
> Signed-off-by: Filipe Manana <[email protected]>
> ---
>  fs/btrfs/defrag.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
> index 7b3f779775a0..6ec5dd760d42 100644
> --- a/fs/btrfs/defrag.c
> +++ b/fs/btrfs/defrag.c
> @@ -1319,10 +1319,8 @@ static int defrag_one_cluster(struct btrfs_inode *inode,
>  				      inode->root->fs_info->sectorsize_bits;
>  	}
>  out:
> -	list_for_each_entry_safe(entry, tmp, &target_list, list) {
> -		list_del_init(&entry->list);
> +	list_for_each_entry_safe(entry, tmp, &target_list, list)
>  		kfree(entry);
> -	}
>  	if (ret >= 0)
>  		*last_scanned_ret = max(*last_scanned_ret, start + len);
>  	return ret;

LGTM
Reviewed-by: Anand Jain <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.