xfs
[Top] [All Lists]

[PATCH 05/29] xfs: introduce realtime rmap btree definitions

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 05/29] xfs: introduce realtime rmap btree definitions
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 16:59:07 -0700
Cc: linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <147216950911.7022.438115723996286926.stgit@xxxxxxxxxxxxxxxx>
References: <147216950911.7022.438115723996286926.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
Add new realtime rmap btree definitions. The realtime rmap btree will
be rooted from a hidden inode, but has its own shape and therefore
needs to have most of its own separate types.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 libxfs/xfs_btree.c  |    4 ++--
 libxfs/xfs_btree.h  |    3 +++
 libxfs/xfs_format.h |    7 +++++++
 libxfs/xfs_types.h  |    3 ++-
 4 files changed, 14 insertions(+), 3 deletions(-)


diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index 26b8e62..53f6192 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -41,10 +41,10 @@ kmem_zone_t *xfs_btree_cur_zone;
  */
 static const __uint32_t xfs_magics[2][XFS_BTNUM_MAX] = {
        { XFS_ABTB_MAGIC, XFS_ABTC_MAGIC, 0, XFS_BMAP_MAGIC, XFS_IBT_MAGIC,
-         XFS_FIBT_MAGIC, 0 },
+         XFS_FIBT_MAGIC, 0, 0 },
        { XFS_ABTB_CRC_MAGIC, XFS_ABTC_CRC_MAGIC, XFS_RMAP_CRC_MAGIC,
          XFS_BMAP_CRC_MAGIC, XFS_IBT_CRC_MAGIC, XFS_FIBT_CRC_MAGIC,
-         XFS_REFC_CRC_MAGIC }
+         XFS_REFC_CRC_MAGIC, XFS_RTRMAP_CRC_MAGIC }
 };
 #define xfs_btree_magic(cur) \
        xfs_magics[!!((cur)->bc_flags & XFS_BTREE_CRC_BLOCKS)][cur->bc_btnum]
diff --git a/libxfs/xfs_btree.h b/libxfs/xfs_btree.h
index 8918b81..8913ffa 100644
--- a/libxfs/xfs_btree.h
+++ b/libxfs/xfs_btree.h
@@ -75,6 +75,7 @@ union xfs_btree_rec {
 #define        XFS_BTNUM_FINO  ((xfs_btnum_t)XFS_BTNUM_FINOi)
 #define        XFS_BTNUM_RMAP  ((xfs_btnum_t)XFS_BTNUM_RMAPi)
 #define        XFS_BTNUM_REFC  ((xfs_btnum_t)XFS_BTNUM_REFCi)
+#define        XFS_BTNUM_RTRMAP        ((xfs_btnum_t)XFS_BTNUM_RTRMAPi)
 
 /*
  * For logging record fields.
@@ -107,6 +108,7 @@ do {    \
        case XFS_BTNUM_BMAP: __XFS_BTREE_STATS_INC(__mp, bmbt, stat); break; \
        case XFS_BTNUM_INO: __XFS_BTREE_STATS_INC(__mp, ibt, stat); break; \
        case XFS_BTNUM_FINO: __XFS_BTREE_STATS_INC(__mp, fibt, stat); break; \
+       case XFS_BTNUM_RTRMAP: /* pass-through */ \
        case XFS_BTNUM_RMAP: __XFS_BTREE_STATS_INC(__mp, rmap, stat); break; \
        case XFS_BTNUM_REFC: __XFS_BTREE_STATS_INC(__mp, refcbt, stat); break; \
        case XFS_BTNUM_MAX: ASSERT(0); __mp = __mp /* fucking gcc */ ; break; \
@@ -129,6 +131,7 @@ do {    \
                __XFS_BTREE_STATS_ADD(__mp, ibt, stat, val); break; \
        case XFS_BTNUM_FINO:    \
                __XFS_BTREE_STATS_ADD(__mp, fibt, stat, val); break; \
+       case XFS_BTNUM_RTRMAP: /* pass-through */       \
        case XFS_BTNUM_RMAP:    \
                __XFS_BTREE_STATS_ADD(__mp, rmap, stat, val); break; \
        case XFS_BTNUM_REFC:    \
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index c336f7a..ae2d958 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -1463,6 +1463,13 @@ typedef __be32 xfs_rmap_ptr_t;
         XFS_IBT_BLOCK(mp) + 1)
 
 /*
+ * Realtime Reverse mapping btree format definitions
+ *
+ * There is a btree for the reverse map per allocation group
+ */
+#define        XFS_RTRMAP_CRC_MAGIC    0x4d415052      /* 'MAPR' */
+
+/*
  * Reference Count Btree format definitions
  *
  */
diff --git a/libxfs/xfs_types.h b/libxfs/xfs_types.h
index cf044c0..749aa83 100644
--- a/libxfs/xfs_types.h
+++ b/libxfs/xfs_types.h
@@ -113,7 +113,8 @@ typedef enum {
 
 typedef enum {
        XFS_BTNUM_BNOi, XFS_BTNUM_CNTi, XFS_BTNUM_RMAPi, XFS_BTNUM_BMAPi,
-       XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_MAX
+       XFS_BTNUM_INOi, XFS_BTNUM_FINOi, XFS_BTNUM_REFCi, XFS_BTNUM_RTRMAPi,
+       XFS_BTNUM_MAX
 } xfs_btnum_t;
 
 struct xfs_name {

<Prev in Thread] Current Thread [Next in Thread>