fs/xfs/libxfs/xfs_btree.h
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_btree.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_btree.h- Extension
.h- Size
- 22393 bytes
- Lines
- 716
- 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 xfs_bufstruct xfs_inodestruct xfs_mountstruct xfs_transstruct xfs_iforkstruct xfs_peragstruct xfs_btree_opsstruct xfs_btree_opsstruct xfs_btree_levelstruct xfs_btree_curenum xbtree_key_contigenum xfs_btree_typefunction xbtree_key_contigfunction xfs_btree_cur_sizeoffunction xfs_btree_get_numrecsfunction xfs_btree_set_numrecsfunction xfs_btree_get_levelfunction xfs_btree_keycmp_ltfunction xfs_btree_keycmp_gtfunction xfs_btree_keycmp_eqfunction xfs_btree_keycmp_lefunction xfs_btree_keycmp_gefunction xfs_btree_keycmp_nefunction xfs_btree_masked_keycmp_ltfunction xfs_btree_masked_keycmp_gtfunction xfs_btree_masked_keycmp_gefunction xfs_btree_islastblockfunction xfs_btree_alloc_cursorfunction xfs_btree_at_iroot
Annotated Snippet
struct xfs_btree_ops {
const char *name;
/* Type of btree - AG-rooted or inode-rooted */
enum xfs_btree_type type;
/* XFS_BTGEO_* flags that determine the geometry of the btree */
unsigned int geom_flags;
/* size of the key, pointer, and record structures */
size_t key_len;
size_t ptr_len;
size_t rec_len;
/* LRU refcount to set on each btree buffer created */
unsigned int lru_refs;
/* offset of btree stats array */
unsigned int statoff;
/* sick mask for health reporting (not for bmap btrees) */
unsigned int sick_mask;
/* cursor operations */
struct xfs_btree_cur *(*dup_cursor)(struct xfs_btree_cur *);
void (*update_cursor)(struct xfs_btree_cur *src,
struct xfs_btree_cur *dst);
/* update btree root pointer */
void (*set_root)(struct xfs_btree_cur *cur,
const union xfs_btree_ptr *nptr, int level_change);
/* block allocation / freeing */
int (*alloc_block)(struct xfs_btree_cur *cur,
const union xfs_btree_ptr *start_bno,
union xfs_btree_ptr *new_bno,
int *stat);
int (*free_block)(struct xfs_btree_cur *cur, struct xfs_buf *bp);
/* records in block/level */
int (*get_minrecs)(struct xfs_btree_cur *cur, int level);
int (*get_maxrecs)(struct xfs_btree_cur *cur, int level);
/* records on disk. Matter for the root in inode case. */
int (*get_dmaxrecs)(struct xfs_btree_cur *cur, int level);
/* init values of btree structures */
void (*init_key_from_rec)(union xfs_btree_key *key,
const union xfs_btree_rec *rec);
void (*init_rec_from_cur)(struct xfs_btree_cur *cur,
union xfs_btree_rec *rec);
void (*init_ptr_from_cur)(struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr);
void (*init_high_key_from_rec)(union xfs_btree_key *key,
const union xfs_btree_rec *rec);
/*
* Compare key value and cursor value -- positive if key > cur,
* negative if key < cur, and zero if equal.
*/
int (*cmp_key_with_cur)(struct xfs_btree_cur *cur,
const union xfs_btree_key *key);
/*
* Compare key1 and key2 -- positive if key1 > key2, negative if
* key1 < key2, and zero if equal. If the @mask parameter is non NULL,
* each key field to be used in the comparison must contain a nonzero
* value.
*/
int (*cmp_two_keys)(struct xfs_btree_cur *cur,
const union xfs_btree_key *key1,
const union xfs_btree_key *key2,
const union xfs_btree_key *mask);
const struct xfs_buf_ops *buf_ops;
/* check that k1 is lower than k2 */
int (*keys_inorder)(struct xfs_btree_cur *cur,
const union xfs_btree_key *k1,
const union xfs_btree_key *k2);
/* check that r1 is lower than r2 */
int (*recs_inorder)(struct xfs_btree_cur *cur,
const union xfs_btree_rec *r1,
const union xfs_btree_rec *r2);
/*
* Are these two btree keys immediately adjacent?
*
* Given two btree keys @key1 and @key2, decide if it is impossible for
Annotation
- Detected declarations: `struct xfs_buf`, `struct xfs_inode`, `struct xfs_mount`, `struct xfs_trans`, `struct xfs_ifork`, `struct xfs_perag`, `struct xfs_btree_ops`, `struct xfs_btree_ops`, `struct xfs_btree_level`, `struct xfs_btree_cur`.
- 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.