]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_rtbitmap.h
xfs: convert the rtbitmap block and bit macros to static inline functions
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_rtbitmap.h
index 3686a53e0aed8bdad6412d7593411321de53bf1d..5c4325702cb104c10bcfdc18ae9dc83dd12e85c8 100644 (file)
@@ -131,6 +131,33 @@ xfs_rtb_rounddown_rtx(
        return rounddown_64(rtbno, mp->m_sb.sb_rextsize);
 }
 
+/* Convert an rt extent number to a file block offset in the rt bitmap file. */
+static inline xfs_fileoff_t
+xfs_rtx_to_rbmblock(
+       struct xfs_mount        *mp,
+       xfs_rtxnum_t            rtx)
+{
+       return rtx >> mp->m_blkbit_log;
+}
+
+/* Convert an rt extent number to a word offset within an rt bitmap block. */
+static inline unsigned int
+xfs_rtx_to_rbmword(
+       struct xfs_mount        *mp,
+       xfs_rtxnum_t            rtx)
+{
+       return (rtx >> XFS_NBWORDLOG) & XFS_BLOCKWMASK(mp);
+}
+
+/* Convert a file block offset in the rt bitmap file to an rt extent number. */
+static inline xfs_rtxnum_t
+xfs_rbmblock_to_rtx(
+       struct xfs_mount        *mp,
+       xfs_fileoff_t           rbmoff)
+{
+       return rbmoff << mp->m_blkbit_log;
+}
+
 /*
  * Functions for walking free space rtextents in the realtime bitmap.
  */