From: David Sterba <dsterba@suse.cz>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 1/2] btrfs: fix silent failure when deleting root reference
Date: Tue, 23 Aug 2022 19:15:34 +0200 [thread overview]
Message-ID: <20220823171534.GH13489@twin.jikos.cz> (raw)
In-Reply-To: <CAL3q7H7wkPA_XqGOWBEmKgfZK7LN_0sFjTZKdB8u4Gi9dmU3Kw@mail.gmail.com>
On Tue, Aug 23, 2022 at 09:11:55AM +0100, Filipe Manana wrote:
> On Tue, Aug 23, 2022 at 12:47 AM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
> > > ---
> > > fs/btrfs/root-tree.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c
> > > index a64b26b16904..d647cb2938c0 100644
> > > --- a/fs/btrfs/root-tree.c
> > > +++ b/fs/btrfs/root-tree.c
> > > @@ -349,9 +349,10 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id,
> > > key.offset = ref_id;
> > > again:
> > > ret = btrfs_search_slot(trans, tree_root, &key, path, -1, 1);
> > > - if (ret < 0)
> > > + if (ret < 0) {
> > > + err = ret;
> > > goto out;
> > > - if (ret == 0) {
> >
> > Just a small nitpick here, since above if (ret < 0) branch will call
> > "goto out", we don't need the "else" branch.
> > The old "if (ret == 0) {" should be good enough.
>
> Yes, it's not about correctness. It's just my preferred style.
> I find it more intuitive to have a single if-else that tests the same
> variable instead
> of having it tested by two distinct if statements.
Agreed with that style.
next prev parent reply other threads:[~2022-08-23 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-22 11:53 [PATCH 0/2] btrfs: fix lost error value deleting root reference fdmanana
2022-08-22 11:53 ` [PATCH 1/2] btrfs: fix silent failure when " fdmanana
2022-08-22 11:53 ` [PATCH 2/2] btrfs: simplify error handling at btrfs_del_root_ref() fdmanana
2022-08-22 14:47 ` [PATCH v2 0/2] btrfs: fix lost error value deleting root reference fdmanana
2022-08-22 14:47 ` [PATCH v2 1/2] btrfs: fix silent failure when " fdmanana
2022-08-22 23:47 ` Qu Wenruo
2022-08-23 8:11 ` Filipe Manana
2022-08-23 17:15 ` David Sterba [this message]
2022-08-22 14:47 ` [PATCH v2 2/2] btrfs: simplify error handling at btrfs_del_root_ref() fdmanana
2022-08-22 23:54 ` Qu Wenruo
2022-08-23 8:09 ` Filipe Manana
2022-08-22 18:30 ` [PATCH v2 0/2] btrfs: fix lost error value deleting root reference David Sterba
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=20220823171534.GH13489@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--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