From: Dave Chinner <david@fromorbit.com>
To: "C. Linus Hicks" <linush@mindspring.com>
Cc: xfs@oss.sgi.com
Subject: Re: Proposed patch for xfsprogs
Date: Mon, 1 Mar 2010 14:16:42 +1100 [thread overview]
Message-ID: <20100301031642.GG22370@discord.disaster> (raw)
In-Reply-To: <1267311250.28691.40.camel@lh10.linush.net>
On Sat, Feb 27, 2010 at 05:54:10PM -0500, C. Linus Hicks wrote:
> 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.
Agreed, that would certainly help reduce the verbosity of the output.
However, I don't think the patch is correct.
> --- 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);
> }
This doesn't take into account that not all blocks in the extent
range might be bad and the change is actually doing something. i.e.
only is CHECK_BLISTA() evaluating as true is there a printout
occurring (unless you specify verbose mode). Hence if only interior
portions are being changed or there are multiple ranges being
changed, this output won't reflect the errors being detected
accurately.
The other sections of the patch have the same issue.
I think that changing it to something like:
int last_print == -1;
.....
if (mayprint && (verbose || CHECK_BLISTA(agno, agbno + i))) {
if (i > 0 && last_print == i - 1) {
last_print = i;
continue;
}
if (last_print != i - 1) {
dbprintf(_(" ... until %u/%u\n"),
agno, agbno + last_print);
last_print == -1;
}
if (last_print == -1) {
dbprintf(_("setting block %u/%u to %s\n"),
agno, agbno + i, typename[type2]);
last_print = i;
}
}
}
if (len > 1 && last_print != -1)
dbprintf(_(" ... until %u/%u\n"), agno, agbno + last_print);
would do the trick. What do you think?
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-03-01 3:15 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 [this message]
2010-03-01 14:37 ` C Linus Hicks
2010-03-02 20:10 ` C Linus Hicks
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=20100301031642.GG22370@discord.disaster \
--to=david@fromorbit.com \
--cc=linush@mindspring.com \
--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