Btrfs: allow for canceling restriper
Implement an ioctl for canceling restriper. Currently we wait until relocation of the current block group is finished, in future this can be done by triggering a commit. Balance item is deleted and no memory about the interrupted balance is kept. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
@@ -3076,6 +3076,8 @@ void update_ioctl_balance_args(struct btrfs_fs_info *fs_info,
|
||||
bargs->state |= BTRFS_BALANCE_STATE_RUNNING;
|
||||
if (atomic_read(&fs_info->balance_pause_req))
|
||||
bargs->state |= BTRFS_BALANCE_STATE_PAUSE_REQ;
|
||||
if (atomic_read(&fs_info->balance_cancel_req))
|
||||
bargs->state |= BTRFS_BALANCE_STATE_CANCEL_REQ;
|
||||
|
||||
memcpy(&bargs->data, &bctl->data, sizeof(bargs->data));
|
||||
memcpy(&bargs->meta, &bctl->meta, sizeof(bargs->meta));
|
||||
@@ -3157,6 +3159,8 @@ static long btrfs_ioctl_balance_ctl(struct btrfs_root *root, int cmd)
|
||||
switch (cmd) {
|
||||
case BTRFS_BALANCE_CTL_PAUSE:
|
||||
return btrfs_pause_balance(root->fs_info);
|
||||
case BTRFS_BALANCE_CTL_CANCEL:
|
||||
return btrfs_cancel_balance(root->fs_info);
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
|
Reference in New Issue
Block a user