aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-02-12 15:18:20 +0100
committerCarlos Maiolino <cem@kernel.org>2024-02-15 12:56:43 +0100
commit48afbdc52a2faabeaa004ad5819b167ae1ad8b54 (patch)
tree9c277bf994099b7bce84191bd0d43754faa86e0f
parent817e92371abc3922371b4e9ac56a959b3dc56f90 (diff)
downloadxfsprogs-dev-48afbdc52a2faabeaa004ad5819b167ae1ad8b54.tar.gz
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 <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r--libxfs/xfs_rtbitmap.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libxfs/xfs_rtbitmap.h b/libxfs/xfs_rtbitmap.h
index 5e2afb7fea..099ea8902a 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.
*/