All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Johannes Thumshirn <jthumshirn@suse.de>
Subject: Re: [PATCH 3/5] block: don't allow multiple bio_iov_iter_get_pages calls per bio
Date: Thu, 11 Apr 2019 15:31:56 +0800	[thread overview]
Message-ID: <20190411073154.GC421@ming.t460p> (raw)
In-Reply-To: <20190411062331.27800-4-hch@lst.de>

On Thu, Apr 11, 2019 at 08:23:29AM +0200, Christoph Hellwig wrote:
> No caller uses bio_iov_iter_get_pages multiple times on a given bio,
> and that funtionality isn't all that useful.  Removing it will make
> some future changes a little easier and also simplifies the function
> a bit.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  block/bio.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/block/bio.c b/block/bio.c
> index ad346082a971..c2a389b1509a 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -958,7 +958,10 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>  int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>  {
>  	const bool is_bvec = iov_iter_is_bvec(iter);
> -	unsigned short orig_vcnt = bio->bi_vcnt;
> +	int ret;
> +
> +	if (WARN_ON_ONCE(bio->bi_vcnt))
> +		return -EINVAL;
>  
>  	/*
>  	 * If this is a BVEC iter, then the pages are kernel pages. Don't
> @@ -968,19 +971,13 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
>  		bio_set_flag(bio, BIO_NO_PAGE_REF);
>  
>  	do {
> -		int ret;
> -
>  		if (is_bvec)
>  			ret = __bio_iov_bvec_add_pages(bio, iter);
>  		else
>  			ret = __bio_iov_iter_get_pages(bio, iter);
> +	} while (!ret && iov_iter_count(iter) && !bio_full(bio));
>  
> -		if (unlikely(ret))
> -			return bio->bi_vcnt > orig_vcnt ? 0 : ret;
> -
> -	} while (iov_iter_count(iter) && !bio_full(bio));
> -
> -	return 0;
> +	return bio->bi_vcnt ? 0 : ret;
>  }
>  
>  static void submit_bio_wait_endio(struct bio *bio)
> -- 
> 2.20.1
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming

  reply	other threads:[~2019-04-11  7:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  6:23 avoid calling nth_page in the block I/O path v2 Christoph Hellwig
2019-04-11  6:23 ` [PATCH 1/5] block: rewrite blk_bvec_map_sg to avoid a nth_page call Christoph Hellwig
2019-04-11  6:23 ` [PATCH 2/5] block: refactor __bio_iov_bvec_add_pages Christoph Hellwig
2019-04-11  7:10   ` Ming Lei
2019-04-11  6:23 ` [PATCH 3/5] block: don't allow multiple bio_iov_iter_get_pages calls per bio Christoph Hellwig
2019-04-11  7:31   ` Ming Lei [this message]
2019-04-12 15:03   ` Bart Van Assche
2019-04-11  6:23 ` [PATCH 4/5] block: change how we get page references in bio_iov_iter_get_pages Christoph Hellwig
2019-04-11  7:36   ` Ming Lei
2019-04-11  6:23 ` [PATCH 5/5] block: only allow contiguous page structs in a bio_vec Christoph Hellwig
2019-04-12 15:15 ` avoid calling nth_page in the block I/O path v2 Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2019-04-08 10:46 avoid calling nth_page in the block I/O path Christoph Hellwig
2019-04-08 10:46 ` [PATCH 3/5] block: don't allow multiple bio_iov_iter_get_pages calls per bio Christoph Hellwig
2019-04-08 11:13   ` Johannes Thumshirn
2019-04-08 22:17   ` Bart Van Assche
2019-04-09 10:05     ` Christoph Hellwig

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=20190411073154.GC421@ming.t460p \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=jthumshirn@suse.de \
    --cc=linux-block@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.