Skip to content

Commit 88c4703

Browse files
morbidrsakdave
authored andcommitted
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 <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 162e0a1 commit 88c4703

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

fs/btrfs/super.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,11 +1782,6 @@ static void btrfs_resize_thread_pool(struct btrfs_fs_info *fs_info,
17821782
new_pool_size);
17831783
}
17841784

1785-
static inline void btrfs_remount_prepare(struct btrfs_fs_info *fs_info)
1786-
{
1787-
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
1788-
}
1789-
17901785
static inline void btrfs_remount_begin(struct btrfs_fs_info *fs_info,
17911786
unsigned long old_opts, int flags)
17921787
{
@@ -1820,8 +1815,6 @@ static inline void btrfs_remount_cleanup(struct btrfs_fs_info *fs_info,
18201815
else if (btrfs_raw_test_opt(old_opts, DISCARD_ASYNC) &&
18211816
!btrfs_test_opt(fs_info, DISCARD_ASYNC))
18221817
btrfs_discard_cleanup(fs_info);
1823-
1824-
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
18251818
}
18261819

18271820
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)
18371830
int ret;
18381831

18391832
sync_filesystem(sb);
1840-
btrfs_remount_prepare(fs_info);
1833+
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
18411834

18421835
if (data) {
18431836
void *new_sec_opts = NULL;
@@ -1959,6 +1952,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
19591952
out:
19601953
wake_up_process(fs_info->transaction_kthread);
19611954
btrfs_remount_cleanup(fs_info, old_opts);
1955+
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
1956+
19621957
return 0;
19631958

19641959
restore:
@@ -1973,6 +1968,8 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
19731968
old_thread_pool_size, fs_info->thread_pool_size);
19741969
fs_info->metadata_ratio = old_metadata_ratio;
19751970
btrfs_remount_cleanup(fs_info, old_opts);
1971+
clear_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
1972+
19761973
return ret;
19771974
}
19781975

0 commit comments

Comments
 (0)