Message ID | 20210111030557.4154161-5-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: improvement on bioset & bvec allocation | expand |
On 11/01/2021 03:05, Ming Lei wrote: > 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> Reviewed-by: Pavel Begunkov <asml.silence@gmail.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; > >
On 1/11/21 4:05 AM, Ming Lei wrote: > 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; > > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes
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;