fs/xfs/libxfs/xfs_rtgroup.c
Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_rtgroup.c
File Facts
- System
- Linux kernel
- Corpus path
fs/xfs/libxfs/xfs_rtgroup.c- Extension
.c- Size
- 17870 bytes
- Lines
- 752
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xfs_platform.hxfs_fs.hxfs_shared.hxfs_format.hxfs_trans_resv.hxfs_bit.hxfs_sb.hxfs_mount.hxfs_btree.hxfs_alloc_btree.hxfs_rmap_btree.hxfs_alloc.hxfs_ialloc.hxfs_rmap.hxfs_ag.hxfs_ag_resv.hxfs_health.hxfs_error.hxfs_bmap.hxfs_defer.hxfs_log_format.hxfs_trans.hxfs_trace.hxfs_inode.hxfs_icache.hxfs_buf_item.hxfs_rtgroup.hxfs_rtbitmap.hxfs_metafile.hxfs_metadir.hxfs_rtrmap_btree.hxfs_rtrefcount_btree.h
Detected Declarations
struct xfs_rtginode_opsfunction Copyrightfunction __xfs_rtgroup_extentsfunction xfs_rtgroup_extentsfunction xfs_rtgroup_calc_geometryfunction xfs_rtgroup_allocfunction xfs_rtgroup_freefunction xfs_free_rtgroupsfunction xfs_initialize_rtgroupsfunction recoveryfunction xfs_rtgroup_lockfunction xfs_rtgroup_unlockfunction xfs_rtgroup_trans_joinfunction xfs_rtgroup_get_geometryfunction xfs_rtginode_ilock_cmp_fnfunction xfs_rtginode_ilock_print_fnfunction xfs_rtginode_lockdep_setupfunction xfs_rtginode_namefunction xfs_rtginode_metafile_typefunction xfs_rtginode_enabledfunction xfs_rtginode_mark_sickfunction xfs_rtginode_loadfunction xfs_rtginode_irelefunction xfs_rtginode_createfunction xfs_rtginode_mkdir_parentfunction xfs_rtginode_load_parentfunction xfs_rtsb_verify_commonfunction xfs_rtsb_verify_allfunction xfs_rtsb_read_verifyfunction xfs_rtsb_write_verifyfunction xfs_update_rtsbfunction xfs_log_rtsb
Annotated Snippet
struct xfs_rtginode_ops {
const char *name; /* short name */
enum xfs_metafile_type metafile_type;
unsigned int sick; /* rtgroup sickness flag */
unsigned int fmt_mask; /* all valid data fork formats */
/* Does the fs have this feature? */
bool (*enabled)(const struct xfs_mount *mp);
/* Create this rtgroup metadata inode and initialize it. */
int (*create)(struct xfs_rtgroup *rtg,
struct xfs_inode *ip,
struct xfs_trans *tp,
bool init);
};
static const struct xfs_rtginode_ops xfs_rtginode_ops[XFS_RTGI_MAX] = {
[XFS_RTGI_BITMAP] = {
.name = "bitmap",
.metafile_type = XFS_METAFILE_RTBITMAP,
.sick = XFS_SICK_RG_BITMAP,
.fmt_mask = (1U << XFS_DINODE_FMT_EXTENTS) |
(1U << XFS_DINODE_FMT_BTREE),
.enabled = xfs_has_nonzoned,
.create = xfs_rtbitmap_create,
},
[XFS_RTGI_SUMMARY] = {
.name = "summary",
.metafile_type = XFS_METAFILE_RTSUMMARY,
.sick = XFS_SICK_RG_SUMMARY,
.fmt_mask = (1U << XFS_DINODE_FMT_EXTENTS) |
(1U << XFS_DINODE_FMT_BTREE),
.enabled = xfs_has_nonzoned,
.create = xfs_rtsummary_create,
},
[XFS_RTGI_RMAP] = {
.name = "rmap",
.metafile_type = XFS_METAFILE_RTRMAP,
.sick = XFS_SICK_RG_RMAPBT,
.fmt_mask = 1U << XFS_DINODE_FMT_META_BTREE,
/*
* growfs must create the rtrmap inodes before adding a
* realtime volume to the filesystem, so we cannot use the
* rtrmapbt predicate here.
*/
.enabled = xfs_has_rmapbt,
.create = xfs_rtrmapbt_create,
},
[XFS_RTGI_REFCOUNT] = {
.name = "refcount",
.metafile_type = XFS_METAFILE_RTREFCOUNT,
.sick = XFS_SICK_RG_REFCNTBT,
.fmt_mask = 1U << XFS_DINODE_FMT_META_BTREE,
/* same comment about growfs and rmap inodes applies here */
.enabled = xfs_has_reflink,
.create = xfs_rtrefcountbt_create,
},
};
/* Return the shortname of this rtgroup inode. */
const char *
xfs_rtginode_name(
enum xfs_rtg_inodes type)
{
return xfs_rtginode_ops[type].name;
}
/* Return the metafile type of this rtgroup inode. */
enum xfs_metafile_type
xfs_rtginode_metafile_type(
enum xfs_rtg_inodes type)
{
return xfs_rtginode_ops[type].metafile_type;
}
/* Should this rtgroup inode be present? */
bool
xfs_rtginode_enabled(
struct xfs_rtgroup *rtg,
enum xfs_rtg_inodes type)
{
const struct xfs_rtginode_ops *ops = &xfs_rtginode_ops[type];
if (!ops->enabled)
return true;
return ops->enabled(rtg_mount(rtg));
}
Annotation
- Immediate include surface: `xfs_platform.h`, `xfs_fs.h`, `xfs_shared.h`, `xfs_format.h`, `xfs_trans_resv.h`, `xfs_bit.h`, `xfs_sb.h`, `xfs_mount.h`.
- Detected declarations: `struct xfs_rtginode_ops`, `function Copyright`, `function __xfs_rtgroup_extents`, `function xfs_rtgroup_extents`, `function xfs_rtgroup_calc_geometry`, `function xfs_rtgroup_alloc`, `function xfs_rtgroup_free`, `function xfs_free_rtgroups`, `function xfs_initialize_rtgroups`, `function recovery`.
- 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.