From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: bo.li.liu@oracle.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: use self-explaining variable
Date: Sun, 24 Sep 2017 15:24:54 +0200 [thread overview]
Message-ID: <20170924132454.GS29043@twin.jikos.cz> (raw)
In-Reply-To: <02a5af04-f1b3-cdef-d77d-55c0517c12ad@gmx.com>
On Sat, Sep 23, 2017 at 09:09:24AM +0800, Qu Wenruo wrote:
>
>
> On 2017年09月23日 08:48, Liu Bo wrote:
> > On Sat, Sep 23, 2017 at 08:46:55AM +0800, Qu Wenruo wrote:
> >>
> >>
> >> On 2017年09月23日 07:36, Liu Bo wrote:
> >>> This uses a bool 'do_backup' to help understand this piece of code.
> >>>
> >>> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> >>> ---
> >>> This is based on a patch "Btrfs: do not backup tree roots when fsync".
> >>>
> >>> fs/btrfs/disk-io.c | 3 ++-
> >>> 1 file changed, 2 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> >>> index cdb7043..9811b9d 100644
> >>> --- a/fs/btrfs/disk-io.c
> >>> +++ b/fs/btrfs/disk-io.c
> >>> @@ -3691,6 +3691,7 @@ int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
> >>> int max_errors;
> >>> int total_errors = 0;
> >>> u64 flags;
> >>> + bool do_backup = (max_mirrors == 0);
> >>
> >> Why not replacing @max_mirrors with @do_backup as parameter?
> >
> > If I read the code correctly, max_mirrors is not just for deciding
> > backup.
>
> That's strange.
>
> write_all_supers() only uses @max_mirrors by passing it to
> write_dev_supers() and wait_dev_supers().
>
> Both of the write/wait_dev_supers() will replace @max_mirrors to
> BTRFS_SUPER_MIRROR_MAX if it's zero.
>
> Further more, all write_all_supers() callers just pass @max_mirrors as
> bool (either 0 or 1).
>
> So I don't see any point not replacing the parameter as bool.
Agreed, the idea was to replace the parameter by the bool.
prev parent reply other threads:[~2017-09-24 13:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 18:25 [PATCH] Btrfs: do not backup tree roots when fsync Liu Bo
2017-09-14 1:55 ` Qu Wenruo
2017-09-14 12:49 ` David Sterba
2017-09-15 21:09 ` Liu Bo
2017-09-22 23:36 ` [PATCH] Btrfs: use self-explaining variable Liu Bo
2017-09-23 0:46 ` Qu Wenruo
2017-09-23 0:48 ` Liu Bo
2017-09-23 1:09 ` Qu Wenruo
2017-09-24 13:24 ` 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=20170924132454.GS29043@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=bo.li.liu@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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).