mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
btrfs: remove the SPACE_CACHE mount option flag
Nothing sets BTRFS_MOUNT_SPACE_CACHE anymore, so every test of it is false. Remove the flag, the checks rejecting the v1 cache on zoned filesystems and for sector sizes other than the page size, and the deprecation warning. Show a read-only filesystem that still has an old cache as nospace_cache, since that's what's in effect. space_cache and space_cache=v1 keep falling back to no space cache with a warning. Assisted-by: LLM Signed-off-by: Tal Zussman <tz2294@columbia.edu> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
d8a4bb425e
commit
3d10f3cc05
|
|
@ -3057,7 +3057,6 @@ static int btrfs_cleanup_fs_roots(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 rebuild_free_space_tree = false;
|
||||
|
||||
if (btrfs_test_opt(fs_info, CLEAR_CACHE) &&
|
||||
|
|
@ -3152,8 +3151,8 @@ 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 (btrfs_free_space_cache_v1_active(fs_info)) {
|
||||
ret = btrfs_set_free_space_cache_v1_active(fs_info, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -3269,20 +3268,6 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Subpage/bs > ps runtime limitation on v1 cache.
|
||||
*
|
||||
* V1 space cache still has some hard coded PAGE_SIZE usage, while
|
||||
* we're already defaulting to v2 cache, no need to bother v1 as it's
|
||||
* going to be deprecated anyway.
|
||||
*/
|
||||
if (fs_info->sectorsize != PAGE_SIZE && btrfs_test_opt(fs_info, SPACE_CACHE)) {
|
||||
btrfs_warn(fs_info,
|
||||
"v1 space cache is not supported for page size %lu with sectorsize %u",
|
||||
PAGE_SIZE, fs_info->sectorsize);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* This can be called by remount, we need to protect the super block. */
|
||||
spin_lock(&fs_info->super_lock);
|
||||
btrfs_set_super_incompat_flags(disk_super, incompat);
|
||||
|
|
|
|||
|
|
@ -259,7 +259,6 @@ enum {
|
|||
BTRFS_MOUNT_NOSSD = (1ULL << 9),
|
||||
BTRFS_MOUNT_DISCARD_SYNC = (1ULL << 10),
|
||||
BTRFS_MOUNT_FORCE_COMPRESS = (1ULL << 11),
|
||||
BTRFS_MOUNT_SPACE_CACHE = (1ULL << 12),
|
||||
BTRFS_MOUNT_CLEAR_CACHE = (1ULL << 13),
|
||||
BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED = (1ULL << 14),
|
||||
BTRFS_MOUNT_ENOSPC_DEBUG = (1ULL << 15),
|
||||
|
|
|
|||
|
|
@ -524,7 +524,6 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
|
|||
btrfs_warn(NULL,
|
||||
"v1 space cache is deprecated, falling back to no space cache");
|
||||
btrfs_set_opt(ctx->mount_opt, NOSPACECACHE);
|
||||
btrfs_clear_opt(ctx->mount_opt, SPACE_CACHE);
|
||||
btrfs_clear_opt(ctx->mount_opt, FREE_SPACE_TREE);
|
||||
break;
|
||||
case Opt_space_cache_version:
|
||||
|
|
@ -533,11 +532,9 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
|
|||
btrfs_warn(NULL,
|
||||
"v1 space cache is deprecated, falling back to no space cache");
|
||||
btrfs_set_opt(ctx->mount_opt, NOSPACECACHE);
|
||||
btrfs_clear_opt(ctx->mount_opt, SPACE_CACHE);
|
||||
btrfs_clear_opt(ctx->mount_opt, FREE_SPACE_TREE);
|
||||
break;
|
||||
case Opt_space_cache_v2:
|
||||
btrfs_clear_opt(ctx->mount_opt, SPACE_CACHE);
|
||||
btrfs_set_opt(ctx->mount_opt, FREE_SPACE_TREE);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -723,13 +720,6 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
|
|||
if (btrfs_check_mountopts_zoned(info, mount_opt))
|
||||
ret = false;
|
||||
|
||||
if (!test_bit(BTRFS_FS_STATE_REMOUNTING, &info->fs_state)) {
|
||||
if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
|
||||
btrfs_warn(info,
|
||||
"space cache v1 is being deprecated and will be removed in a future release, please use -o space_cache=v2");
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -747,14 +737,6 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
|
|||
*/
|
||||
void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
if (fs_info->sectorsize != PAGE_SIZE && btrfs_test_opt(fs_info, SPACE_CACHE)) {
|
||||
btrfs_info(fs_info,
|
||||
"forcing free space tree for sector size %u with page size %lu",
|
||||
fs_info->sectorsize, PAGE_SIZE);
|
||||
btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE);
|
||||
btrfs_set_opt(fs_info->mount_opt, FREE_SPACE_TREE);
|
||||
}
|
||||
|
||||
/*
|
||||
* At this point our mount options are populated, so we only mess with
|
||||
* these settings if we don't have any settings already.
|
||||
|
|
@ -769,9 +751,6 @@ void btrfs_set_free_space_cache_settings(struct btrfs_fs_info *fs_info)
|
|||
return;
|
||||
}
|
||||
|
||||
if (btrfs_test_opt(fs_info, SPACE_CACHE))
|
||||
return;
|
||||
|
||||
if (btrfs_test_opt(fs_info, NOSPACECACHE))
|
||||
return;
|
||||
|
||||
|
|
@ -1128,9 +1107,7 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry)
|
|||
seq_puts(seq, ",discard=async");
|
||||
if (!(info->sb->s_flags & SB_POSIXACL))
|
||||
seq_puts(seq, ",noacl");
|
||||
if (btrfs_free_space_cache_v1_active(info))
|
||||
seq_puts(seq, ",space_cache");
|
||||
else if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
|
||||
if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
|
||||
seq_puts(seq, ",space_cache=v2");
|
||||
else
|
||||
seq_puts(seq, ",nospace_cache");
|
||||
|
|
@ -1464,7 +1441,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
|
|||
btrfs_info_if_set(info, old, DISCARD_SYNC, "turning on sync discard");
|
||||
btrfs_info_if_set(info, old, DISCARD_ASYNC, "turning on async discard");
|
||||
btrfs_info_if_set(info, old, FREE_SPACE_TREE, "enabling free space tree");
|
||||
btrfs_info_if_set(info, old, SPACE_CACHE, "enabling disk space caching");
|
||||
btrfs_info_if_set(info, old, CLEAR_CACHE, "force clearing of disk cache");
|
||||
btrfs_info_if_set(info, old, AUTO_DEFRAG, "enabling auto defrag");
|
||||
btrfs_info_if_set(info, old, FRAGMENT_DATA, "fragmenting data");
|
||||
|
|
@ -1482,7 +1458,6 @@ static void btrfs_emit_options(struct btrfs_fs_info *info,
|
|||
btrfs_info_if_unset(info, old, SSD_SPREAD, "not using spread ssd allocation scheme");
|
||||
btrfs_info_if_unset(info, old, NOBARRIER, "turning on barriers");
|
||||
btrfs_info_if_unset(info, old, NOTREELOG, "enabling tree log");
|
||||
btrfs_info_if_unset(info, old, SPACE_CACHE, "disabling disk space caching");
|
||||
btrfs_info_if_unset(info, old, FREE_SPACE_TREE, "disabling free space tree");
|
||||
btrfs_info_if_unset(info, old, AUTO_DEFRAG, "disabling auto defrag");
|
||||
btrfs_info_if_unset(info, old, COMPRESS, "use no compression");
|
||||
|
|
@ -1547,12 +1522,10 @@ static int btrfs_reconfigure(struct fs_context *fc)
|
|||
btrfs_warn(fs_info,
|
||||
"remount supports changing free space tree only from RO to RW");
|
||||
/* Make sure free space cache options match the state on disk. */
|
||||
if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE)) {
|
||||
if (btrfs_fs_compat_ro(fs_info, FREE_SPACE_TREE))
|
||||
btrfs_set_opt(fs_info->mount_opt, FREE_SPACE_TREE);
|
||||
btrfs_clear_opt(fs_info->mount_opt, SPACE_CACHE);
|
||||
} else {
|
||||
else
|
||||
btrfs_clear_opt(fs_info->mount_opt, FREE_SPACE_TREE);
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
|
|
|||
|
|
@ -2030,9 +2030,7 @@ static void update_super_roots(struct btrfs_fs_info *fs_info)
|
|||
super->root = root_item->bytenr;
|
||||
super->generation = root_item->generation;
|
||||
super->root_level = root_item->level;
|
||||
if (btrfs_test_opt(fs_info, SPACE_CACHE))
|
||||
super->cache_generation = root_item->generation;
|
||||
else if (test_bit(BTRFS_FS_CLEANUP_SPACE_CACHE_V1, &fs_info->flags))
|
||||
if (test_bit(BTRFS_FS_CLEANUP_SPACE_CACHE_V1, &fs_info->flags))
|
||||
super->cache_generation = 0;
|
||||
if (test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags))
|
||||
super->uuid_tree_generation = root_item->generation;
|
||||
|
|
|
|||
|
|
@ -804,15 +804,6 @@ int btrfs_check_mountopts_zoned(const struct btrfs_fs_info *info,
|
|||
if (!btrfs_is_zoned(info))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Space cache writing is not COWed. Disable that to avoid write errors
|
||||
* in sequential zones.
|
||||
*/
|
||||
if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
|
||||
btrfs_err(info, "zoned: space cache v1 is not supported");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (btrfs_raw_test_opt(*mount_opt, NODATACOW)) {
|
||||
btrfs_err(info, "zoned: NODATACOW not supported");
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user