diff options
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 6a642098e5c3..18462c5b8fff 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -90,10 +90,11 @@ struct bio { | |||
90 | 90 | ||
91 | unsigned int bi_comp_cpu; /* completion CPU */ | 91 | unsigned int bi_comp_cpu; /* completion CPU */ |
92 | 92 | ||
93 | atomic_t bi_cnt; /* pin count */ | ||
94 | |||
93 | struct bio_vec *bi_io_vec; /* the actual vec list */ | 95 | struct bio_vec *bi_io_vec; /* the actual vec list */ |
94 | 96 | ||
95 | bio_end_io_t *bi_end_io; | 97 | bio_end_io_t *bi_end_io; |
96 | atomic_t bi_cnt; /* pin count */ | ||
97 | 98 | ||
98 | void *bi_private; | 99 | void *bi_private; |
99 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 100 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
@@ -101,6 +102,13 @@ struct bio { | |||
101 | #endif | 102 | #endif |
102 | 103 | ||
103 | bio_destructor_t *bi_destructor; /* destructor */ | 104 | bio_destructor_t *bi_destructor; /* destructor */ |
105 | |||
106 | /* | ||
107 | * We can inline a number of vecs at the end of the bio, to avoid | ||
108 | * double allocations for a small number of bio_vecs. This member | ||
109 | * MUST obviously be kept at the very end of the bio. | ||
110 | */ | ||
111 | struct bio_vec bi_inline_vecs[0]; | ||
104 | }; | 112 | }; |
105 | 113 | ||
106 | /* | 114 | /* |
@@ -117,6 +125,7 @@ struct bio { | |||
117 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ | 125 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ |
118 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ | 126 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ |
119 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ | 127 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ |
128 | #define BIO_QUIET 11 /* Make BIO Quiet */ | ||
120 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | 129 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) |
121 | 130 | ||
122 | /* | 131 | /* |
@@ -211,6 +220,11 @@ static inline void *bio_data(struct bio *bio) | |||
211 | return NULL; | 220 | return NULL; |
212 | } | 221 | } |
213 | 222 | ||
223 | static inline int bio_has_allocated_vec(struct bio *bio) | ||
224 | { | ||
225 | return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs; | ||
226 | } | ||
227 | |||
214 | /* | 228 | /* |
215 | * will die | 229 | * will die |
216 | */ | 230 | */ |
@@ -332,7 +346,7 @@ struct bio_pair { | |||
332 | extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); | 346 | extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); |
333 | extern void bio_pair_release(struct bio_pair *dbio); | 347 | extern void bio_pair_release(struct bio_pair *dbio); |
334 | 348 | ||
335 | extern struct bio_set *bioset_create(int, int); | 349 | extern struct bio_set *bioset_create(unsigned int, unsigned int); |
336 | extern void bioset_free(struct bio_set *); | 350 | extern void bioset_free(struct bio_set *); |
337 | 351 | ||
338 | extern struct bio *bio_alloc(gfp_t, int); | 352 | extern struct bio *bio_alloc(gfp_t, int); |
@@ -377,6 +391,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, | |||
377 | extern int bio_uncopy_user(struct bio *); | 391 | extern int bio_uncopy_user(struct bio *); |
378 | void zero_fill_bio(struct bio *bio); | 392 | void zero_fill_bio(struct bio *bio); |
379 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | 393 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); |
394 | extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int); | ||
380 | extern unsigned int bvec_nr_vecs(unsigned short idx); | 395 | extern unsigned int bvec_nr_vecs(unsigned short idx); |
381 | 396 | ||
382 | /* | 397 | /* |
@@ -395,13 +410,17 @@ static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu) | |||
395 | */ | 410 | */ |
396 | #define BIO_POOL_SIZE 2 | 411 | #define BIO_POOL_SIZE 2 |
397 | #define BIOVEC_NR_POOLS 6 | 412 | #define BIOVEC_NR_POOLS 6 |
413 | #define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1) | ||
398 | 414 | ||
399 | struct bio_set { | 415 | struct bio_set { |
416 | struct kmem_cache *bio_slab; | ||
417 | unsigned int front_pad; | ||
418 | |||
400 | mempool_t *bio_pool; | 419 | mempool_t *bio_pool; |
401 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 420 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
402 | mempool_t *bio_integrity_pool; | 421 | mempool_t *bio_integrity_pool; |
403 | #endif | 422 | #endif |
404 | mempool_t *bvec_pools[BIOVEC_NR_POOLS]; | 423 | mempool_t *bvec_pool; |
405 | }; | 424 | }; |
406 | 425 | ||
407 | struct biovec_slab { | 426 | struct biovec_slab { |
@@ -411,6 +430,7 @@ struct biovec_slab { | |||
411 | }; | 430 | }; |
412 | 431 | ||
413 | extern struct bio_set *fs_bio_set; | 432 | extern struct bio_set *fs_bio_set; |
433 | extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; | ||
414 | 434 | ||
415 | /* | 435 | /* |
416 | * a small number of entries is fine, not going to be performance critical. | 436 | * a small number of entries is fine, not going to be performance critical. |