xfs
[Top] [All Lists]

[PATCH 21/24] xfs: scrub should cross-reference the realtime bitmap

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 21/24] xfs: scrub should cross-reference the realtime bitmap
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 16:57:33 -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
While we're scrubbing various btrees, cross-reference the records
with the other metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 libxfs/xfs_rtbitmap.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)


diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c
index 70ea975..d7a1acd 100644
--- a/libxfs/xfs_rtbitmap.c
+++ b/libxfs/xfs_rtbitmap.c
@@ -1011,3 +1011,32 @@ xfs_rtfree_extent(
        }
        return 0;
 }
+
+/* Is the given extent all free? */
+int
+xfs_rtbitmap_extent_is_free(
+       struct xfs_mount                *mp,
+       xfs_rtblock_t                   start,
+       xfs_rtblock_t                   len,
+       bool                            *is_free)
+{
+       xfs_rtblock_t                   end;
+       xfs_extlen_t                    clen;
+       int                             matches;
+       int                             error;
+
+       *is_free = false;
+       while (len) {
+               clen = len > ~0U ? ~0U : len;
+               error = xfs_rtcheck_range(mp, NULL, start, clen, 1, &end,
+                               &matches);
+               if (error || !matches || end < start + clen)
+                       return error;
+
+               len -= end - start;
+               start = end + 1;
+       }
+
+       *is_free = true;
+       return error;
+}

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