btrfs: open-code remount flag setting in btrfs_remount
When we're (re)mounting a btrfs filesystem we set the BTRFS_FS_STATE_REMOUNTING state in fs_info to serialize against async reclaim or defrags. This flag is set in btrfs_remount_prepare() called by btrfs_remount(). As btrfs_remount_prepare() does nothing but setting this flag and doesn't have a second caller, we can just open-code the flag setting in btrfs_remount(). Similarly do for so clearing of the flag by moving it out of btrfs_remount_cleanup() into btrfs_remount() to be symmetrical. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Родитель
162e0a16b7
Коммит
88c4703f00
|
@ -1782,11 +1782,6 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
|
|||
new_pool_size);
|
||||
}
|
||||
|
||||
static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -1820,8 +1815,6 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info,
|
|||
else if (btrfs_raw_test_opt(old_opts, DISCARD_ASYNC) &&
|
||||
!btrfs_test_opt(fs_info, DISCARD_ASYNC))
|
||||
btrfs_discard_cleanup(fs_info);
|
||||
|
||||
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
}
|
||||
|
||||
static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
||||
|
@ -1837,7 +1830,7 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
|||
int ret;
|
||||
|
||||
sync_filesystem(sb);
|
||||
btrfs_remount_prepare(fs_info);
|
||||
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
|
||||
if (data) {
|
||||
void *new_sec_opts = NULL;
|
||||
|
@ -1959,6 +1952,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
|
|||
out:
|
||||
wake_up_process(fs_info->transaction_kthread);
|
||||
btrfs_remount_cleanup(fs_info, old_opts);
|
||||
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
|
||||
return 0;
|
||||
|
||||
restore:
|
||||
|
@ -1973,6 +1968,8 @@ restore:
|
|||
old_thread_pool_size, fs_info->thread_pool_size);
|
||||
fs_info->metadata_ratio = old_metadata_ratio;
|
||||
btrfs_remount_cleanup(fs_info, old_opts);
|
||||
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче