fs/xfs/libxfs/xfs_rtrefcount_btree.h
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_rtrefcount_btree.h
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_rtrefcount_btree.h- Extension
.h- Size
- 5532 bytes
- Lines
- 190
- 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_btree_curstruct xfs_mountstruct xbtree_ifakerootstruct xfs_rtgroupfunction xfs_rtrefcount_rec_addrfunction xfs_rtrefcount_key_addrfunction xfs_rtrefcount_ptr_addrfunction xfs_rtrefcount_droot_rec_addrfunction xfs_rtrefcount_droot_key_addrfunction xfs_rtrefcount_droot_ptr_addrfunction xfs_rtrefcount_broot_ptr_addrfunction xfs_rtrefcount_broot_space_calcfunction xfs_rtrefcount_broot_spacefunction xfs_rtrefcount_droot_space_calcfunction xfs_rtrefcount_droot_space
Annotated Snippet
#ifndef __XFS_RTREFCOUNT_BTREE_H__
#define __XFS_RTREFCOUNT_BTREE_H__
struct xfs_buf;
struct xfs_btree_cur;
struct xfs_mount;
struct xbtree_ifakeroot;
struct xfs_rtgroup;
/* refcounts only exist on crc enabled filesystems */
#define XFS_RTREFCOUNT_BLOCK_LEN XFS_BTREE_LBLOCK_CRC_LEN
struct xfs_btree_cur *xfs_rtrefcountbt_init_cursor(struct xfs_trans *tp,
struct xfs_rtgroup *rtg);
struct xfs_btree_cur *xfs_rtrefcountbt_stage_cursor(struct xfs_mount *mp,
struct xfs_rtgroup *rtg, struct xfs_inode *ip,
struct xbtree_ifakeroot *ifake);
void xfs_rtrefcountbt_commit_staged_btree(struct xfs_btree_cur *cur,
struct xfs_trans *tp);
unsigned int xfs_rtrefcountbt_maxrecs(struct xfs_mount *mp,
unsigned int blocklen, bool leaf);
void xfs_rtrefcountbt_compute_maxlevels(struct xfs_mount *mp);
unsigned int xfs_rtrefcountbt_droot_maxrecs(unsigned int blocklen, bool leaf);
/*
* Addresses of records, keys, and pointers within an incore rtrefcountbt block.
*
* (note that some of these may appear unused, but they are used in userspace)
*/
static inline struct xfs_refcount_rec *
xfs_rtrefcount_rec_addr(
struct xfs_btree_block *block,
unsigned int index)
{
return (struct xfs_refcount_rec *)
((char *)block + XFS_RTREFCOUNT_BLOCK_LEN +
(index - 1) * sizeof(struct xfs_refcount_rec));
}
static inline struct xfs_refcount_key *
xfs_rtrefcount_key_addr(
struct xfs_btree_block *block,
unsigned int index)
{
return (struct xfs_refcount_key *)
((char *)block + XFS_RTREFCOUNT_BLOCK_LEN +
(index - 1) * sizeof(struct xfs_refcount_key));
}
static inline xfs_rtrefcount_ptr_t *
xfs_rtrefcount_ptr_addr(
struct xfs_btree_block *block,
unsigned int index,
unsigned int maxrecs)
{
return (xfs_rtrefcount_ptr_t *)
((char *)block + XFS_RTREFCOUNT_BLOCK_LEN +
maxrecs * sizeof(struct xfs_refcount_key) +
(index - 1) * sizeof(xfs_rtrefcount_ptr_t));
}
unsigned int xfs_rtrefcountbt_maxlevels_ondisk(void);
int __init xfs_rtrefcountbt_init_cur_cache(void);
void xfs_rtrefcountbt_destroy_cur_cache(void);
xfs_filblks_t xfs_rtrefcountbt_calc_reserves(struct xfs_mount *mp);
unsigned long long xfs_rtrefcountbt_calc_size(struct xfs_mount *mp,
unsigned long long len);
/* Addresses of key, pointers, and records within an ondisk rtrefcount block. */
static inline struct xfs_refcount_rec *
xfs_rtrefcount_droot_rec_addr(
struct xfs_rtrefcount_root *block,
unsigned int index)
{
return (struct xfs_refcount_rec *)
((char *)(block + 1) +
(index - 1) * sizeof(struct xfs_refcount_rec));
}
static inline struct xfs_refcount_key *
xfs_rtrefcount_droot_key_addr(
struct xfs_rtrefcount_root *block,
unsigned int index)
{
return (struct xfs_refcount_key *)
((char *)(block + 1) +
(index - 1) * sizeof(struct xfs_refcount_key));
}
Annotation
- Detected declarations: `struct xfs_buf`, `struct xfs_btree_cur`, `struct xfs_mount`, `struct xbtree_ifakeroot`, `struct xfs_rtgroup`, `function xfs_rtrefcount_rec_addr`, `function xfs_rtrefcount_key_addr`, `function xfs_rtrefcount_ptr_addr`, `function xfs_rtrefcount_droot_rec_addr`, `function xfs_rtrefcount_droot_key_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.