summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_rtbitmap.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2023-10-16 09:32:54 -0700
committerDarrick J. Wong <djwong@kernel.org>2023-10-17 16:24:22 -0700
commitfa5a387230861116c2434c20d29fc4b3fd077d24 (patch)
tree817d3e24e0812618840504fefd268444ffbc453d /fs/xfs/libxfs/xfs_rtbitmap.h
parent2d5f216b77e33f9b503bd42998271da35d4b7055 (diff)
downloadlinux-stable-fa5a387230861116c2434c20d29fc4b3fd077d24.tar.gz
linux-stable-fa5a387230861116c2434c20d29fc4b3fd077d24.tar.bz2
linux-stable-fa5a387230861116c2434c20d29fc4b3fd077d24.zip
xfs: create a helper to convert rtextents to rtblocks
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 <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.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_rtbitmap.h b/fs/xfs/libxfs/xfs_rtbitmap.h
index 5e2afb7fea0e..099ea8902aaa 100644
--- a/fs/xfs/libxfs/xfs_rtbitmap.h
+++ b/fs/xfs/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.
*/