Lines Matching refs:nr_vecs
39 int nr_vecs; member
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) in biovec_slab() argument
51 switch (nr_vecs) { in biovec_slab()
163 void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned short nr_vecs) in bvec_free() argument
165 BUG_ON(nr_vecs > BIO_MAX_VECS); in bvec_free()
167 if (nr_vecs == BIO_MAX_VECS) in bvec_free()
169 else if (nr_vecs > BIO_INLINE_VECS) in bvec_free()
170 kmem_cache_free(biovec_slab(nr_vecs)->slab, bv); in bvec_free()
183 struct bio_vec *bvec_alloc(mempool_t *pool, unsigned short *nr_vecs, in bvec_alloc() argument
186 struct biovec_slab *bvs = biovec_slab(*nr_vecs); in bvec_alloc()
195 *nr_vecs = bvs->nr_vecs; in bvec_alloc()
202 if (*nr_vecs < BIO_MAX_VECS) { in bvec_alloc()
208 *nr_vecs = BIO_MAX_VECS; in bvec_alloc()
433 unsigned short nr_vecs, blk_opf_t opf, gfp_t gfp, in bio_alloc_percpu_cache() argument
453 bio_init(bio, bdev, nr_vecs ? bio->bi_inline_vecs : NULL, nr_vecs, opf); in bio_alloc_percpu_cache()
492 struct bio *bio_alloc_bioset(struct block_device *bdev, unsigned short nr_vecs, in bio_alloc_bioset() argument
501 if (WARN_ON_ONCE(!mempool_initialized(&bs->bvec_pool) && nr_vecs > 0)) in bio_alloc_bioset()
505 if (bs->cache && nr_vecs <= BIO_INLINE_VECS) { in bio_alloc_bioset()
506 bio = bio_alloc_percpu_cache(bdev, nr_vecs, opf, in bio_alloc_bioset()
555 if (nr_vecs > BIO_INLINE_VECS) { in bio_alloc_bioset()
558 bvl = bvec_alloc(&bs->bvec_pool, &nr_vecs, gfp_mask); in bio_alloc_bioset()
562 bvl = bvec_alloc(&bs->bvec_pool, &nr_vecs, gfp_mask); in bio_alloc_bioset()
567 bio_init(bio, bdev, bvl, nr_vecs, opf); in bio_alloc_bioset()
568 } else if (nr_vecs) { in bio_alloc_bioset()
599 struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask) in bio_kmalloc() argument
603 if (nr_vecs > UIO_MAXIOV) in bio_kmalloc()
605 return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask); in bio_kmalloc()
1791 bvs->nr_vecs * sizeof(struct bio_vec), 0, in init_bio()