aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorBoris Burkov <boris@bur.io>2020-11-18 15:06:26 -0800
committerDavid Sterba <dsterba@suse.com>2020-12-09 19:16:09 +0100
commitaf456a2c0aaaff15b84f046e2545570bf1bf50ed (patch)
tree0fb250f9ad538c42f3721b916d8c1806b5aebd81 /fs/btrfs
parentbtrfs: remove free space items when disabling space cache v1 (diff)
downloadlinux-dev-af456a2c0aaaff15b84f046e2545570bf1bf50ed.tar.xz
linux-dev-af456a2c0aaaff15b84f046e2545570bf1bf50ed.zip
btrfs: skip space_cache v1 setup when not using it
If we are not using space cache v1, we should not create the free space object or free space inodes. This comes up when we delete the existing free space objects/inodes when migrating to v2, only to see them get recreated for every dirtied block group. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Boris Burkov <boris@bur.io> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/block-group.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index fbc74bb41322..52f2198d44c9 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -2340,6 +2340,9 @@ static int cache_save_setup(struct btrfs_block_group *block_group,
int retries = 0;
int ret = 0;
+ if (!btrfs_test_opt(fs_info, SPACE_CACHE))
+ return 0;
+
/*
* If this block group is smaller than 100 megs don't bother caching the
* block group.