From: Qu Wenruo Date: Mon, 13 Jul 2020 01:03:19 +0000 (+0800) Subject: btrfs: relocation: allow signal to cancel balance X-Git-Tag: v5.15~2817^2~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5cb502f4ab6469c3d02bd787a3ff58a7b624ba67;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 523d2e5..2b869fb 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2656,7 +2656,8 @@ int setup_extent_mapping(struct inode *inode, u64 start, u64 end, */ int btrfs_should_cancel_balance(struct btrfs_fs_info *fs_info) { - return atomic_read(&fs_info->balance_cancel_req); + return atomic_read(&fs_info->balance_cancel_req) || + fatal_signal_pending(current); } ALLOW_ERROR_INJECTION(btrfs_should_cancel_balance, TRUE);