Proposed patch for xfsprogs
C Linus Hicks
linush at verizon.net
Tue Mar 2 14:10:33 CST 2010
This patch is for reducing the verbosity of the xfs_db "blockget"
command especially when using "-v" by listing only start and end block
numbers for a range, rather than listing all individual blocks. For a
sample 50gb filesystem with around 50% free space and about 20 corrupted
sectors, the logfile size drops from 900mb to 3mb.
Here's my fixed patch:
--- 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-03-01 17:47:01.000000000 -0500
@@ -1509,6 +1509,8 @@
{
xfs_extlen_t i;
int mayprint;
+ int pcnt = 0;
+ int first_prnt = -1;
char *p;
if (!check_range(agno, agbno, len)) {
@@ -1520,10 +1522,25 @@
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)))
- dbprintf(_("setting block %u/%u to %s\n"), agno, agbno + i,
- typename[type2]);
+ if (mayprint && (verbose || CHECK_BLISTA(agno, agbno + i))) {
+ if (first_prnt == -1) {
+ dbprintf(_("setting block %u/%u to %s\n"),
+ agno, agbno + i, typename[type2]);
+ first_prnt = i;
+ }
+ else if ((first_prnt + pcnt + 1) == i) {
+ pcnt++;
+ }
+ else {
+ dbprintf(_(" ... until %u/%u\n"),
+ agno, agbno + first_prnt + pcnt);
+ first_prnt = -1;
+ pcnt = 0;
+ }
+ }
}
+ if (pcnt > 0)
+ dbprintf(_(" ... until %u/%u\n"), agno, agbno + len - 1);
}
static void
@@ -4544,6 +4561,8 @@
{
xfs_extlen_t i;
inodata_t **idp;
+ int pcnt = 0;
+ int first_prnt = -1;
int mayprint;
if (!check_inomap(agno, agbno, len, id->ino))
@@ -4552,10 +4571,26 @@
for (i = 0, idp = &inomap[agno][agbno]; i < len; i++, idp++) {
*idp = id;
if (mayprint &&
- (verbose || id->ilist || CHECK_BLISTA(agno, agbno + i)))
- dbprintf(_("setting inode to %lld for block %u/%u\n"),
- id->ino, agno, agbno + i);
+ (verbose || id->ilist || CHECK_BLISTA(agno, agbno + i))) {
+ if (first_prnt == -1) {
+ dbprintf(_("setting inode to %#llx for block "
+ "%u/%u\n"),
+ id->ino, agno, agbno + i);
+ first_prnt = i;
+ }
+ else if ((first_prnt + pcnt + 1) == i) {
+ pcnt++;
+ }
+ else {
+ dbprintf(_("\t\t ... until %u/%u\n"),
+ agno, agbno + first_prnt + pcnt);
+ first_prnt = -1;
+ pcnt = 0;
+ }
+ }
}
+ if (pcnt > 0)
+ dbprintf(_("\t\t ... until %u/%u\n"), agno, agbno + len - 1);
}
static void
@@ -4575,6 +4610,8 @@
{
xfs_extlen_t i;
inodata_t **idp;
+ int pcnt = 0;
+ int first_prnt = -1;
int mayprint;
if (!check_rinomap(bno, len, id->ino))
@@ -4584,10 +4621,26 @@
i < len;
i++, idp++) {
*idp = id;
- if (mayprint && (verbose || id->ilist || CHECK_BLIST(bno + i)))
- dbprintf(_("setting inode to %lld for rtblock %llu\n"),
+ if (mayprint &&
+ (verbose || id->ilist || CHECK_BLIST(bno + i))) {
+ if (first_prnt == -1) {
+ dbprintf(_("setting inode to %#llx for rtblock %llu\n"),
id->ino, bno + i);
+ first_prnt = i;
+ }
+ else if ((first_prnt + pcnt + 1) == i) {
+ pcnt++;
+ }
+ else {
+ dbprintf(_("\t\t ... until %llu\n"),
+ bno + first_prnt + pcnt);
+ first_prnt = -1;
+ pcnt = 0;
+ }
+ }
}
+ if (pcnt > 0)
+ dbprintf(_("\t\t ... until %llu\n"), bno + len - 1);
}
static void
More information about the xfs
mailing list