[PATCH 25/29] xfs_repair: collect relatime reverse-mapping data for refcount/rmap tree rebuilding

"Darrick J. Wong" <[email protected]>
Newsgroups gmane.comp.file-systems.xfs.general
Message-ID <[email protected]>
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 <[email protected]>
---
 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;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.