diff options
author | David Sterba <dsterba@suse.com> | 2018-03-21 01:31:04 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-05-28 18:07:25 +0200 |
commit | 3009a62f3b18230a000d1a91e9a676036487e834 (patch) | |
tree | 87182c14f50c753c4b408b103c7bdc2215ac84c3 /fs/btrfs/ctree.h | |
parent | dccdb07bc996e9c8de80d06813163ca08288bf73 (diff) | |
download | linux-stable-3009a62f3b18230a000d1a91e9a676036487e834.tar.gz linux-stable-3009a62f3b18230a000d1a91e9a676036487e834.tar.bz2 linux-stable-3009a62f3b18230a000d1a91e9a676036487e834.zip |
btrfs: track running balance in a simpler way
Currently fs_info::balance_running is 0 or 1 and does not use the
semantics of atomics. The pause and cancel check for 0, that can happen
only after __btrfs_balance exits for whatever reason.
Parallel calls to balance ioctl may enter btrfs_ioctl_balance multiple
times but will block on the balance_mutex that protects the
fs_info::flags bit.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index add0e5a3f415..8fdc97312b61 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -739,6 +739,12 @@ struct btrfs_delayed_root; */ #define BTRFS_FS_NEED_ASYNC_COMMIT 17 +/* + * Indicate that balance has been set up from the ioctl and is in the main + * phase. The fs_info::balance_ctl is initialized. + */ +#define BTRFS_FS_BALANCE_RUNNING 18 + struct btrfs_fs_info { u8 fsid[BTRFS_FSID_SIZE]; u8 chunk_tree_uuid[BTRFS_UUID_SIZE]; @@ -1003,7 +1009,6 @@ struct btrfs_fs_info { /* restriper state */ spinlock_t balance_lock; struct mutex balance_mutex; - atomic_t balance_running; atomic_t balance_pause_req; atomic_t balance_cancel_req; struct btrfs_balance_control *balance_ctl; |