Commit f42a34b2 authored by Miao Xie's avatar Miao Xie Committed by Josef Bacik

Btrfs: fix unblocked autodefraggers when remount

The new mount option is set after parsing the remount arguments,
so it is wrong that checking the autodefrag is close or not at
btrfs_remount_prepare(). Fix it.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent f7f82b81
...@@ -1191,11 +1191,14 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info, ...@@ -1191,11 +1191,14 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
new_pool_size); new_pool_size);
} }
static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info, static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info)
unsigned long old_opts, int flags)
{ {
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state); set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
}
static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info,
unsigned long old_opts, int flags)
{
if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) && if (btrfs_raw_test_opt(old_opts, AUTO_DEFRAG) &&
(!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) || (!btrfs_raw_test_opt(fs_info->mount_opt, AUTO_DEFRAG) ||
(flags & MS_RDONLY))) { (flags & MS_RDONLY))) {
...@@ -1236,7 +1239,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1236,7 +1239,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
unsigned int old_metadata_ratio = fs_info->metadata_ratio; unsigned int old_metadata_ratio = fs_info->metadata_ratio;
int ret; int ret;
btrfs_remount_prepare(fs_info, old_opts, *flags); btrfs_remount_prepare(fs_info);
ret = btrfs_parse_options(root, data); ret = btrfs_parse_options(root, data);
if (ret) { if (ret) {
...@@ -1244,6 +1247,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -1244,6 +1247,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
goto restore; goto restore;
} }
btrfs_remount_begin(fs_info, old_opts, *flags);
btrfs_resize_thread_pool(fs_info, btrfs_resize_thread_pool(fs_info,
fs_info->thread_pool_size, old_thread_pool_size); fs_info->thread_pool_size, old_thread_pool_size);
......
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