X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,FH_DATE_PAST_20XX autolearn=no version=3.3.0-rupdated Received: from cuda.sgi.com (cuda2.sgi.com [192.48.176.25]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id o21EaoCC175976 for ; Mon, 1 Mar 2010 08:36:51 -0600 X-ASG-Debug-ID: 1267454295-0a6f025f0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from vms173019pub.verizon.net (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id 2574E205DEE for ; Mon, 1 Mar 2010 06:38:15 -0800 (PST) Received: from vms173019pub.verizon.net (vms173019pub.verizon.net [206.46.173.19]) by cuda.sgi.com with ESMTP id wo8mrzIeef8CWe2X for ; Mon, 01 Mar 2010 06:38:15 -0800 (PST) Received: from [192.168.10.2] ([unknown] [98.114.168.230]) by vms173019.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0KYL007U9XZBYCZ0@vms173019.mailsrvcs.net> for xfs@oss.sgi.com; Mon, 01 Mar 2010 08:37:59 -0600 (CST) X-ASG-Orig-Subj: Re: Proposed patch for xfsprogs Subject: Re: Proposed patch for xfsprogs From: C Linus Hicks To: Dave Chinner Cc: xfs@oss.sgi.com In-reply-to: <20100301031642.GG22370@discord.disaster> References: <1267311250.28691.40.camel@lh10.linush.net> <20100301031642.GG22370@discord.disaster> Content-type: text/plain Date: Mon, 01 Mar 2010 09:37:59 -0500 Message-id: <1267454279.28691.45.camel@lh10.linush.net> MIME-version: 1.0 X-Mailer: Evolution 2.12.3 (2.12.3-8.el5_2.3) Content-transfer-encoding: 7bit X-Barracuda-Connect: vms173019pub.verizon.net[206.46.173.19] X-Barracuda-Start-Time: 1267454297 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=2.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=2.1 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.23752 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean On Mon, 2010-03-01 at 14:16 +1100, Dave Chinner wrote: > 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 to " and "setting inode to > > for {,rt}block " 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? You're quite right, I'm glad you looked close enough to spot that. Sorry I missed it. There's one case your code doesn't handle correctly, where len > 0 and last_print == -1 and i == len - 1. Let me rework the code and do some testing then I will re-submit. Linus