From: Darrick J. Wong Date: Mon, 12 Feb 2024 14:18:20 +0000 (+0100) Subject: xfs: create a helper to convert rtextents to rtblocks X-Git-Tag: v6.7.0~57 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=48afbdc52a2faabeaa004ad5819b167ae1ad8b54;p=xfsprogs-dev.git xfs: create a helper to convert rtextents to rtblocks Source kernel commit: fa5a387230861116c2434c20d29fc4b3fd077d24 Create a helper to convert a realtime extent to a realtime block. Later on we'll change the helper to use bit shifts when possible. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_rtbitmap.h b/libxfs/xfs_rtbitmap.h index 5e2afb7fe..099ea8902 100644 --- a/libxfs/xfs_rtbitmap.h +++ b/libxfs/xfs_rtbitmap.h @@ -6,6 +6,22 @@ #ifndef __XFS_RTBITMAP_H__ #define __XFS_RTBITMAP_H__ +static inline xfs_rtblock_t +xfs_rtx_to_rtb( + struct xfs_mount *mp, + xfs_rtxnum_t rtx) +{ + return rtx * mp->m_sb.sb_rextsize; +} + +static inline xfs_extlen_t +xfs_rtxlen_to_extlen( + struct xfs_mount *mp, + xfs_rtxlen_t rtxlen) +{ + return rtxlen * mp->m_sb.sb_rextsize; +} + /* * Functions for walking free space rtextents in the realtime bitmap. */