Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: remove bvec_free

bvec_free is only called by bio_free, so inline it there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://patch.msgid.link/20260316161144.1607877-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
e80fd7a0 b520c4ee

+7 -13
+7 -13
block/bio.c
··· 161 161 mutex_unlock(&bio_slab_lock); 162 162 } 163 163 164 - static void bvec_free(struct mempool *pool, struct bio_vec *bv, 165 - unsigned short nr_vecs) 166 - { 167 - BUG_ON(nr_vecs > BIO_MAX_VECS); 168 - 169 - if (nr_vecs == BIO_MAX_VECS) 170 - mempool_free(bv, pool); 171 - else if (nr_vecs > BIO_INLINE_VECS) 172 - kmem_cache_free(biovec_slab(nr_vecs)->slab, bv); 173 - } 174 - 175 164 /* 176 165 * Make the first allocation restricted and don't dump info on allocation 177 166 * failures, since we'll fall back to the mempool in case of failure. ··· 192 203 void *p = bio; 193 204 194 205 WARN_ON_ONCE(!bs); 206 + WARN_ON_ONCE(bio->bi_max_vecs > BIO_MAX_VECS); 195 207 196 208 bio_uninit(bio); 197 - bvec_free(&bs->bvec_pool, bio->bi_io_vec, bio->bi_max_vecs); 209 + if (bio->bi_max_vecs == BIO_MAX_VECS) 210 + mempool_free(bio->bi_io_vec, &bs->bvec_pool); 211 + else if (bio->bi_max_vecs > BIO_INLINE_VECS) 212 + kmem_cache_free(biovec_slab(bio->bi_max_vecs)->slab, 213 + bio->bi_io_vec); 198 214 mempool_free(p - bs->front_pad, &bs->bio_pool); 199 215 } 200 216 ··· 555 561 556 562 /* 557 563 * Upgrade nr_vecs to take full advantage of the allocation. 558 - * We also rely on this in bvec_free(). 564 + * We also rely on this in bio_free(). 559 565 */ 560 566 nr_vecs = bvs->nr_vecs; 561 567 bvecs = kmem_cache_alloc(bvs->slab, gfp);