From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Sun YangKai <sunk67188@gmail.com>
Subject: [PATCH 1/3] btrfs: qgroup: drop pointless return_any fallback when reading qgroup config
Date: Sun, 8 Feb 2026 11:19:37 +0800 [thread overview]
Message-ID: <20260208032705.27040-5-sunk67188@gmail.com> (raw)
In-Reply-To: <20260208032705.27040-3-sunk67188@gmail.com>
btrfs_read_qgroup_config() initializes iteration over the quota root by
searching for the first item using a zeroed key (0, 0, 0).
The search is done with find_higher=1, meaning it looks for the first key
strictly greater than (0, 0, 0). However, the call also sets return_any=1,
which allows falling back to a lower key if no higher one is found.
Since (0, 0, 0) is the absolute minimum in the btrfs key space, there can
be no valid lower key. The return_any fallback is therefore impossible to
trigger and misleading in this context.
Set return_any to 0 to correctly express the intent: find the first item
greater than (0, 0, 0), or return not found if the quota root is empty.
Signed-off-by: Sun YangKai <sunk67188@gmail.com>
---
fs/btrfs/qgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 206587820fec..b8040740f7ca 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -415,7 +415,7 @@ int btrfs_read_qgroup_config(struct btrfs_fs_info *fs_info)
key.objectid = 0;
key.type = 0;
key.offset = 0;
- ret = btrfs_search_slot_for_read(quota_root, &key, path, 1, 1);
+ ret = btrfs_search_slot_for_read(quota_root, &key, path, 1, 0);
if (ret)
goto out;
--
2.52.0
next prev parent reply other threads:[~2026-02-08 3:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-08 3:19 [PATCH 0/3] btrfs: remove unused return_any parameter from btrfs_search_slot_for_read() Sun YangKai
2026-02-08 3:19 ` Sun YangKai [this message]
2026-02-08 3:38 ` [PATCH 2/3] btrfs: send: drop unnecessary return_any search in get_last_extent() Sun YangKai
2026-02-08 3:40 ` [PATCH 3/3] btrfs: simplify btrfs_search_slot_for_read() by removing return_any parameter Sun YangKai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260208032705.27040-5-sunk67188@gmail.com \
--to=sunk67188@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox