diff options
author | David Sterba | 2018-03-20 17:28:05 +0100 |
---|---|---|
committer | David Sterba | 2018-05-28 18:07:24 +0200 |
commit | a17c95df4cc8ade4e0e7276a04c0cc89505c74d7 (patch) | |
tree | 8176d351a07df707917f417278ab23cda83dd711 /fs/btrfs/volumes.c | |
parent | 72b81abf95ae8d2c78c5f38197f47597cf192d2b (diff) |
btrfs: move clearing of EXCL_OP out of __cancel_balance
Make the clearning visible in the callers so we can pair it with the
test_and_set part.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1da46365657b..7e3656c9798b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -3780,8 +3780,6 @@ static void __cancel_balance(struct btrfs_fs_info *fs_info) ret = del_balance_item(fs_info); if (ret) btrfs_handle_fs_error(fs_info, ret, NULL); - - clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); } /* Non-zero return value signifies invalidity */ @@ -3939,6 +3937,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl, if ((ret && ret != -ECANCELED && ret != -ENOSPC) || balance_need_close(fs_info)) { __cancel_balance(fs_info); + clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); } wake_up(&fs_info->balance_wait_q); @@ -3947,10 +3946,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl, out: if (bctl->flags & BTRFS_BALANCE_RESUME) __cancel_balance(fs_info); - else { + else kfree(bctl); - clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); - } + clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); + return ret; } @@ -4118,8 +4117,10 @@ int btrfs_cancel_balance(struct btrfs_fs_info *fs_info) mutex_lock(&fs_info->volume_mutex); mutex_lock(&fs_info->balance_mutex); - if (fs_info->balance_ctl) + if (fs_info->balance_ctl) { __cancel_balance(fs_info); + clear_bit(BTRFS_FS_EXCL_OP, &fs_info->flags); + } mutex_unlock(&fs_info->volume_mutex); } |