From: C Linus Hicks <linush@verizon.net>
To: xfs@oss.sgi.com
Subject: Re: Proposed patch for xfsprogs
Date: Tue, 02 Mar 2010 15:10:33 -0500 [thread overview]
Message-ID: <1267560633.28691.67.camel@lh10.linush.net> (raw)
In-Reply-To: <1267454279.28691.45.camel@lh10.linush.net>
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
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
prev parent reply other threads:[~2010-03-02 20:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267560633.28691.67.camel@lh10.linush.net \
--to=linush@verizon.net \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox