From 217aeb1d50419874b7b50a094a3eb7f64063320a Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Wed, 24 Jun 2026 18:16:25 +0100 Subject: [PATCH] btrfs: defrag: remove pointless list_del_init() in defrag_one_cluster() 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. Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba --- 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;