Commit eddb1a43 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: add reconfigure callback for fs_context

This is what is used to remount the file system with the new mount API.
Because the mount options are parsed separately and one at a time I've
added a helper to emit the mount options after the fact once the mount
is configured, this matches the dmesg output for what happens with the
old mount API.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.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 0f85e244
This diff is collapsed.
...@@ -781,7 +781,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) ...@@ -781,7 +781,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
* Check mount options here, because we might change fs_info->zoned * Check mount options here, because we might change fs_info->zoned
* from fs_info->zone_size. * from fs_info->zone_size.
*/ */
ret = btrfs_check_mountopts_zoned(fs_info); ret = btrfs_check_mountopts_zoned(fs_info, &fs_info->mount_opt);
if (ret) if (ret)
return ret; return ret;
...@@ -789,7 +789,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info) ...@@ -789,7 +789,7 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
return 0; return 0;
} }
int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info) int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info, unsigned long *mount_opt)
{ {
if (!btrfs_is_zoned(info)) if (!btrfs_is_zoned(info))
return 0; return 0;
...@@ -798,18 +798,21 @@ int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info) ...@@ -798,18 +798,21 @@ int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info)
* Space cache writing is not COWed. Disable that to avoid write errors * Space cache writing is not COWed. Disable that to avoid write errors
* in sequential zones. * in sequential zones.
*/ */
if (btrfs_test_opt(info, SPACE_CACHE)) { if (btrfs_raw_test_opt(*mount_opt, SPACE_CACHE)) {
btrfs_err(info, "zoned: space cache v1 is not supported"); btrfs_err(info, "zoned: space cache v1 is not supported");
return -EINVAL; return -EINVAL;
} }
if (btrfs_test_opt(info, NODATACOW)) { if (btrfs_raw_test_opt(*mount_opt, NODATACOW)) {
btrfs_err(info, "zoned: NODATACOW not supported"); btrfs_err(info, "zoned: NODATACOW not supported");
return -EINVAL; return -EINVAL;
} }
btrfs_clear_and_info(info, DISCARD_ASYNC, if (btrfs_raw_test_opt(*mount_opt, DISCARD_ASYNC)) {
"zoned: async discard ignored and disabled for zoned mode"); btrfs_info(info,
"zoned: async discard ignored and disabled for zoned mode");
btrfs_clear_opt(*mount_opt, DISCARD_ASYNC);
}
return 0; return 0;
} }
......
...@@ -45,7 +45,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache); ...@@ -45,7 +45,7 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache);
void btrfs_destroy_dev_zone_info(struct btrfs_device *device); void btrfs_destroy_dev_zone_info(struct btrfs_device *device);
struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev); struct btrfs_zoned_device_info *btrfs_clone_dev_zone_info(struct btrfs_device *orig_dev);
int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info); int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info);
int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info); int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info, unsigned long *mount_opt);
int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw, int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw,
u64 *bytenr_ret); u64 *bytenr_ret);
int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw, int btrfs_sb_log_location(struct btrfs_device *device, int mirror, int rw,
...@@ -121,7 +121,8 @@ static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info) ...@@ -121,7 +121,8 @@ static inline int btrfs_check_zoned_mode(const struct btrfs_fs_info *fs_info)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static inline int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info) static inline int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info,
unsigned long *mount_opt)
{ {
return 0; return 0;
} }
......
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