/*
* At this point we don't have explicit options set by the user, set
- * them ourselves based on the state of the file system.
+ * them ourselves based on the state of the file system. An existing
+ * v1 space cache is no longer used and gets cleaned up once the
+ * filesystem is mounted read-write.
*/
if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE))
btrfs_set_opt(fs_info->mount_opt, FREE_SPACE_TREE);
- else if (btrfs_free_space_cache_v1_active(fs_info))
- btrfs_set_opt(fs_info->mount_opt, SPACE_CACHE);
}
static void set_device_specific_options(struct btrfs_fs_info *fs_info)
static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info,
unsigned long long old_opts)
{
- const bool cache_opt = btrfs_test_opt(fs_info, SPACE_CACHE);
-
/*
* We need to cleanup all defraggable inodes if the autodefragment is
* close or the filesystem is read only.
else if (btrfs_raw_test_opt(old_opts, DISCARD_ASYNC) &&
!btrfs_test_opt(fs_info, DISCARD_ASYNC))
btrfs_discard_cleanup(fs_info);
-
- /* If we toggled space cache */
- if (cache_opt != btrfs_free_space_cache_v1_active(fs_info))
- btrfs_set_free_space_cache_v1_active(fs_info, cache_opt);
}
static int btrfs_remount_rw(struct btrfs_fs_info *fs_info)
btrfs_set_opt(fs_info->mount_opt, FREE_SPACE_TREE);
btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE);
}
- if (btrfs_free_space_cache_v1_active(fs_info)) {
- btrfs_clear_opt(fs_info->mount_opt, FREE_SPACE_TREE);
- btrfs_set_opt(fs_info->mount_opt, SPACE_CACHE);
- }
}
ret = 0;