Lines Matching defs:nr_vecs

39 	int nr_vecs;
43 { .nr_vecs = 16, .name = "biovec-16" },
44 { .nr_vecs = 64, .name = "biovec-64" },
45 { .nr_vecs = 128, .name = "biovec-128" },
46 { .nr_vecs = BIO_MAX_VECS, .name = "biovec-max" },
49 static struct biovec_slab *biovec_slab(unsigned short nr_vecs)
51 switch (nr_vecs) {
163 void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs)
165 BUG_ON(nr_vecs > BIO_MAX_VECS);
167 if (nr_vecs == BIO_MAX_VECS)
169 else if (nr_vecs > BIO_INLINE_VECS)
170 kmem_cache_free(biovec_slab(nr_vecs)->slab, bv);
183 struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs,
186 struct biovec_slab *bvs = biovec_slab(*nr_vecs);
192 * Upgrade the nr_vecs request to take full advantage of the allocation.
195 *nr_vecs = bvs->nr_vecs;
202 if (*nr_vecs < BIO_MAX_VECS) {
208 *nr_vecs = BIO_MAX_VECS;
433 unsigned short nr_vecs, blk_opf_t opf, gfp_t gfp,
453 bio_init(bio, bdev, nr_vecs ? bio->bi_inline_vecs : NULL, nr_vecs, opf);
461 * @nr_vecs: number of bvecs to pre-allocate
492 struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs,
500 /* should not use nobvec bioset for nr_vecs > 0 */
501 if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0))
505 if (bs->cache && nr_vecs <= BIO_INLINE_VECS) {
506 bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf,
555 if (nr_vecs > BIO_INLINE_VECS) {
558 bvl = bvec_alloc(&bs->bvec_pool, &nr_vecs, gfp_mask);
562 bvl = bvec_alloc(&bs->bvec_pool, &nr_vecs, gfp_mask);
567 bio_init(bio, bdev, bvl, nr_vecs, opf);
568 } else if (nr_vecs) {
585 * @nr_vecs: number of bio_vecs to allocate
599 struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask)
603 if (nr_vecs > UIO_MAXIOV)
605 return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask);
1794 bvs->nr_vecs * sizeof(struct bio_vec), 0,