Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@lst.de>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/3] btrfs: don't use bio->bi_private to pass the inode to submit_one_bio
Date: Fri, 3 Jun 2022 18:33:08 +0800	[thread overview]
Message-ID: <714fe5b2-4a38-c373-c03b-d5b822d94a7f@gmx.com> (raw)
In-Reply-To: <20220603071103.43440-2-hch@lst.de>



On 2022/6/3 15:11, Christoph Hellwig wrote:
> submit_one_bio is only used for page cache I/O, so the inode can be
> trivially derived from the first page in the bio.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Qu Wenruo <wqu@suse.com>

> ---
>   fs/btrfs/extent_io.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 7b5f872d2eb9f..025349aeec31f 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -181,10 +181,7 @@ static int add_extent_changeset(struct extent_state *state, u32 bits,
>   static void submit_one_bio(struct bio *bio, int mirror_num,
>   			   enum btrfs_compression_type compress_type)
>   {
> -	struct extent_io_tree *tree = bio->bi_private;
> -	struct inode *inode = tree->private_data;
> -
> -	bio->bi_private = NULL;
> +	struct inode *inode = bio_first_page_all(bio)->mapping->host;
>
>   	/* Caller should ensure the bio has at least some range added */
>   	ASSERT(bio->bi_iter.bi_size);
> @@ -3360,7 +3357,6 @@ static int alloc_new_bio(struct btrfs_inode *inode,
>   	bio_ctrl->bio = bio;
>   	bio_ctrl->compress_type = compress_type;
>   	bio->bi_end_io = end_io_func;
> -	bio->bi_private = &inode->io_tree;

And what the heck that we're passing io_tree into bi_private??
At least we should try passing inode.

Anyway, the old behavior makes no sense, great we can get rid of it.

BTW, I didn't see modification in btrfs_repair_one_sector(), it is not a
problem since we no longer utilize bi_private, but it may be better
explicitly remove that call site too.

Thanks,
Qu
>   	bio->bi_opf = opf;
>   	ret = calc_bio_boundaries(bio_ctrl, inode, file_offset);
>   	if (ret < 0)

  reply	other threads:[~2022-06-03 10:33 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 [this message]
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
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=714fe5b2-4a38-c373-c03b-d5b822d94a7f@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox