diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-10-12 18:29:33 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:15:27 -0400 |
commit | 9f060e2231ca96ca94f2ffcff730acd72606b280 (patch) | |
tree | 4818da8b59010493810e04d7a6273707875dc73c /include/linux/bio.h | |
parent | 6fda981cafbf908acd11e1e636fec50e99d56a47 (diff) |
block: Convert integrity to bvec_alloc_bs()
This adds a pointer to the bvec array to struct bio_integrity_payload,
instead of the bvecs always being inline; then the bvecs are allocated
with bvec_alloc_bs().
Changed bvec_alloc_bs() and bvec_free_bs() to take a pointer to a
mempool instead of the bioset, so that bio integrity can use a different
mempool for its bvecs, and thus avoid a potential deadlock.
This is eventually for immutable bio vecs - immutable bvecs aren't
useful if we still have to copy them, hence the need for the pointer.
Less code is always nice too, though.
Also, bio_integrity_alloc() was using fs_bio_set if no bio_set was
specified. This was wrong - using the bio_set doesn't protect us from
memory allocation failures, because we just used kmalloc for the
bio_integrity_payload. But it does introduce the possibility of
deadlock, if for some reason we weren't supposed to be using fs_bio_set.
Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 81004fdcc277..669b1cb18fee 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -213,6 +213,7 @@ extern void bio_pair_release(struct bio_pair *dbio); | |||
213 | 213 | ||
214 | extern struct bio_set *bioset_create(unsigned int, unsigned int); | 214 | extern struct bio_set *bioset_create(unsigned int, unsigned int); |
215 | extern void bioset_free(struct bio_set *); | 215 | extern void bioset_free(struct bio_set *); |
216 | extern mempool_t *biovec_create_pool(struct bio_set *bs, int pool_entries); | ||
216 | 217 | ||
217 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); | 218 | extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); |
218 | extern void bio_put(struct bio *); | 219 | extern void bio_put(struct bio *); |
@@ -288,8 +289,8 @@ extern struct bio *bio_copy_user_iov(struct request_queue *, | |||
288 | int, int, gfp_t); | 289 | int, int, gfp_t); |
289 | extern int bio_uncopy_user(struct bio *); | 290 | extern int bio_uncopy_user(struct bio *); |
290 | void zero_fill_bio(struct bio *bio); | 291 | void zero_fill_bio(struct bio *bio); |
291 | extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); | 292 | extern struct bio_vec *bvec_alloc(gfp_t, int, unsigned long *, mempool_t *); |
292 | extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int); | 293 | extern void bvec_free(mempool_t *, struct bio_vec *, unsigned int); |
293 | extern unsigned int bvec_nr_vecs(unsigned short idx); | 294 | extern unsigned int bvec_nr_vecs(unsigned short idx); |
294 | 295 | ||
295 | #ifdef CONFIG_BLK_CGROUP | 296 | #ifdef CONFIG_BLK_CGROUP |
@@ -511,10 +512,11 @@ struct bio_set { | |||
511 | unsigned int front_pad; | 512 | unsigned int front_pad; |
512 | 513 | ||
513 | mempool_t *bio_pool; | 514 | mempool_t *bio_pool; |
515 | mempool_t *bvec_pool; | ||
514 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | 516 | #if defined(CONFIG_BLK_DEV_INTEGRITY) |
515 | mempool_t *bio_integrity_pool; | 517 | mempool_t *bio_integrity_pool; |
518 | mempool_t *bvec_integrity_pool; | ||
516 | #endif | 519 | #endif |
517 | mempool_t *bvec_pool; | ||
518 | 520 | ||
519 | /* | 521 | /* |
520 | * Deadlock avoidance for stacking block drivers: see comments in | 522 | * Deadlock avoidance for stacking block drivers: see comments in |