All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 3/3] btrfs: pass the btrfs_bio_ctrl to submit_one_bio
Date: Mon, 6 Jun 2022 18:29:29 +0200	[thread overview]
Message-ID: <20220606162929.GA10835@lst.de> (raw)
In-Reply-To: <0eb3ddf9-af5f-e67f-c8f8-17c80c731359@suse.com>

On Mon, Jun 06, 2022 at 01:41:50PM +0300, Nikolay Borisov wrote:
>> +static void submit_one_bio(struct btrfs_bio_ctrl *bio_ctrl)
>> +{
>> +	if (bio_ctrl->bio)
>> +		__submit_one_bio(bio_ctrl);
>>   }
>
> Why do you need a function just to put an if in it, just move this atop 
> __submit_one_bio :
>
> if (!bio_ctrl->bio)
>     return
>
> and rename it to submit_one_bio.

Because just moving it to the top will lead to null pointer dereferences.
I'd also have to move some initialization down.  Based on that the
wrapper seems cleaner and safer to me.

  reply	other threads:[~2022-06-06 16:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  7:11 extent_io bio submission cleanup Christoph Hellwig
2022-06-03  7:11 ` [PATCH 1/3] btrfs: don't use bio->bi_private to pass the inode to submit_one_bio Christoph Hellwig
2022-06-03 10:33   ` Qu Wenruo
2022-06-03  7:11 ` [PATCH 2/3] btrfs: merge end_write_bio and flush_write_bio Christoph Hellwig
2022-06-03 10:40   ` Qu Wenruo
2022-06-03  7:11 ` [PATCH 3/3] btrfs: pass the btrfs_bio_ctrl to submit_one_bio Christoph Hellwig
2022-06-04 22:31   ` Qu Wenruo
2022-06-06  6:30     ` Christoph Hellwig
2022-06-06 10:41   ` Nikolay Borisov
2022-06-06 16:29     ` Christoph Hellwig [this message]
2022-06-06 20:23       ` David Sterba
2022-06-06 20:26 ` extent_io bio submission cleanup 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=20220606162929.GA10835@lst.de \
    --to=hch@lst.de \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.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 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.