diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-10-16 09:48:20 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-10-18 10:58:58 -0700 |
commit | d0448fe76ac1a9ccbce574577a4c82246d17eec4 (patch) | |
tree | acec3f73d1e01b5589bb8daac4bcca6ef2fa301e /fs/xfs/libxfs/xfs_trans_resv.c | |
parent | 097b4b7b64ef67a4703b89fd4064480b61557fd5 (diff) |
xfs: create helpers for rtbitmap block/wordcount computationsrefactor-rtbitmap-macros-6.7_2023-10-19
Create helper functions that compute the number of blocks or words
necessary to store the rt bitmap.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_trans_resv.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_trans_resv.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c index 4629f10d2f67..6cd45e8c118d 100644 --- a/fs/xfs/libxfs/xfs_trans_resv.c +++ b/fs/xfs/libxfs/xfs_trans_resv.c @@ -218,11 +218,12 @@ xfs_rtalloc_block_count( struct xfs_mount *mp, unsigned int num_ops) { - unsigned int blksz = XFS_FSB_TO_B(mp, 1); - unsigned int rtbmp_bytes; + unsigned int rtbmp_blocks; + xfs_rtxlen_t rtxlen; - rtbmp_bytes = xfs_extlen_to_rtxlen(mp, XFS_MAX_BMBT_EXTLEN) / NBBY; - return (howmany(rtbmp_bytes, blksz) + 1) * num_ops; + rtxlen = xfs_extlen_to_rtxlen(mp, XFS_MAX_BMBT_EXTLEN); + rtbmp_blocks = xfs_rtbitmap_blockcount(mp, rtxlen); + return (rtbmp_blocks + 1) * num_ops; } /* |