xfs
[Top] [All Lists]

[PATCH 11/24] xfs: support scrubbing rmap btree

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 11/24] xfs: support scrubbing rmap btree
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 16:56:28 -0700
Cc: linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <147216931783.6398.1716678878794493264.stgit@xxxxxxxxxxxxxxxx>
References: <147216931783.6398.1716678878794493264.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
Plumb in the pieces necessary to check the rmap btree.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 libxfs/xfs_fs.h         |    3 ++-
 libxfs/xfs_rmap.c       |    3 ++-
 libxfs/xfs_rmap.h       |    3 +++
 libxfs/xfs_rmap_btree.c |    4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)


diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h
index 03fdfb5..bfc3940 100644
--- a/libxfs/xfs_fs.h
+++ b/libxfs/xfs_fs.h
@@ -567,7 +567,8 @@ struct xfs_scrub_metadata {
 #define XFS_SCRUB_TYPE_CNTBT   5       /* freesp by length btree */
 #define XFS_SCRUB_TYPE_INOBT   6       /* inode btree */
 #define XFS_SCRUB_TYPE_FINOBT  7       /* free inode btree */
-#define XFS_SCRUB_TYPE_MAX     7
+#define XFS_SCRUB_TYPE_RMAPBT  8       /* reverse mapping btree */
+#define XFS_SCRUB_TYPE_MAX     8
 
 #define XFS_SCRUB_FLAGS_ALL    0x0     /* no flags yet */
 
diff --git a/libxfs/xfs_rmap.c b/libxfs/xfs_rmap.c
index 7a75e26..4ce2025 100644
--- a/libxfs/xfs_rmap.c
+++ b/libxfs/xfs_rmap.c
@@ -177,7 +177,8 @@ done:
        return error;
 }
 
-static int
+/* Convert an internal btree record to an rmap record. */
+int
 xfs_rmap_btrec_to_irec(
        union xfs_btree_rec     *rec,
        struct xfs_rmap_irec    *irec)
diff --git a/libxfs/xfs_rmap.h b/libxfs/xfs_rmap.h
index 7899305..188db38 100644
--- a/libxfs/xfs_rmap.h
+++ b/libxfs/xfs_rmap.h
@@ -212,5 +212,8 @@ int xfs_rmap_find_left_neighbor(struct xfs_btree_cur *cur, 
xfs_agblock_t bno,
 int xfs_rmap_lookup_le_range(struct xfs_btree_cur *cur, xfs_agblock_t bno,
                uint64_t owner, uint64_t offset, unsigned int flags,
                struct xfs_rmap_irec *irec, int *stat);
+union xfs_btree_rec;
+int xfs_rmap_btrec_to_irec(union xfs_btree_rec *rec,
+               struct xfs_rmap_irec *irec);
 
 #endif /* __XFS_RMAP_H__ */
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index 02ceace..42a6bad 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -375,7 +375,6 @@ const struct xfs_buf_ops xfs_rmapbt_buf_ops = {
        .verify_write           = xfs_rmapbt_write_verify,
 };
 
-#if defined(DEBUG) || defined(XFS_WARN)
 STATIC int
 xfs_rmapbt_keys_inorder(
        struct xfs_btree_cur    *cur,
@@ -435,7 +434,6 @@ xfs_rmapbt_recs_inorder(
                return 1;
        return 0;
 }
-#endif /* DEBUG */
 
 static const struct xfs_btree_ops xfs_rmapbt_ops = {
        .rec_len                = sizeof(struct xfs_rmap_rec),
@@ -454,10 +452,8 @@ static const struct xfs_btree_ops xfs_rmapbt_ops = {
        .key_diff               = xfs_rmapbt_key_diff,
        .buf_ops                = &xfs_rmapbt_buf_ops,
        .diff_two_keys          = xfs_rmapbt_diff_two_keys,
-#if defined(DEBUG) || defined(XFS_WARN)
        .keys_inorder           = xfs_rmapbt_keys_inorder,
        .recs_inorder           = xfs_rmapbt_recs_inorder,
-#endif
 };
 
 /*

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