]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: create rt extent rounding helpers for realtime extent blocks
authorDarrick J. Wong <djwong@kernel.org>
Mon, 12 Feb 2024 14:23:20 +0000 (15:23 +0100)
committerCarlos Maiolino <cem@kernel.org>
Thu, 15 Feb 2024 11:56:43 +0000 (12:56 +0100)
Source kernel commit: 5f57f7309d9ab9d24d50c5707472b1ed8af4eabc

Create a pair of functions to round rtblock numbers up or down to the
nearest rt extent.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_rtbitmap.h

index ff901bf3d1ee51f5e60910e15f683e998177d2aa..ecf5645dd67091e380cc0cd6b8f3efc0d0680f94 100644 (file)
@@ -84,6 +84,24 @@ xfs_rtb_to_rtxup(
        return rtbno;
 }
 
+/* Round this rtblock up to the nearest rt extent size. */
+static inline xfs_rtblock_t
+xfs_rtb_roundup_rtx(
+       struct xfs_mount        *mp,
+       xfs_rtblock_t           rtbno)
+{
+       return roundup_64(rtbno, mp->m_sb.sb_rextsize);
+}
+
+/* Round this rtblock down to the nearest rt extent size. */
+static inline xfs_rtblock_t
+xfs_rtb_rounddown_rtx(
+       struct xfs_mount        *mp,
+       xfs_rtblock_t           rtbno)
+{
+       return rounddown_64(rtbno, mp->m_sb.sb_rextsize);
+}
+
 /*
  * Functions for walking free space rtextents in the realtime bitmap.
  */