From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs-progs: fsck: Add support to clear v1 free space cache.
Date: Wed, 26 Oct 2016 15:38:56 +0200 [thread overview]
Message-ID: <20161026133856.GB12522@suse.cz> (raw)
In-Reply-To: <6845d4d0-c276-31b4-a8d7-21c6b5303adf@cn.fujitsu.com>
On Wed, Oct 26, 2016 at 09:07:25AM +0800, Qu Wenruo wrote:
> At 10/25/2016 10:09 PM, David Sterba wrote:
> > On Thu, Oct 13, 2016 at 05:22:26PM +0800, Qu Wenruo wrote:
> >> Kernel clear_cache mount option will only rebuilt free space cache if
> >> used space of that chunk has changed.
> >>
> >> So it won't ensure any corrupted free space cache get cleared.
> >>
> >> So add a new option "--clear-space-cache v1|v2" to btrfsck, to
> >> completely wipe out free space cache.
> >> So kernel won't complain again.
> >>
> >> Reported-by: Ivan P <chrnosphered@gmail.com>
> >> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> >
> > Applied with the attached diff, use it as a review feedback.
> >
> >
> Thanks for the diff, quite helpful.
>
> But I'm a little concerned about the minor coding styling.
>
> 1) For non-zero comparison
> - if (strcmp(optarg, "v1")) {
> + if (strcmp(optarg, "v1") != 0) {
>
> Is it recommended to use "!= 0" other than hiding it?
> I often see code hiding the "!= 0", so I'm a little curious about this.
The strcmp return value is inverse to what the name suggests. Sure
everybody know that, but I find it a bit more readable.
> 2) Long string indent
> - error("failed to locate free space cache extent for block group %llu",
> - bg->key.objectid);
> + error(
> + "failed to locate free space cache extent for block group %llu: %d",
> + bg->key.objectid, ret);
>
> Kernel coding style allows us to use string longer than 80 chars, so we
> don't need to break long string.
We don't want to break the string and the lines should fit to 80 chars
per line, small overflow is acceptable (in btrfs-progs).
> But I'm not sure if we should change the indent.
> Normally I just keep the string at the same line of error()/warning(),
> as we have no 80 chars limit.
Yeah, and I'm moving it to the next line and un-indenting back until the
string end is below 80 chars.
> Or we should change indent to allow them fit in 80 chars?
> IIRC I did it several times in kernel or btrfs-progs, but it seems to be
> modified to same line version.
It's not a big deal, but preferred to keep it under 80. Why? To view
more columns, and see the whole code, not just part of the line. I use
vertically split window in the diff mode (in vim) during reviews, also
the merge conflict resolution using vimdiff tries to fit 3 views on the
screen. And maybe just personal preference, when scrolling the code down
does not need to move eyes left and right when the code fits under 80.
Small things but when multiplied by number of patches I process, quite
improves effectivity and patch throughput.
prev parent reply other threads:[~2016-10-26 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 9:22 [PATCH 1/2] btrfs-progs: fsck: Add support to clear v1 free space cache Qu Wenruo
2016-10-13 9:22 ` [PATCH 2/2] btrfs-progs: fsck-tests: Check if clear space cache works Qu Wenruo
2016-10-19 15:04 ` David Sterba
2016-10-25 14:28 ` David Sterba
2016-10-13 17:44 ` [PATCH 1/2] btrfs-progs: fsck: Add support to clear v1 free space cache Omar Sandoval
2016-10-14 1:29 ` Qu Wenruo
2016-10-19 15:13 ` David Sterba
2016-10-20 1:04 ` Qu Wenruo
2016-10-24 18:11 ` David Sterba
2016-10-25 14:09 ` David Sterba
2016-10-26 1:07 ` Qu Wenruo
2016-10-26 13:38 ` David Sterba [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=20161026133856.GB12522@suse.cz \
--to=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).