Commit 15b3b325 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba
Browse files

btrfs: do regular iput instead of delayed iput during extent map shrinking



The extent map shrinker now runs in the system unbound workqueue and no
longer in kswapd context so it can directly do an iput() on inodes even
if that blocks or needs to acquire any lock (we aren't holding any locks
when requesting the delayed iput from the shrinker). So we don't need to
add a delayed iput, wake up the cleaner and delegate the iput() to the
cleaner, which also adds extra contention on the spinlock that protects
the delayed iputs list.

Reported-by: default avatarIvan Shapovalov <intelfx@intelfx.name>
Tested-by: default avatarIvan Shapovalov <intelfx@intelfx.name>
Link: https://lore.kernel.org/linux-btrfs/0414d690ac5680d0d77dfc930606cdc36e42e12f.camel@intelfx.name/


CC: stable@vger.kernel.org # 6.12+
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c6c9c4d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1256,7 +1256,7 @@ static long btrfs_scan_root(struct btrfs_root *root, struct btrfs_em_shrink_ctx

		min_ino = btrfs_ino(inode) + 1;
		fs_info->em_shrinker_last_ino = btrfs_ino(inode);
		btrfs_add_delayed_iput(inode);
		iput(&inode->vfs_inode);

		if (ctx->scanned >= ctx->nr_to_scan || btrfs_fs_closing(fs_info))
			break;