mirror of
https://github.com/torvalds/linux
synced 2024-09-19 18:46:35 +00:00
Btrfs: allow for resuming restriper after it was paused
Recognize BTRFS_BALANCE_RESUME flag passed from userspace. We use the same heuristics used when recovering balance after a crash to try to start where we left off last time. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
a7e99c691a
commit
de322263d3
|
@ -3106,6 +3106,20 @@ static long btrfs_ioctl_balance(struct btrfs_root *root, void __user *arg)
|
||||||
ret = PTR_ERR(bargs);
|
ret = PTR_ERR(bargs);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bargs->flags & BTRFS_BALANCE_RESUME) {
|
||||||
|
if (!fs_info->balance_ctl) {
|
||||||
|
ret = -ENOTCONN;
|
||||||
|
goto out_bargs;
|
||||||
|
}
|
||||||
|
|
||||||
|
bctl = fs_info->balance_ctl;
|
||||||
|
spin_lock(&fs_info->balance_lock);
|
||||||
|
bctl->flags |= BTRFS_BALANCE_RESUME;
|
||||||
|
spin_unlock(&fs_info->balance_lock);
|
||||||
|
|
||||||
|
goto do_balance;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bargs = NULL;
|
bargs = NULL;
|
||||||
}
|
}
|
||||||
|
@ -3133,6 +3147,7 @@ static long btrfs_ioctl_balance(struct btrfs_root *root, void __user *arg)
|
||||||
bctl->flags |= BTRFS_BALANCE_TYPE_MASK;
|
bctl->flags |= BTRFS_BALANCE_TYPE_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_balance:
|
||||||
ret = btrfs_balance(bctl, bargs);
|
ret = btrfs_balance(bctl, bargs);
|
||||||
/*
|
/*
|
||||||
* bctl is freed in __cancel_balance or in free_fs_info if
|
* bctl is freed in __cancel_balance or in free_fs_info if
|
||||||
|
|
Loading…
Reference in a new issue