On 2020/6/8 下午3:44, Michał Mirosław wrote:
> On Mon, Jun 08, 2020 at 03:24:10PM +0800, Qu Wenruo wrote:
>> On 2020/6/8 下午3:20, Michał Mirosław wrote:
>>> 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).
>>
>> We want to check to be executed even on production system, but just less
>> noisy (no kernel backtrace dump).
>> Just like tree-checker and EXTENT_QUOTA_RESERVED check.
>
> In that case I suggest:
>
> btrfs_err(...);
> WARN_ON(IS_ENABLED(CONFIG_BTRFS_DEBUG));
>
> as I expect people look for messages before the Oops for more information.
Yep, exactly what Nik suggested and what I would do in next version.
Thanks,
Qu
>
> Best Regards,
> Michał Mirosław
>