btrfs: remove unused return_any parameter from btrfs_search_slot_for_read()
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | btrfs: qgroup: drop pointless return_any fallback when reading qgroup configfs/ | +1 | 0 replies | |
| 2/3 | btrfs: send: drop unnecessary return_any search in get_last_extent()fs/ | +1 | 0 replies | |
| 3/3 | btrfs: simplify btrfs_search_slot_for_read() by removing return_any parameterfs/ fs/ fs/ +2 more | +21 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/3] btrfs: remove unused return_any parameter from btrfs_search_slot_for_read()
The return_any parameter in btrfs_search_slot_for_read() was designed to allow falling back to the opposite search direction when no item is found in the requested direction. However, analysis shows that:
- The vast majority of callers pass return_any=0, meaning the fallback logic is effectively dead code for the common case.
- The few callers that did pass return_any=1 were doing so unnecessarily
- get_last_extent() in send.c: There is always a previous item (at minimum the inode_item) before an extent data item, making the fallback impossible to trigger.
- btrfs_read_qgroup_config() in qgroup.c: When searching from the zeroed key (0,0,0) with find_higher=1, there cannot possibly be a lower key to fall back to, making return_any=1 logically nonsensical.
This series removes these unnecessary return_any=1 usages (patches 1-2), then removes the now-unused parameter and associated dead code from btrfs_search_slot_for_read() (patch 3).
The final result is a significantly simplified interface and implementation, with no functional change for any existing code path.
Patch 1: Drop pointless return_any fallback in qgroup config reading Patch 2: Drop unnecessary return_any search in send's get_last_extent() Patch 3: Remove return_any parameter and simplify implementation
Sun YangKai (3):
btrfs: qgroup: drop pointless return_any fallback when reading qgroup
config
btrfs: send: drop unnecessary return_any search in get_last_extent()
btrfs: simplify btrfs_search_slot_for_read() by removing return_any
parameter
fs/btrfs/ctree.c | 48 +++++++------------------------------- fs/btrfs/ctree.h | 3 +-- fs/btrfs/free-space-tree.c | 2 +- fs/btrfs/qgroup.c | 10 ++++---- fs/btrfs/send.c | 22 ++++++++--------- 5 files changed, 25 insertions(+), 60 deletions(-)
Signature · 1 line
2.52.0