xfs
[Top] [All Lists]

[PATCH 067/145] xfs_repair: look for mergeable rmaps

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 067/145] xfs_repair: look for mergeable rmaps
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 16 Jun 2016 18:37:51 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
References: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
Check for adjacent mergeable rmaps; this is a sign that we've
screwed up somehow.

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


diff --git a/repair/scan.c b/repair/scan.c
index 6106d93..d72b257 100644
--- a/repair/scan.c
+++ b/repair/scan.c
@@ -787,6 +787,7 @@ ino_issparse(
 struct rmap_priv {
        struct aghdr_cnts       *agcnts;
        struct xfs_rmap_irec    high_key;
+       struct xfs_rmap_irec    last_rec;
 };
 
 static void
@@ -943,6 +944,16 @@ advance:
                                        goto advance;
                        }
 
+                       /* Is this mergeable with the previous record? */
+                       if (mergeable_rmaps(&rmap_priv->last_rec, &key)) {
+                               do_warn(
+       _("record %d in block (%u/%u) of %s tree should be merged with previous 
record\n"),
+                                       i, agno, bno, name);
+                               rmap_priv->last_rec.rm_blockcount +=
+                                               key.rm_blockcount;
+                       } else
+                               rmap_priv->last_rec = key;
+
                        /* Check that we don't go past the high key. */
                        key.rm_startblock += key.rm_blockcount - 1;
                        if (!XFS_RMAP_NON_INODE_OWNER(key.rm_owner) &&
@@ -1896,6 +1907,7 @@ validate_agf(
                memset(&priv.high_key, 0xFF, sizeof(priv.high_key));
                priv.high_key.rm_blockcount = 0;
                priv.agcnts = agcnts;
+               priv.last_rec.rm_owner = XFS_RMAP_OWN_UNKNOWN;
                bno = be32_to_cpu(agf->agf_roots[XFS_BTNUM_RMAP]);
                if (bno != 0 && verify_agbno(mp, agno, bno)) {
                        scan_sbtree(bno,

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