From e1841f0c82de509654f89f9c1bbf3080039085e0 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Wed, 3 Jul 2024 14:22:11 -0700 Subject: [PATCH] mkfs: add headers to realtime bitmap blocks When the rtgroups feature is enabled, format rtbitmap blocks with the appropriate block headers. libxfs takes care of the actual writing for us, so all we have to do is ensure that the bitmap is the correct size. Signed-off-by: Darrick J. Wong --- mkfs/xfs_mkfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 439b198a3..0a05f6590 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -926,6 +926,7 @@ struct sb_feat_args { bool nortalign; bool nrext64; bool exchrange; /* XFS_SB_FEAT_INCOMPAT_EXCHRANGE */ + bool rtgroups; /* XFS_SB_FEAT_INCOMPAT_RTGROUPS */ }; struct cli_params { @@ -3210,6 +3211,7 @@ validate_rtdev( struct cli_params *cli) { struct libxfs_init *xi = cli->xi; + unsigned int rbmblocksize = cfg->blocksize; if (!xi->rt.dev) { if (cli->rtsize) { @@ -3253,8 +3255,10 @@ reported by the device (%u).\n"), _("cannot have an rt subvolume with zero extents\n")); usage(); } + if (cfg->sb_feat.rtgroups) + rbmblocksize -= sizeof(struct xfs_rtbuf_blkinfo); cfg->rtbmblocks = (xfs_extlen_t)howmany(cfg->rtextents, - NBBY * cfg->blocksize); + NBBY * rbmblocksize); } static bool -- 2.50.1