From: Darrick J. Wong Date: Mon, 12 Feb 2024 14:23:20 +0000 (+0100) Subject: xfs: create rt extent rounding helpers for realtime extent blocks X-Git-Tag: v6.7.0~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5dc53fefdf8c2517ed472080a118dd05a826853;p=thirdparty%2Fxfsprogs-dev.git xfs: create rt extent rounding helpers for realtime extent blocks 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 Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_rtbitmap.h b/libxfs/xfs_rtbitmap.h index ff901bf3..ecf5645d 100644 --- a/libxfs/xfs_rtbitmap.h +++ b/libxfs/xfs_rtbitmap.h @@ -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. */