Commit fac03c8d authored by David Sterba's avatar David Sterba

btrfs: move fs_info::fs_frozen to the flags

We can keep the state among the other fs_info flags, there's no reason
why fs_frozen would need to be separate.
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 79b4f4c6
...@@ -716,6 +716,8 @@ struct btrfs_delayed_root; ...@@ -716,6 +716,8 @@ struct btrfs_delayed_root;
#define BTRFS_FS_LOG1_ERR 12 #define BTRFS_FS_LOG1_ERR 12
#define BTRFS_FS_LOG2_ERR 13 #define BTRFS_FS_LOG2_ERR 13
#define BTRFS_FS_QUOTA_OVERRIDE 14 #define BTRFS_FS_QUOTA_OVERRIDE 14
/* Used to record internally whether fs has been frozen */
#define BTRFS_FS_FROZEN 15
/* /*
* Indicate that a whole-filesystem exclusive operation is running * Indicate that a whole-filesystem exclusive operation is running
...@@ -1107,9 +1109,6 @@ struct btrfs_fs_info { ...@@ -1107,9 +1109,6 @@ struct btrfs_fs_info {
*/ */
struct list_head pinned_chunks; struct list_head pinned_chunks;
/* Used to record internally whether fs has been frozen */
int fs_frozen;
/* Cached block sizes */ /* Cached block sizes */
u32 nodesize; u32 nodesize;
u32 sectorsize; u32 sectorsize;
......
...@@ -2661,7 +2661,6 @@ int open_ctree(struct super_block *sb, ...@@ -2661,7 +2661,6 @@ int open_ctree(struct super_block *sb,
atomic_set(&fs_info->qgroup_op_seq, 0); atomic_set(&fs_info->qgroup_op_seq, 0);
atomic_set(&fs_info->reada_works_cnt, 0); atomic_set(&fs_info->reada_works_cnt, 0);
atomic64_set(&fs_info->tree_mod_seq, 0); atomic64_set(&fs_info->tree_mod_seq, 0);
fs_info->fs_frozen = 0;
fs_info->sb = sb; fs_info->sb = sb;
fs_info->max_inline = BTRFS_DEFAULT_MAX_INLINE; fs_info->max_inline = BTRFS_DEFAULT_MAX_INLINE;
fs_info->metadata_ratio = 0; fs_info->metadata_ratio = 0;
......
...@@ -2242,7 +2242,7 @@ static int btrfs_freeze(struct super_block *sb) ...@@ -2242,7 +2242,7 @@ static int btrfs_freeze(struct super_block *sb)
struct btrfs_fs_info *fs_info = btrfs_sb(sb); struct btrfs_fs_info *fs_info = btrfs_sb(sb);
struct btrfs_root *root = fs_info->tree_root; struct btrfs_root *root = fs_info->tree_root;
fs_info->fs_frozen = 1; set_bit(BTRFS_FS_FROZEN, &fs_info->flags);
/* /*
* We don't need a barrier here, we'll wait for any transaction that * We don't need a barrier here, we'll wait for any transaction that
* could be in progress on other threads (and do delayed iputs that * could be in progress on other threads (and do delayed iputs that
...@@ -2261,7 +2261,9 @@ static int btrfs_freeze(struct super_block *sb) ...@@ -2261,7 +2261,9 @@ static int btrfs_freeze(struct super_block *sb)
static int btrfs_unfreeze(struct super_block *sb) static int btrfs_unfreeze(struct super_block *sb)
{ {
btrfs_sb(sb)->fs_frozen = 0; struct btrfs_fs_info *fs_info = btrfs_sb(sb);
clear_bit(BTRFS_FS_FROZEN, &fs_info->flags);
return 0; return 0;
} }
......
...@@ -2314,7 +2314,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -2314,7 +2314,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
* it'll result in deadlock about SB_FREEZE_FS. * it'll result in deadlock about SB_FREEZE_FS.
*/ */
if (current != fs_info->transaction_kthread && if (current != fs_info->transaction_kthread &&
current != fs_info->cleaner_kthread && !fs_info->fs_frozen) current != fs_info->cleaner_kthread &&
!test_bit(BTRFS_FS_FROZEN, &fs_info->flags))
btrfs_run_delayed_iputs(fs_info); btrfs_run_delayed_iputs(fs_info);
return ret; return ret;
......
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