diff options
author | Darrick J. Wong <djwong@kernel.org> | 2024-11-03 20:19:32 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2024-11-05 13:38:43 -0800 |
commit | fd7588fa6475771fe95f44011aea268c5d841da2 (patch) | |
tree | e02f8aff04afbcaf0c27903354b87a3b8887147e /fs/xfs/libxfs/xfs_rtbitmap.h | |
parent | ea99122b18ca6cf902417e1acbc19a197f662299 (diff) | |
download | linux-fd7588fa6475771fe95f44011aea268c5d841da2.tar.gz linux-fd7588fa6475771fe95f44011aea268c5d841da2.tar.bz2 linux-fd7588fa6475771fe95f44011aea268c5d841da2.zip |
xfs: create helpers to deal with rounding xfs_fileoff_t to rtx boundaries
We're about to segment xfs_rtblock_t addresses, so we must create
type-specific helpers to do rt extent rounding of file block offsets
because the rtb helpers soon will not do the right thing there.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_rtbitmap.h')
-rw-r--r-- | fs/xfs/libxfs/xfs_rtbitmap.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h index 7be76490a318..dc2b8beadfc3 100644 --- a/fs/xfs/libxfs/xfs_rtbitmap.h +++ b/fs/xfs/libxfs/xfs_rtbitmap.h @@ -135,13 +135,22 @@ xfs_rtb_roundup_rtx( return roundup_64(rtbno, mp->m_sb.sb_rextsize); } -/* Round this rtblock down to the nearest rt extent size. */ +/* Round this file block offset up to the nearest rt extent size. */ static inline xfs_rtblock_t -xfs_rtb_rounddown_rtx( +xfs_fileoff_roundup_rtx( struct xfs_mount *mp, - xfs_rtblock_t rtbno) + xfs_fileoff_t off) +{ + return roundup_64(off, mp->m_sb.sb_rextsize); +} + +/* Round this file block offset down to the nearest rt extent size. */ +static inline xfs_rtblock_t +xfs_fileoff_rounddown_rtx( + struct xfs_mount *mp, + xfs_fileoff_t off) { - return rounddown_64(rtbno, mp->m_sb.sb_rextsize); + return rounddown_64(off, mp->m_sb.sb_rextsize); } /* Convert an rt extent number to a file block offset in the rt bitmap file. */ |