Skip to content

Commit 5cb502f

Browse files
adam900710kdave
authored andcommitted
btrfs: relocation: allow signal to cancel balance
Although btrfs balance can be canceled with "btrfs balance cancel" command, it's still almost muscle memory to press Ctrl-C to cancel a long running btrfs balance. So allow btrfs balance to check signal to determine if it should exit. The cancellation points are in known location and we're only adding one more reason, so this should be safe. Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 813f8a0 commit 5cb502f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/relocation.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,8 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end,
26562656
*/
26572657
int btrfs_should_cancel_balance(struct btrfs_fs_info *fs_info)
26582658
{
2659-
return atomic_read(&fs_info->balance_cancel_req);
2659+
return atomic_read(&fs_info->balance_cancel_req) ||
2660+
fatal_signal_pending(current);
26602661
}
26612662
ALLOW_ERROR_INJECTION(btrfs_should_cancel_balance, TRUE);
26622663

0 commit comments

Comments
 (0)