On Sun, Jun 07, 2020 at 03:25:12PM +0800, Qu Wenruo wrote:
> Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> ---
> fs/btrfs/disk-io.c | 6 ++++++
> fs/btrfs/qgroup.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> fs/btrfs/qgroup.h | 2 +-
> 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index f8ec2d8606fd..48d047e64461 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -4058,6 +4058,12 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
> ASSERT(list_empty(&fs_info->delayed_iputs));
> set_bit(BTRFS_FS_CLOSING_DONE, &fs_info->flags);
>
> + if (btrfs_qgroup_has_leak(fs_info)) {
> + WARN(IS_ENABLED(CONFIG_BTRFS_DEBUG),
> + KERN_ERR "BTRFS: qgroup reserved space leaked\n");
> + btrfs_err(fs_info, "qgroup reserved space leaked\n");
> + }
This looks like debugging aid, so:
if (IS_ENABLED(CONFIG_BTRFS_DEBUG))
btrfs_check_qgroup_leak(fs_info);
would be more readable (WARN() pushed to the function).
Best Regards,
Michał Mirosław