aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2008-12-10 09:35:05 -0500
committerJens Axboe <jens.axboe@oracle.com>2008-12-29 02:29:23 -0500
commitbb799ca0202a360fa74d5f17039b9100caebdde7 (patch)
tree048b6cedfd2644edd82a606db6d9e8b19d31328b /include/linux/bio.h
parent1b4344986926da324b5cd10b683e5a1a5e1b7db3 (diff)
bio: allow individual slabs in the bio_set
Instead of having a global bio slab cache, add a reference to one in each bio_set that is created. This allows for personalized slabs in each bio_set, so that they can have bios of different sizes. This means we can personalize the bios we return. File systems may want to embed the bio inside another structure, to avoid allocation more items (and stuffing them in ->bi_private) after the get a bio. Or we may want to embed a number of bio_vecs directly at the end of a bio, to avoid doing two allocations to return a bio. This is now possible. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 9340098d75dc..4b80d3537f97 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -334,7 +334,7 @@ struct bio_pair {
334extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); 334extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
335extern void bio_pair_release(struct bio_pair *dbio); 335extern void bio_pair_release(struct bio_pair *dbio);
336 336
337extern struct bio_set *bioset_create(int, int); 337extern struct bio_set *bioset_create(unsigned int, unsigned int);
338extern void bioset_free(struct bio_set *); 338extern void bioset_free(struct bio_set *);
339 339
340extern struct bio *bio_alloc(gfp_t, int); 340extern struct bio *bio_alloc(gfp_t, int);
@@ -379,6 +379,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *,
379extern int bio_uncopy_user(struct bio *); 379extern int bio_uncopy_user(struct bio *);
380void zero_fill_bio(struct bio *bio); 380void zero_fill_bio(struct bio *bio);
381extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 381extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
382extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int);
382extern unsigned int bvec_nr_vecs(unsigned short idx); 383extern unsigned int bvec_nr_vecs(unsigned short idx);
383 384
384/* 385/*
@@ -401,6 +402,8 @@ static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu)
401 402
402struct bio_set { 403struct bio_set {
403 struct kmem_cache *bio_slab; 404 struct kmem_cache *bio_slab;
405 unsigned int front_pad;
406
404 mempool_t *bio_pool; 407 mempool_t *bio_pool;
405#if defined(CONFIG_BLK_DEV_INTEGRITY) 408#if defined(CONFIG_BLK_DEV_INTEGRITY)
406 mempool_t *bio_integrity_pool; 409 mempool_t *bio_integrity_pool;
@@ -415,6 +418,7 @@ struct biovec_slab {
415}; 418};
416 419
417extern struct bio_set *fs_bio_set; 420extern struct bio_set *fs_bio_set;
421extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
418 422
419/* 423/*
420 * a small number of entries is fine, not going to be performance critical. 424 * a small number of entries is fine, not going to be performance critical.