All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sun YangKai <sunk67188@gmail.com>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: reorganize error handling in btrfs_tree_mod_log_insert_key
Date: Mon, 29 Sep 2025 18:24:43 +0800	[thread overview]
Message-ID: <5926212.DvuYhMxLoT@saltykitkat> (raw)
In-Reply-To: <CAL3q7H5OvZrFZDzhds98vwLNXO1ttWjJVajCwQRhPHmt+dDJCQ@mail.gmail.com>

> > -       ret = tree_mod_log_insert(eb->fs_info, tm);
> > -out_unlock:
> > +       /* Deal with allocation error. */
> 
> This is a useless comment... The existing comment is much more helpful
> and the fact that's in the else statement above, makes it easier to
> grok.

I agree that the existing comment is much more helpful, while I personally 
don't like the else branch appears after a return/goto/continue/break 
statement. So I think it's just about personal code style.

> I also wonder why you picked only this function, since this pattern is
> followed in several other functions...

Because I happened to read this, and it takes me minutes to realise what is 
happening and why it was written like this...
And I'm not sure how to make it better. Since this is the most simple one with 
this pattern, I just have a try to make it more clear IMO.

> Not a fan of the proposed change.
> 
> > +       if (tm)
> > +               ret = tree_mod_log_insert(eb->fs_info, tm);
> > +       else
> > +               ret = -ENOMEM;
> > +
> > 
> >         write_unlock(&eb->fs_info->tree_mod_log_lock);
> >         if (ret)
> >         
> >                 kfree(tm);
> > 
> > --
> > 2.51.0





  reply	other threads:[~2025-09-29 10:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29  6:56 [PATCH] btrfs: reorganize error handling in btrfs_tree_mod_log_insert_key Sun YangKai
2025-09-29  7:54 ` Qu Wenruo
2025-09-29  8:25   ` Sun YangKai
2025-09-29  8:32     ` Filipe Manana
2025-09-29  8:43       ` Qu Wenruo
2025-09-29  8:30 ` Filipe Manana
2025-09-29 10:24   ` Sun YangKai [this message]
2025-09-29 10:41     ` Filipe Manana

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=5926212.DvuYhMxLoT@saltykitkat \
    --to=sunk67188@gmail.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.