fs/xfs/libxfs/xfs_bmap_btree.h
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_bmap_btree.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_bmap_btree.h- Extension
.h- Size
- 5408 bytes
- Lines
- 205
- 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_btree_curstruct xfs_btree_blockstruct xfs_mountstruct xfs_inodestruct xfs_transstruct xbtree_ifakerootfunction xfs_bmbt_block_lenfunction xfs_bmbt_rec_addrfunction xfs_bmbt_key_addrfunction xfs_bmbt_ptr_addrfunction xfs_bmdr_rec_addrfunction xfs_bmdr_key_addrfunction xfs_bmdr_ptr_addrfunction xfs_bmap_broot_ptr_addrfunction xfs_bmap_broot_space_calcfunction xfs_bmap_broot_spacefunction xfs_bmdr_space_calcfunction xfs_bmap_bmdr_space
Annotated Snippet
#ifndef __XFS_BMAP_BTREE_H__
#define __XFS_BMAP_BTREE_H__
struct xfs_btree_cur;
struct xfs_btree_block;
struct xfs_mount;
struct xfs_inode;
struct xfs_trans;
struct xbtree_ifakeroot;
/*
* Maximum number of bmap btree levels.
*/
#define XFS_BM_MAXLEVELS(mp,w) ((mp)->m_bm_maxlevels[(w)])
/*
* Prototypes for xfs_bmap.c to call.
*/
extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int,
struct xfs_btree_block *, int);
void xfs_bmbt_disk_set_all(struct xfs_bmbt_rec *r, struct xfs_bmbt_irec *s);
extern xfs_filblks_t xfs_bmbt_disk_get_blockcount(const struct xfs_bmbt_rec *r);
extern xfs_fileoff_t xfs_bmbt_disk_get_startoff(const struct xfs_bmbt_rec *r);
void xfs_bmbt_disk_get_all(const struct xfs_bmbt_rec *r,
struct xfs_bmbt_irec *s);
extern void xfs_bmbt_to_bmdr(struct xfs_mount *, struct xfs_btree_block *, int,
xfs_bmdr_block_t *, int);
extern int xfs_bmbt_get_maxrecs(struct xfs_btree_cur *, int level);
extern int xfs_bmdr_maxrecs(int blocklen, int leaf);
unsigned int xfs_bmbt_maxrecs(struct xfs_mount *mp, unsigned int blocklen,
bool leaf);
extern int xfs_bmbt_change_owner(struct xfs_trans *tp, struct xfs_inode *ip,
int whichfork, xfs_ino_t new_owner,
struct list_head *buffer_list);
extern struct xfs_btree_cur *xfs_bmbt_init_cursor(struct xfs_mount *,
struct xfs_trans *, struct xfs_inode *, int);
void xfs_bmbt_commit_staged_btree(struct xfs_btree_cur *cur,
struct xfs_trans *tp, int whichfork);
extern unsigned long long xfs_bmbt_calc_size(struct xfs_mount *mp,
unsigned long long len);
unsigned int xfs_bmbt_maxlevels_ondisk(void);
int __init xfs_bmbt_init_cur_cache(void);
void xfs_bmbt_destroy_cur_cache(void);
void xfs_bmbt_init_block(struct xfs_inode *ip, struct xfs_btree_block *buf,
struct xfs_buf *bp, __u16 level, __u16 numrecs);
/*
* Btree block header size depends on a superblock flag.
*/
static inline size_t
xfs_bmbt_block_len(struct xfs_mount *mp)
{
return xfs_has_crc(mp) ?
XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN;
}
/* Addresses of key, pointers, and records within an incore bmbt block. */
static inline struct xfs_bmbt_rec *
xfs_bmbt_rec_addr(
struct xfs_mount *mp,
struct xfs_btree_block *block,
unsigned int index)
{
return (struct xfs_bmbt_rec *)
((char *)block + xfs_bmbt_block_len(mp) +
(index - 1) * sizeof(struct xfs_bmbt_rec));
}
static inline struct xfs_bmbt_key *
xfs_bmbt_key_addr(
struct xfs_mount *mp,
struct xfs_btree_block *block,
unsigned int index)
{
return (struct xfs_bmbt_key *)
((char *)block + xfs_bmbt_block_len(mp) +
(index - 1) * sizeof(struct xfs_bmbt_key));
}
static inline xfs_bmbt_ptr_t *
Annotation
- Detected declarations: `struct xfs_btree_cur`, `struct xfs_btree_block`, `struct xfs_mount`, `struct xfs_inode`, `struct xfs_trans`, `struct xbtree_ifakeroot`, `function xfs_bmbt_block_len`, `function xfs_bmbt_rec_addr`, `function xfs_bmbt_key_addr`, `function xfs_bmbt_ptr_addr`.
- 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.