aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_rtbitmap.c
diff options
context:
space:
mode:
authorDarrick J. Wong <[email protected]>2024-11-04 04:19:17 +0000
committerDarrick J. Wong <[email protected]>2024-11-05 21:38:39 +0000
commit96768e91511bfced6e9e537f4891157d909b13ee (patch)
tree8fcd21b1cb234f4b56f33e108e0f70876956fd5b /fs/xfs/libxfs/xfs_rtbitmap.c
parentiomap: add a merge boundary flag (diff)
downloadkernel-96768e91511bfced6e9e537f4891157d909b13ee.tar.gz
kernel-96768e91511bfced6e9e537f4891157d909b13ee.zip
xfs: define the format of rt groups
Define the ondisk format of realtime group metadata, and a superblock for realtime volumes. rt supers are conditionally enabled by a predicate function so that they can be disabled if we ever implement zoned storage support for the realtime volume. For rt group enabled file systems there is a separate bitmap and summary file for each group and thus the number of bitmap and summary blocks needs to be calculated differently. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
Diffstat (limited to 'fs/xfs/libxfs/xfs_rtbitmap.c')
-rw-r--r--fs/xfs/libxfs/xfs_rtbitmap.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c
index 54079edfe10f..416bbcd92af2 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.c
+++ b/fs/xfs/libxfs/xfs_rtbitmap.c
@@ -1157,6 +1157,21 @@ xfs_rtbitmap_blockcount_len(
return howmany_64(rtextents, NBBY * mp->m_sb.sb_blocksize);
}
+/* How many rt extents does each rtbitmap file track? */
+static inline xfs_rtbxlen_t
+xfs_rtbitmap_bitcount(
+ struct xfs_mount *mp)
+{
+ if (!mp->m_sb.sb_rextents)
+ return 0;
+
+ /* rtgroup size can be nonzero even if rextents is zero */
+ if (xfs_has_rtgroups(mp))
+ return mp->m_sb.sb_rgextents;
+
+ return mp->m_sb.sb_rextents;
+}
+
/*
* Compute the number of rtbitmap blocks used for a given file system.
*/
@@ -1164,7 +1179,7 @@ xfs_filblks_t
xfs_rtbitmap_blockcount(
struct xfs_mount *mp)
{
- return xfs_rtbitmap_blockcount_len(mp, mp->m_sb.sb_rextents);
+ return xfs_rtbitmap_blockcount_len(mp, xfs_rtbitmap_bitcount(mp));
}
/*
@@ -1178,8 +1193,7 @@ xfs_rtsummary_blockcount(
{
unsigned long long rsumwords;
- *rsumlevels = xfs_compute_rextslog(mp->m_sb.sb_rextents) + 1;
-
+ *rsumlevels = xfs_compute_rextslog(xfs_rtbitmap_bitcount(mp)) + 1;
rsumwords = xfs_rtbitmap_blockcount(mp) * (*rsumlevels);
return XFS_B_TO_FSB(mp, rsumwords << XFS_WORDLOG);
}