diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2009-06-26 09:37:49 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-07-01 04:56:25 -0400 |
commit | 7878cba9f0037f5599004b03a1260b32d9050360 (patch) | |
tree | bff5e1a47b6e64e45df0428925cc6db8542cad62 /include/linux | |
parent | 6118b70b3a0b4c583439bb77600194c82f220ce3 (diff) |
block: Create bip slabs with embedded integrity vectors
This patch restores stacking ability to the block layer integrity
infrastructure by creating a set of dedicated bip slabs. Each bip slab
has an embedded bio_vec array at the end. This cuts down on memory
allocations and also simplifies the code compared to the original bvec
version. Only the largest bip slab is backed by a mempool. The pool is
contained in the bio_set so stacking drivers can ensure forward
progress.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@carl.(none)>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 2a04eb54c0dd..2892b710771c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -319,7 +319,6 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
319 | */ | 319 | */ |
320 | struct bio_integrity_payload { | 320 | struct bio_integrity_payload { |
321 | struct bio *bip_bio; /* parent bio */ | 321 | struct bio *bip_bio; /* parent bio */ |
322 | struct bio_vec *bip_vec; /* integrity data vector */ | ||
323 | 322 | ||
324 | sector_t bip_sector; /* virtual start sector */ | 323 | sector_t bip_sector; /* virtual start sector */ |
325 | 324 | ||
@@ -328,11 +327,12 @@ struct bio_integrity_payload { | |||
328 | 327 | ||
329 | unsigned int bip_size; | 328 | unsigned int bip_size; |
330 | 329 | ||
331 | unsigned short bip_pool; /* pool the ivec came from */ | 330 | unsigned short bip_slab; /* slab the bip came from */ |
332 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ | 331 | unsigned short bip_vcnt; /* # of integrity bio_vecs */ |
333 | unsigned short bip_idx; /* current bip_vec index */ | 332 | unsigned short bip_idx; /* current bip_vec index */ |
334 | 333 | ||
335 | struct work_struct bip_work; /* I/O completion */ | 334 | struct work_struct bip_work; /* I/O completion */ |
335 | struct bio_vec bip_vec[0]; /* embedded bvec array */ | ||
336 | }; | 336 | }; |
337 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 337 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
338 | 338 | ||
@@ -430,6 +430,9 @@ struct bio_set { | |||
430 | unsigned int front_pad; | 430 | unsigned int front_pad; |
431 | 431 | ||
432 | mempool_t *bio_pool; | 432 | mempool_t *bio_pool; |
433 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
434 | mempool_t *bio_integrity_pool; | ||
435 | #endif | ||
433 | mempool_t *bvec_pool; | 436 | mempool_t *bvec_pool; |
434 | }; | 437 | }; |
435 | 438 | ||
@@ -634,8 +637,9 @@ static inline struct bio *bio_list_get(struct bio_list *bl) | |||
634 | 637 | ||
635 | #define bio_integrity(bio) (bio->bi_integrity != NULL) | 638 | #define bio_integrity(bio) (bio->bi_integrity != NULL) |
636 | 639 | ||
640 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | ||
637 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); | 641 | extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); |
638 | extern void bio_integrity_free(struct bio *); | 642 | extern void bio_integrity_free(struct bio *, struct bio_set *); |
639 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); | 643 | extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); |
640 | extern int bio_integrity_enabled(struct bio *bio); | 644 | extern int bio_integrity_enabled(struct bio *bio); |
641 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); | 645 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); |
@@ -645,21 +649,27 @@ extern void bio_integrity_endio(struct bio *, int); | |||
645 | extern void bio_integrity_advance(struct bio *, unsigned int); | 649 | extern void bio_integrity_advance(struct bio *, unsigned int); |
646 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); | 650 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); |
647 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); | 651 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); |
648 | extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t); | 652 | extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *); |
653 | extern int bioset_integrity_create(struct bio_set *, int); | ||
654 | extern void bioset_integrity_free(struct bio_set *); | ||
655 | extern void bio_integrity_init(void); | ||
649 | 656 | ||
650 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | 657 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
651 | 658 | ||
652 | #define bio_integrity(a) (0) | 659 | #define bio_integrity(a) (0) |
660 | #define bioset_integrity_create(a, b) (0) | ||
653 | #define bio_integrity_prep(a) (0) | 661 | #define bio_integrity_prep(a) (0) |
654 | #define bio_integrity_enabled(a) (0) | 662 | #define bio_integrity_enabled(a) (0) |
655 | #define bio_integrity_clone(a, b, c) (0) | 663 | #define bio_integrity_clone(a, b, c, d) (0) |
656 | #define bio_integrity_free(a) do { } while (0) | 664 | #define bioset_integrity_free(a) do { } while (0) |
665 | #define bio_integrity_free(a, b) do { } while (0) | ||
657 | #define bio_integrity_endio(a, b) do { } while (0) | 666 | #define bio_integrity_endio(a, b) do { } while (0) |
658 | #define bio_integrity_advance(a, b) do { } while (0) | 667 | #define bio_integrity_advance(a, b) do { } while (0) |
659 | #define bio_integrity_trim(a, b, c) do { } while (0) | 668 | #define bio_integrity_trim(a, b, c) do { } while (0) |
660 | #define bio_integrity_split(a, b, c) do { } while (0) | 669 | #define bio_integrity_split(a, b, c) do { } while (0) |
661 | #define bio_integrity_set_tag(a, b, c) do { } while (0) | 670 | #define bio_integrity_set_tag(a, b, c) do { } while (0) |
662 | #define bio_integrity_get_tag(a, b, c) do { } while (0) | 671 | #define bio_integrity_get_tag(a, b, c) do { } while (0) |
672 | #define bio_integrity_init(a) do { } while (0) | ||
663 | 673 | ||
664 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 674 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
665 | 675 | ||