Commit 833aae18 authored by David Sterba's avatar David Sterba

btrfs: open code set_balance_control

The helper is quite simple and I'd like to see the locking in the
caller.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 1354e1a1
...@@ -3199,21 +3199,6 @@ static void update_balance_args(struct btrfs_balance_control *bctl) ...@@ -3199,21 +3199,6 @@ static void update_balance_args(struct btrfs_balance_control *bctl)
} }
} }
/*
* Should be called with balance mutex held to protect against checking the
* balance status or progress. Same goes for reset_balance_state.
*/
static void set_balance_control(struct btrfs_balance_control *bctl)
{
struct btrfs_fs_info *fs_info = bctl->fs_info;
BUG_ON(fs_info->balance_ctl);
spin_lock(&fs_info->balance_lock);
fs_info->balance_ctl = bctl;
spin_unlock(&fs_info->balance_lock);
}
/* /*
* Clear the balance status in fs_info and delete the balance item from disk. * Clear the balance status in fs_info and delete the balance item from disk.
*/ */
...@@ -3899,7 +3884,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl, ...@@ -3899,7 +3884,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
if (!(bctl->flags & BTRFS_BALANCE_RESUME)) { if (!(bctl->flags & BTRFS_BALANCE_RESUME)) {
BUG_ON(ret == -EEXIST); BUG_ON(ret == -EEXIST);
set_balance_control(bctl); BUG_ON(fs_info->balance_ctl);
spin_lock(&fs_info->balance_lock);
fs_info->balance_ctl = bctl;
spin_unlock(&fs_info->balance_lock);
} else { } else {
BUG_ON(ret != -EEXIST); BUG_ON(ret != -EEXIST);
spin_lock(&fs_info->balance_lock); spin_lock(&fs_info->balance_lock);
...@@ -4045,7 +4033,10 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info) ...@@ -4045,7 +4033,10 @@ int btrfs_recover_balance(struct btrfs_fs_info *fs_info)
"cannot set exclusive op status to balance, resume manually"); "cannot set exclusive op status to balance, resume manually");
mutex_lock(&fs_info->balance_mutex); mutex_lock(&fs_info->balance_mutex);
set_balance_control(bctl); BUG_ON(fs_info->balance_ctl);
spin_lock(&fs_info->balance_lock);
fs_info->balance_ctl = bctl;
spin_unlock(&fs_info->balance_lock);
mutex_unlock(&fs_info->balance_mutex); mutex_unlock(&fs_info->balance_mutex);
out: out:
btrfs_free_path(path); btrfs_free_path(path);
......
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