Commit 9fb3b1a7 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: set clear_cache if we use usebackuproot

We're currently setting this when we try to load the roots and we see
that usebackuproot is set.  Instead set this at mount option parsing
time.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Acked-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 83e3a40a
...@@ -2630,9 +2630,6 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info) ...@@ -2630,9 +2630,6 @@ static int __cold init_tree_roots(struct btrfs_fs_info *fs_info)
*/ */
btrfs_set_super_log_root(sb, 0); btrfs_set_super_log_root(sb, 0);
/* We can't trust the free space cache either */
btrfs_set_opt(fs_info->mount_opt, CLEAR_CACHE);
btrfs_warn(fs_info, "try to load backup roots slot %d", i); btrfs_warn(fs_info, "try to load backup roots slot %d", i);
ret = read_backup_root(fs_info, i); ret = read_backup_root(fs_info, i);
backup_index = ret; backup_index = ret;
......
...@@ -452,6 +452,12 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param) ...@@ -452,6 +452,12 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
btrfs_warn(NULL, btrfs_warn(NULL,
"'recovery' is deprecated, use 'rescue=usebackuproot' instead"); "'recovery' is deprecated, use 'rescue=usebackuproot' instead");
btrfs_set_opt(ctx->mount_opt, USEBACKUPROOT); btrfs_set_opt(ctx->mount_opt, USEBACKUPROOT);
/*
* If we're loading the backup roots we can't trust the
* space cache.
*/
btrfs_set_opt(ctx->mount_opt, CLEAR_CACHE);
} }
break; break;
case Opt_nologreplay: case Opt_nologreplay:
...@@ -550,6 +556,9 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param) ...@@ -550,6 +556,9 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
btrfs_warn(NULL, btrfs_warn(NULL,
"'usebackuproot' is deprecated, use 'rescue=usebackuproot' instead"); "'usebackuproot' is deprecated, use 'rescue=usebackuproot' instead");
btrfs_set_opt(ctx->mount_opt, USEBACKUPROOT); btrfs_set_opt(ctx->mount_opt, USEBACKUPROOT);
/* If we're loading the backup roots we can't trust the space cache. */
btrfs_set_opt(ctx->mount_opt, CLEAR_CACHE);
break; break;
case Opt_skip_balance: case Opt_skip_balance:
btrfs_set_opt(ctx->mount_opt, SKIP_BALANCE); btrfs_set_opt(ctx->mount_opt, SKIP_BALANCE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment