xfs
[Top] [All Lists]

[PATCH 25/29] xfs_repair: collect relatime reverse-mapping data for refc

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 25/29] xfs_repair: collect relatime reverse-mapping data for refcount/rmap tree rebuilding
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 17:01:20 -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
Collect reverse-mapping data for realtime files so that we can later
check and rebuild the reference count tree and the reverse mapping
tree.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 repair/dinode.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)


diff --git a/repair/dinode.c b/repair/dinode.c
index f768cdf..04759dc 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -594,6 +594,7 @@ process_bmbt_reclist_int(
        xfs_agblock_t           ebno;
        xfs_extlen_t            blen;
        xfs_agnumber_t          locked_agno = -1;
+       struct aglock           *ag_lock;
        int                     error = 1;
 
        if (type == XR_INO_RTDATA)
@@ -639,8 +640,20 @@ _("zero length extent (off = %" PRIu64 ", fsbno = %" 
PRIu64 ") in ino %" PRIu64
                         */
                        if (process_rt_rec(mp, &irec, ino, tot, check_dups))
                                return 1;
+                       /* collect reverse mappings for realtime files */
+                       if (collect_rmaps && !check_dups) {
+                               ag_lock = &ag_locks[(signed)NULLAGNUMBER];
+                               pthread_mutex_lock(&ag_lock->lock);
+                               error = rmap_add_rec(mp, ino, whichfork,
+                                               &irec, true);
+                               pthread_mutex_unlock(&ag_lock->lock);
+                               if (error)
+                                       do_error(
+_("couldn't add reverse mapping\n")
+                                               );
+                       }
                        /*
-                        * skip rest of loop processing since 
that'irec.br_startblock
+                        * skip rest of loop processing since that's
                         * all for regular file forks and attr forks
                         */
                        continue;

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