diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-02-12 15:23:20 +0100 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2024-02-15 12:56:43 +0100 |
commit | a5dc53fefdf8c2517ed472080a118dd05a826853 (patch) | |
tree | ae98c0a01153e68184870136dc4d9ecdee7980b1 | |
parent | b261e7937f6aacf3f7a5099cd98046b2af8c5519 (diff) | |
download | xfsprogs-dev-a5dc53fefdf8c2517ed472080a118dd05a826853.tar.gz |
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 <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | libxfs/xfs_rtbitmap.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libxfs/xfs_rtbitmap.h b/libxfs/xfs_rtbitmap.h index ff901bf3d1..ecf5645dd6 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. */ |