fs/xfs/libxfs/xfs_btree_staging.h
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_btree_staging.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_btree_staging.h- Extension
.h- Size
- 4167 bytes
- Lines
- 131
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
struct xbtree_afakerootstruct xbtree_ifakerootstruct xfs_btree_bload
Annotated Snippet
struct xbtree_afakeroot {
/* AG block number of the new btree root. */
xfs_agblock_t af_root;
/* Height of the new btree. */
unsigned int af_levels;
/* Number of blocks used by the btree. */
unsigned int af_blocks;
};
/* Cursor interactions with fake roots for AG-rooted btrees. */
void xfs_btree_stage_afakeroot(struct xfs_btree_cur *cur,
struct xbtree_afakeroot *afake);
void xfs_btree_commit_afakeroot(struct xfs_btree_cur *cur, struct xfs_trans *tp,
struct xfs_buf *agbp);
/* Fake root for an inode-rooted btree. */
struct xbtree_ifakeroot {
/* Fake inode fork. */
struct xfs_ifork *if_fork;
/* Number of blocks used by the btree. */
int64_t if_blocks;
/* Height of the new btree. */
unsigned int if_levels;
/* Number of bytes available for this fork in the inode. */
unsigned int if_fork_size;
};
/* Cursor interactions with fake roots for inode-rooted btrees. */
void xfs_btree_stage_ifakeroot(struct xfs_btree_cur *cur,
struct xbtree_ifakeroot *ifake);
void xfs_btree_commit_ifakeroot(struct xfs_btree_cur *cur, struct xfs_trans *tp,
int whichfork);
/* Bulk loading of staged btrees. */
typedef int (*xfs_btree_bload_get_records_fn)(struct xfs_btree_cur *cur,
unsigned int idx, struct xfs_btree_block *block,
unsigned int nr_wanted, void *priv);
typedef int (*xfs_btree_bload_claim_block_fn)(struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr, void *priv);
typedef size_t (*xfs_btree_bload_iroot_size_fn)(struct xfs_btree_cur *cur,
unsigned int level, unsigned int nr_this_level, void *priv);
struct xfs_btree_bload {
/*
* This function will be called to load @nr_wanted records into the
* btree. The implementation does this by setting the cursor's bc_rec
* field in in-core format and using init_rec_from_cur to set the
* records in the btree block. Records must be returned in sort order.
* The function must return the number of records loaded or the usual
* negative errno.
*/
xfs_btree_bload_get_records_fn get_records;
/*
* This function will be called nr_blocks times to obtain a pointer
* to a new btree block on disk. Callers must preallocate all space
* for the new btree before calling xfs_btree_bload, and this function
* is what claims that reservation.
*/
xfs_btree_bload_claim_block_fn claim_block;
/*
* This function should return the size of the in-core btree root
* block. It is only necessary for XFS_BTREE_TYPE_INODE btrees.
*/
xfs_btree_bload_iroot_size_fn iroot_size;
/*
* The caller should set this to the number of records that will be
* stored in the new btree.
*/
uint64_t nr_records;
/*
* Number of free records to leave in each leaf block. If the caller
* sets this to -1, the slack value will be calculated to be halfway
* between maxrecs and minrecs. This typically leaves the block 75%
* full. Note that slack values are not enforced on inode root blocks.
*/
int leaf_slack;
/*
* Number of free key/ptrs pairs to leave in each node block. This
* field has the same semantics as leaf_slack.
*/
Annotation
- Detected declarations: `struct xbtree_afakeroot`, `struct xbtree_ifakeroot`, `struct xfs_btree_bload`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.