summaryrefslogtreecommitdiff
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 77c7013f69d7..2dcc5e52140c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2888,6 +2888,7 @@ void btrfs_clear_oneshot_options(struct btrfs_fs_info *fs_info)
int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
{
int ret;
+ const bool cache_opt = btrfs_test_opt(fs_info, SPACE_CACHE);
bool clear_free_space_tree = false;
if (btrfs_test_opt(fs_info, CLEAR_CACHE) &&
@@ -2940,6 +2941,12 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
}
}
+ if (cache_opt != btrfs_free_space_cache_v1_active(fs_info)) {
+ ret = btrfs_set_free_space_cache_v1_active(fs_info, cache_opt);
+ if (ret)
+ goto out;
+ }
+
ret = btrfs_resume_balance_async(fs_info);
if (ret)
goto out;
@@ -3410,6 +3417,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
return ret;
}
}
+
set_bit(BTRFS_FS_OPEN, &fs_info->flags);
clear_oneshot: