From 65583d4749af1bede388425b5ab70cb6cbb68125 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Thu, 1 Oct 2026 14:46:16 +0930 Subject: [PATCH] btrfs: qgroup: use qgroup_mark_inconsistent() in quick_update_accounting() When quick_update_accounting() fails to handle a qgroup which is not fully exclusive (its exclusive number doesn't match the reference one), we have to mark the qgroup inconsistent. Unlike other locations we didn't use qgroup_mark_inconsistent(), thus when such problem happens no extra error message is shown. Use the helper in quick_update_accounting(), which does not only show the reason of marking qgroup inconsistent, but also cancels any running rescan and skips dirty accounting, avoiding wasting CPU time on already inconsistent qgroup numbers. Reviewed-by: Filipe Manana Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- fs/btrfs/qgroup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index dfe3827ec369..d3401a6df530 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1562,7 +1562,10 @@ static int quick_update_accounting(struct btrfs_fs_info *fs_info, } out: if (ret) - set_bit(BTRFS_QGROUP_STATUS_BIT_INCONSISTENT, &fs_info->qgroup_flags); + qgroup_mark_inconsistent(fs_info, + "unable to do quick excl updating for qgroup %hu/%llu, ret=%d", + btrfs_qgroup_level(src), + btrfs_qgroup_subvolid(src), ret); return ret; }