All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Tom Yan <tom.ty89@gmail.com>
Cc: linux-block@vger.kernel.org, hch@lst.de, ming.l@ssi.samsung.com,
	sagig@grimberg.me, axboe@fb.com, tom.leiming@gmail.com
Subject: Re: [PATCH] block: fix bio chaining in blk_next_bio()
Date: Mon, 7 Dec 2020 11:12:26 +0800	[thread overview]
Message-ID: <20201207031226.GD985419@T590> (raw)
In-Reply-To: <20201206051802.1890-1-tom.ty89@gmail.com>

On Sun, Dec 06, 2020 at 01:18:02PM +0800, Tom Yan wrote:
> While it seems to have worked for so long, it doesn't seem right
> that we set the new bio as the parent. bio_chain() seems to be used
> in the other way everywhere else anyway.
> 
> Signed-off-by: Tom Yan <tom.ty89@gmail.com>
> ---
>  block/blk-lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index e90614fd8d6a..918deaf5c8a4 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -15,7 +15,7 @@ struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp)
>  	struct bio *new = bio_alloc(gfp, nr_pages);
>  
>  	if (bio) {
> -		bio_chain(bio, new);
> +		bio_chain(new, bio);
>  		submit_bio(bio);
>  	}

This patch isn't needed. We simply wait for completion of the last issued bio, which
.bi_end_io(submit_bio_wait_endio) is only called after all previous bios are done.

And the last bio is the ancestor of the whole chained bios, which are
submitted in the following way(order):

	bio 0 ---> bio 1 ---> ... -> bio N(the last bio)


thanks,
Ming


  parent reply	other threads:[~2020-12-07  3:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-06  5:18 [PATCH] block: fix bio chaining in blk_next_bio() Tom Yan
2020-12-06 11:20 ` Hannes Reinecke
2020-12-06 13:17   ` Tom Yan
2020-12-06 14:17     ` Tom Yan
2020-12-07  3:12 ` Ming Lei [this message]
2020-12-08 12:46   ` Tom Yan
2020-12-09  1:20     ` Ming Lei

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=20201207031226.GD985419@T590 \
    --to=ming.lei@redhat.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.l@ssi.samsung.com \
    --cc=sagig@grimberg.me \
    --cc=tom.leiming@gmail.com \
    --cc=tom.ty89@gmail.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.