]> git.hungrycats.org Git - linux/commit
btrfs: relocation: Introduce error injection points for cancelling balance
authorQu Wenruo <wqu@suse.com>
Tue, 3 Dec 2019 06:42:51 +0000 (14:42 +0800)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 8 Dec 2019 03:18:37 +0000 (22:18 -0500)
commit2b39bbf4fbde34813d13de1f10da7fcd28bd252e
tree58cfe55b9a6f6fe3b20c3ed856e1752e7b815435
parent3fef15d04226a183051b29a9d956eb6a3a0f6c9d
btrfs: relocation: Introduce error injection points for cancelling balance

Introduce a new error injection point, should_cancel_balance().

It's just a wrapper of atomic_read(&fs_info->balance_cancel_req), but
allows us to override the return value.

Currently there are only one locations using this function:
- btrfs_balance()
  It checks cancel before each block group.

There are other locations checking fs_info->balance_cancel_req, but they
are not used as an indicator to exit, so there is no need to use the
wrapper.

But there will be more locations coming, and some locations can cause
kernel panic if not handled properly.

So introduce this error injection to provide better test interface.

Signed-off-by: Qu Wenruo <wqu@suse.com>
(cherry picked from commit 6d2751364569f885ca795e37882690a78ac9f149)
fs/btrfs/ctree.h
fs/btrfs/relocation.c
fs/btrfs/volumes.c