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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux