Expand description
§Generic B-tree search: walking any internal btrfs tree via BTRFS_IOC_TREE_SEARCH
The kernel’s tree search ioctl lets userspace read any internal btrfs tree
(chunk, root, quota, …) by specifying a key range. Items are returned in
batches; tree_search advances the cursor automatically and calls a
closure once per item until the range is exhausted.
§Byte order
SearchHeader fields (objectid, offset, type) are in host byte order:
the kernel fills them in through the ioctl layer. The data slice passed
to the callback contains the raw on-disk item payload, which is
little-endian; callers must use u64::from_le_bytes and friends when
interpreting it.
§Ioctl version
This module provides two variants:
tree_searchusesBTRFS_IOC_TREE_SEARCH(v1) with its fixed 3992-byte result buffer. Sufficient for all item types used by this crate.tree_search_v2usesBTRFS_IOC_TREE_SEARCH_V2with a caller-chosen buffer size. Useful when items may be larger than what v1 can return in a single batch.
Structs§
- Search
Header - Metadata returned for each item found by
tree_search. - Search
Key - Parameters specifying which items to return from a tree search.
Functions§
- tree_
search - Walk every item in the tree that falls within
key, callingfonce for each one. - tree_
search_ v2 - Like
tree_searchbut usesBTRFS_IOC_TREE_SEARCH_V2with a larger result buffer.