]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: refactor xfs_rtbitmap_blockcount
authorChristoph Hellwig <hch@lst.de>
Mon, 5 Aug 2024 17:30:43 +0000 (10:30 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Aug 2024 12:53:49 +0000 (05:53 -0700)
Source kernel commit: 35a1dfb9f4fb84ef65ec43c5e0b184f9bc832953

Rename the existing xfs_rtbitmap_blockcount to
xfs_rtbitmap_blockcount_len and add a new xfs_rtbitmap_blockcount wrapper
around it that takes the number of extents from the mount structure.

This will simplify the move to per-rtgroup bitmaps as those will need to
pass in the number of extents per rtgroup instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_rtbitmap.c
libxfs/xfs_rtbitmap.h
libxfs/xfs_trans_resv.c

index 63913ad0f8d02dbc51a01b173390c94cd9c66abb..a1bb99a2858eff50ed045f86efc05f890cf9f15c 100644 (file)
@@ -1147,13 +1147,23 @@ xfs_rtalloc_extent_is_free(
  * extents.
  */
 xfs_filblks_t
-xfs_rtbitmap_blockcount(
+xfs_rtbitmap_blockcount_len(
        struct xfs_mount        *mp,
        xfs_rtbxlen_t           rtextents)
 {
        return howmany_64(rtextents, NBBY * mp->m_sb.sb_blocksize);
 }
 
+/*
+ * Compute the number of rtbitmap blocks used for a given file system.
+ */
+xfs_filblks_t
+xfs_rtbitmap_blockcount(
+       struct xfs_mount        *mp)
+{
+       return xfs_rtbitmap_blockcount_len(mp, mp->m_sb.sb_rextents);
+}
+
 /* Compute the number of rtsummary blocks needed to track the given rt space. */
 xfs_filblks_t
 xfs_rtsummary_blockcount(
index e4994a3e461d33810fab4376165684f2cbf9c1f1..58672863053a94e2b1d586ad4b425e6b23a7029a 100644 (file)
@@ -307,8 +307,9 @@ int xfs_rtfree_extent(struct xfs_trans *tp, struct xfs_rtgroup *rtg,
 int xfs_rtfree_blocks(struct xfs_trans *tp, struct xfs_rtgroup *rtg,
                xfs_fsblock_t rtbno, xfs_filblks_t rtlen);
 
-xfs_filblks_t xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t
-               rtextents);
+xfs_filblks_t xfs_rtbitmap_blockcount(struct xfs_mount *mp);
+xfs_filblks_t xfs_rtbitmap_blockcount_len(struct xfs_mount *mp,
+               xfs_rtbxlen_t rtextents);
 xfs_filblks_t xfs_rtsummary_blockcount(struct xfs_mount *mp,
                unsigned int rsumlevels, xfs_extlen_t rbmblocks);
 
@@ -336,7 +337,7 @@ static inline int xfs_rtfree_blocks(struct xfs_trans *tp,
 # define xfs_rtbuf_cache_relse(a)                      (0)
 # define xfs_rtalloc_extent_is_free(m,t,s,l,i)         (-ENOSYS)
 static inline xfs_filblks_t
-xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t rtextents)
+xfs_rtbitmap_blockcount_len(struct xfs_mount *mp, xfs_rtbxlen_t rtextents)
 {
        /* shut up gcc */
        return 0;
index a7fb2f97e3bf2c434c8a857a53af61fa8d9173b9..c8a1f3fa537f856d0fe203940ff50579af9e0d63 100644 (file)
@@ -221,7 +221,7 @@ xfs_rtalloc_block_count(
        xfs_rtxlen_t            rtxlen;
 
        rtxlen = xfs_extlen_to_rtxlen(mp, XFS_MAX_BMBT_EXTLEN);
-       rtbmp_blocks = xfs_rtbitmap_blockcount(mp, rtxlen);
+       rtbmp_blocks = xfs_rtbitmap_blockcount_len(mp, rtxlen);
        return (rtbmp_blocks + 1) * num_ops;
 }