fs/xfs/libxfs/xfs_rtgroup.h

Source file repositories/reference/linux-study-clean/fs/xfs/libxfs/xfs_rtgroup.h

File Facts

System
Linux kernel
Corpus path
fs/xfs/libxfs/xfs_rtgroup.h
Extension
.h
Size
10017 bytes
Lines
390
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct xfs_rtgroup {
	struct xfs_group	rtg_group;

	/* per-rtgroup metadata inodes */
	struct xfs_inode	*rtg_inodes[XFS_RTGI_MAX];

	/* Number of blocks in this group */
	xfs_rtxnum_t		rtg_extents;

	/*
	 * For bitmap based RT devices this points to a cache of rt summary
	 * level per bitmap block with the invariant that rtg_rsum_cache[bbno]
	 * > the maximum i for which rsum[i][bbno] != 0, or 0 if
	 * rsum[i][bbno] == 0 for all i.
	 * Reads and writes are serialized by the rsumip inode lock.
	 *
	 * For zoned RT devices this points to the open zone structure for
	 * a group that is open for writers, or is NULL.
	 */
	union {
		uint8_t			*rtg_rsum_cache;
		struct xfs_open_zone	*rtg_open_zone;
	};

	/*
	 * Count of outstanding GC operations for zoned XFS.  Any RTG with a
	 * non-zero rtg_gccount will not be picked as new GC victim.
	 */
	atomic_t		rtg_gccount;
};

/*
 * For zoned RT devices this is set on groups that have no written blocks
 * and can be picked by the allocator for opening.
 */
#define XFS_RTG_FREE			XA_MARK_0

static inline struct xfs_rtgroup *to_rtg(struct xfs_group *xg)
{
	return container_of(xg, struct xfs_rtgroup, rtg_group);
}

static inline struct xfs_group *rtg_group(struct xfs_rtgroup *rtg)
{
	return &rtg->rtg_group;
}

static inline struct xfs_mount *rtg_mount(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_group.xg_mount;
}

static inline xfs_rgnumber_t rtg_rgno(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_group.xg_gno;
}

static inline xfs_rgblock_t rtg_blocks(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_group.xg_block_count;
}

static inline struct xfs_inode *rtg_bitmap(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_inodes[XFS_RTGI_BITMAP];
}

static inline struct xfs_inode *rtg_summary(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_inodes[XFS_RTGI_SUMMARY];
}

static inline struct xfs_inode *rtg_rmap(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_inodes[XFS_RTGI_RMAP];
}

static inline struct xfs_inode *rtg_refcount(const struct xfs_rtgroup *rtg)
{
	return rtg->rtg_inodes[XFS_RTGI_REFCOUNT];
}

/* Passive rtgroup references */
static inline struct xfs_rtgroup *
xfs_rtgroup_get(
	struct xfs_mount	*mp,
	xfs_rgnumber_t		rgno)
{
	return to_rtg(xfs_group_get(mp, rgno, XG_TYPE_RTG));
}

Annotation

Implementation Notes