All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V3 4/6] block: set .bi_max_vecs as actual allocated vector number
Date: Mon, 11 Jan 2021 11:05:55 +0800	[thread overview]
Message-ID: <20210111030557.4154161-5-ming.lei@redhat.com> (raw)
In-Reply-To: <20210111030557.4154161-1-ming.lei@redhat.com>

bvec_alloc() may allocate more bio vectors than requested, so set
.bi_max_vecs as actual allocated vector number, instead of the requested
number. This way can help fs build bigger bio because new bio often won't
be allocated until the current one becomes full.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/bio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/bio.c b/block/bio.c
index 496aa5938f79..37e3f2d9df99 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -505,12 +505,13 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs,
 			goto err_free;
 
 		bio->bi_flags |= idx << BVEC_POOL_OFFSET;
+		bio->bi_max_vecs = bvec_nr_vecs(idx);
 	} else if (nr_iovecs) {
 		bvl = bio->bi_inline_vecs;
+		bio->bi_max_vecs = inline_vecs;
 	}
 
 	bio->bi_pool = bs;
-	bio->bi_max_vecs = nr_iovecs;
 	bio->bi_io_vec = bvl;
 	return bio;
 
-- 
2.28.0


  parent reply	other threads:[~2021-01-11  3:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11  3:05 [PATCH V3 0/6] block: improvement on bioset & bvec allocation Ming Lei
2021-01-11  3:05 ` [PATCH V3 1/6] block: manage bio slab cache by xarray Ming Lei
2021-01-11  4:39   ` Pavel Begunkov
2021-01-11  6:57   ` Hannes Reinecke
2021-01-11  3:05 ` [PATCH V3 2/6] block: don't pass BIOSET_NEED_BVECS for q->bio_split Ming Lei
2021-01-11  4:41   ` Pavel Begunkov
2021-01-11  6:57   ` Hannes Reinecke
2021-01-11  3:05 ` [PATCH V3 3/6] block: don't allocate inline bvecs if this bioset needn't bvecs Ming Lei
2021-01-11  4:41   ` Pavel Begunkov
2021-01-11  6:58   ` Hannes Reinecke
2021-01-11  3:05 ` Ming Lei [this message]
2021-01-11  4:42   ` [PATCH V3 4/6] block: set .bi_max_vecs as actual allocated vector number Pavel Begunkov
2021-01-11  6:59   ` Hannes Reinecke
2021-01-11  3:05 ` [PATCH V3 5/6] block: move three bvec helpers declaration into private helper Ming Lei
2021-01-11  4:42   ` Pavel Begunkov
2021-01-11  7:00   ` Hannes Reinecke
2021-01-11  3:05 ` [PATCH V3 6/6] bcache: don't pass BIOSET_NEED_BVECS for the 'bio_set' embedded in 'cache_set' Ming Lei
2021-01-11  3:54   ` Coly Li
2021-01-11  7:00   ` Hannes Reinecke
2021-01-11  4:35 ` [PATCH V3 0/6] block: improvement on bioset & bvec allocation Pavel Begunkov
2021-01-25  2:27 ` Ming Lei
2021-01-25  4:24 ` Jens Axboe

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=20210111030557.4154161-5-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.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.