public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Proposed patch for xfsprogs
@ 2010-02-27 22:54 C. Linus Hicks
  2010-03-01  3:16 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: C. Linus Hicks @ 2010-02-27 22:54 UTC (permalink / raw)
  To: xfs

During my recent experience with having to reconstruct parts of an XFS
filesystem that got corrupted as a result of several bad blocks, I found
that some of the information displayed using "blockget -v" was pretty
useless, and I am proposing the following code change to introduce a
slight summarization.

Repeating lines of "setting block <foo> to <bar>" and "setting inode to
<foo> for {,rt}block <bar>" will be summarized down to two lines.



--- a/xfsprogs-3.1.1/db/check.c	2010-01-29 14:46:13.000000000 -0500
+++ b/xfsprogs-3.1.1/db/check.c	2010-02-27 17:02:14.111418960 -0500
@@ -1509,6 +1509,7 @@
 {
 	xfs_extlen_t	i;
 	int		mayprint;
+	int		isfirst = 1;
 	char		*p;
 
 	if (!check_range(agno, agbno, len))  {
@@ -1520,10 +1521,15 @@
 	mayprint = verbose | blist_size;
 	for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
 		*p = (char)type2;
-		if (mayprint && (verbose || CHECK_BLISTA(agno, agbno + i)))
+		if (isfirst && mayprint && (verbose || CHECK_BLISTA(agno, agbno + i))) {
 			dbprintf(_("setting block %u/%u to %s\n"), agno, agbno + i,
 				typename[type2]);
+			isfirst = 0;
+		}
 	}
+	if ((len > 1) && mayprint && (verbose || CHECK_BLISTA(agno, agbno + i)))
+		dbprintf(_("    ... until %u/%u\n"),
+				agno, agbno + len - 1);
 }
 
 static void
@@ -4544,6 +4550,7 @@
 {
 	xfs_extlen_t	i;
 	inodata_t	**idp;
+	int		isfirst = 1;
 	int		mayprint;
 
 	if (!check_inomap(agno, agbno, len, id->ino))
@@ -4551,11 +4558,16 @@
 	mayprint = verbose | id->ilist | blist_size;
 	for (i = 0, idp = &inomap[agno][agbno]; i < len; i++, idp++) {
 		*idp = id;
-		if (mayprint &&
-		    (verbose || id->ilist || CHECK_BLISTA(agno, agbno + i)))
+		if (isfirst && mayprint &&
+		    (verbose || id->ilist || CHECK_BLISTA(agno, agbno + i))) {
 			dbprintf(_("setting inode to %lld for block %u/%u\n"),
 				id->ino, agno, agbno + i);
+			isfirst = 0;
+		}
 	}
+	if ((len > 1) && mayprint && 
+	    (verbose || id->ilist || CHECK_BLISTA(agno, agbno + i)))
+		dbprintf(_("\t\t      ... until %u/%u\n"), agno, agbno + len - 1);
 }
 
 static void
@@ -4575,6 +4587,7 @@
 {
 	xfs_extlen_t	i;
 	inodata_t	**idp;
+	int		isfirst = 1;
 	int		mayprint;
 
 	if (!check_rinomap(bno, len, id->ino))
@@ -4584,10 +4597,16 @@
 	     i < len;
 	     i++, idp++) {
 		*idp = id;
-		if (mayprint && (verbose || id->ilist || CHECK_BLIST(bno + i)))
+		if (isfirst && mayprint &&
+		    (verbose || id->ilist || CHECK_BLIST(bno + i))) {
 			dbprintf(_("setting inode to %lld for rtblock %llu\n"),
 				id->ino, bno + i);
+			isfirst = 0;
+		}
 	}
+	if ((len > 1) && mayprint &&
+	    (verbose || id->ilist || CHECK_BLIST(bno + i)))
+		dbprintf(_("\t\t      ... until %llu\n"), bno + len - 1);
 }
 
 static void


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-02 20:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 22:54 Proposed patch for xfsprogs C. Linus Hicks
2010-03-01  3:16 ` Dave Chinner
2010-03-01 14:37   ` C Linus Hicks
2010-03-02 20:10     ` C Linus Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox