aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-06-15 13:10:03 -0400
committerDavid Sterba <dsterba@suse.com>2017-06-20 08:22:42 -0400
commitfac03c8daeb581e2bc38e5a8c0c6a42cf87cf1c3 (patch)
treea6f7828cc438f65698b4341ae84f576fbc853eec
parent79b4f4c605b76194448315865ebcf6fcb0844fc5 (diff)
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: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/ctree.h5
-rw-r--r--fs/btrfs/disk-io.c1
-rw-r--r--fs/btrfs/super.c6
-rw-r--r--fs/btrfs/transaction.c3
4 files changed, 8 insertions, 7 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f0f5f28784b6..6375e57a5a69 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -716,6 +716,8 @@ struct btrfs_delayed_root;
716#define BTRFS_FS_LOG1_ERR 12 716#define BTRFS_FS_LOG1_ERR 12
717#define BTRFS_FS_LOG2_ERR 13 717#define BTRFS_FS_LOG2_ERR 13
718#define BTRFS_FS_QUOTA_OVERRIDE 14 718#define BTRFS_FS_QUOTA_OVERRIDE 14
719/* Used to record internally whether fs has been frozen */
720#define BTRFS_FS_FROZEN 15
719 721
720/* 722/*
721 * Indicate that a whole-filesystem exclusive operation is running 723 * Indicate that a whole-filesystem exclusive operation is running
@@ -1107,9 +1109,6 @@ struct btrfs_fs_info {
1107 */ 1109 */
1108 struct list_head pinned_chunks; 1110 struct list_head pinned_chunks;
1109 1111
1110 /* Used to record internally whether fs has been frozen */
1111 int fs_frozen;
1112
1113 /* Cached block sizes */ 1112 /* Cached block sizes */
1114 u32 nodesize; 1113 u32 nodesize;
1115 u32 sectorsize; 1114 u32 sectorsize;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 2b00ebff13f8..2ac0a35f4450 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2661,7 +2661,6 @@ int open_ctree(struct super_block *sb,
2661 atomic_set(&fs_info->qgroup_op_seq, 0); 2661 atomic_set(&fs_info->qgroup_op_seq, 0);
2662 atomic_set(&fs_info->reada_works_cnt, 0); 2662 atomic_set(&fs_info->reada_works_cnt, 0);
2663 atomic64_set(&fs_info->tree_mod_seq, 0); 2663 atomic64_set(&fs_info->tree_mod_seq, 0);
2664 fs_info->fs_frozen = 0;
2665 fs_info->sb = sb; 2664 fs_info->sb = sb;
2666 fs_info->max_inline = BTRFS_DEFAULT_MAX_INLINE; 2665 fs_info->max_inline = BTRFS_DEFAULT_MAX_INLINE;
2667 fs_info->metadata_ratio = 0; 2666 fs_info->metadata_ratio = 0;
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 53d43cd3cace..2100be6ae68e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2242,7 +2242,7 @@ static int btrfs_freeze(struct super_block *sb)
2242 struct btrfs_fs_info *fs_info = btrfs_sb(sb); 2242 struct btrfs_fs_info *fs_info = btrfs_sb(sb);
2243 struct btrfs_root *root = fs_info->tree_root; 2243 struct btrfs_root *root = fs_info->tree_root;
2244 2244
2245 fs_info->fs_frozen = 1; 2245 set_bit(BTRFS_FS_FROZEN, &fs_info->flags);
2246 /* 2246 /*
2247 * We don't need a barrier here, we'll wait for any transaction that 2247 * We don't need a barrier here, we'll wait for any transaction that
2248 * could be in progress on other threads (and do delayed iputs that 2248 * 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 2261
2262static int btrfs_unfreeze(struct super_block *sb) 2262static int btrfs_unfreeze(struct super_block *sb)
2263{ 2263{
2264 btrfs_sb(sb)->fs_frozen = 0; 2264 struct btrfs_fs_info *fs_info = btrfs_sb(sb);
2265
2266 clear_bit(BTRFS_FS_FROZEN, &fs_info->flags);
2265 return 0; 2267 return 0;
2266} 2268}
2267 2269
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index ab030fb22530..97e33513b195 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2314,7 +2314,8 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
2314 * it'll result in deadlock about SB_FREEZE_FS. 2314 * it'll result in deadlock about SB_FREEZE_FS.
2315 */ 2315 */
2316 if (current != fs_info->transaction_kthread && 2316 if (current != fs_info->transaction_kthread &&
2317 current != fs_info->cleaner_kthread && !fs_info->fs_frozen) 2317 current != fs_info->cleaner_kthread &&
2318 !test_bit(BTRFS_FS_FROZEN, &fs_info->flags))
2318 btrfs_run_delayed_iputs(fs_info); 2319 btrfs_run_delayed_iputs(fs_info);
2319 2320
2320 return ret; 2321 return ret;