Expand description
High-level filesystem API on top of btrfs-disk.
Filesystem exposes the operations a userspace driver needs:
lookup, readdir, read, readlink, getattr, xattr_get,
xattr_list, and statfs. Each returns plain std::io::Result
values and does not depend on any FUSE protocol crate, so the same
API drives the btrfs-fuse mount and any other embedder
(offline tools, tests, alternate FUSE bindings).
§Inode model
Inode is the pair (subvol, ino). For now only the default
subvolume is exposed, but multi-subvolume support is the next phase
and the API is shaped for it from the start. Callers that need a
flat u64 (e.g. FUSE) translate at the boundary.
§Status
Read-only. Write support is planned via the btrfs-transaction
crate; see the project roadmap.
Re-exports§
Modules§
- dir
- Directory entries and the file-kind enum.
- stat
- POSIX-style inode metadata returned by
crate::Filesystem::getattr.
Structs§
- Cache
Config - Capacities for the three caches a
crate::Filesystemholds. Pass tocrate::Filesystem::open_with_caches/crate::Filesystem::open_subvol_with_cachesto override the defaults — useful for memory-constrained embedders or benchmarking the cold path. - Cache
Stats - Live counters for an
LruTreeBlockCache. Useful for tests, benchmarks, and embedders who want to expose cache hit ratios via metrics. - Device
Item - Device item describing a single device in the filesystem.
- Filesystem
- High-level read-only btrfs filesystem.
- Inode
- A filesystem-level inode reference: the subvolume it lives in plus the on-disk objectid within that subvolume.
- LruTree
Block Cache - LRU-evicting
TreeBlockCachekeyed by logical address. - RootRef
- Reference linking a subvolume to its parent directory.
- Search
Filter - Compound-key range filter for
Filesystem::tree_search. Mirrors the kernel’sbtrfs_ioctl_search_keysemantics: items are returned where(min_objectid, min_type, min_offset) <= (key) <= (max_objectid, max_type, max_offset)treated as a single 17-byte compound key, AND the leaf’s generation falls in[min_transid, max_transid]. - Search
Item - One item returned by
Filesystem::tree_search.transidis the leaf’s generation (matching the kernel ioctl’sbtrfs_ioctl_search_header.transid). - StatFs
- Filesystem-wide statistics, returned by
Filesystem::statfs. - Subvol
Id - Identifier for a subvolume tree (the tree’s root objectid).
- Subvol
Info - Metadata for a single subvolume, returned by
Filesystem::list_subvolumesandFilesystem::get_subvol_info. - Superblock
- Parsed btrfs superblock.
- Uuid
- A Universally Unique Identifier (UUID).
Enums§
- Seek
Hole Data - Whence value for
Filesystem::seek_hole_data. Maps to the POSIXSEEK_HOLE/SEEK_DATAwhence constants used bylseek(2).