diff options
Diffstat (limited to 'include/linux/bio.h')
| -rw-r--r-- | include/linux/bio.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 7b214fd672a2..2892b710771c 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -218,12 +218,12 @@ struct bio { | |||
| 218 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 218 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
| 219 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) | 219 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) |
| 220 | 220 | ||
| 221 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 221 | static inline unsigned int bio_cur_bytes(struct bio *bio) |
| 222 | { | 222 | { |
| 223 | if (bio->bi_vcnt) | 223 | if (bio->bi_vcnt) |
| 224 | return bio_iovec(bio)->bv_len >> 9; | 224 | return bio_iovec(bio)->bv_len; |
| 225 | else /* dataless requests such as discard */ | 225 | else /* dataless requests such as discard */ |
| 226 | return bio->bi_size >> 9; | 226 | return bio->bi_size; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | static inline void *bio_data(struct bio *bio) | 229 | static inline void *bio_data(struct bio *bio) |
| @@ -279,7 +279,7 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
| 279 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ | 279 | #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ |
| 280 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) | 280 | (((addr1) | (mask)) == (((addr2) - 1) | (mask))) |
| 281 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ | 281 | #define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ |
| 282 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask) | 282 | __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q))) |
| 283 | #define BIO_SEG_BOUNDARY(q, b1, b2) \ | 283 | #define BIO_SEG_BOUNDARY(q, b1, b2) \ |
| 284 | BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) | 284 | BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) |
| 285 | 285 | ||
| @@ -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 | ||
| @@ -506,7 +509,7 @@ static inline int bio_has_data(struct bio *bio) | |||
| 506 | } | 509 | } |
| 507 | 510 | ||
| 508 | /* | 511 | /* |
| 509 | * BIO list managment for use by remapping drivers (e.g. DM or MD). | 512 | * BIO list management for use by remapping drivers (e.g. DM or MD) and loop. |
| 510 | * | 513 | * |
| 511 | * A bio_list anchors a singly-linked list of bios chained through the bi_next | 514 | * A bio_list anchors a singly-linked list of bios chained through the bi_next |
| 512 | * member of the bio. The bio_list also caches the last list member to allow | 515 | * member of the bio. The bio_list also caches the last list member to allow |
| @@ -590,6 +593,11 @@ static inline void bio_list_merge_head(struct bio_list *bl, | |||
| 590 | bl->head = bl2->head; | 593 | bl->head = bl2->head; |
| 591 | } | 594 | } |
| 592 | 595 | ||
| 596 | static inline struct bio *bio_list_peek(struct bio_list *bl) | ||
| 597 | { | ||
| 598 | return bl->head; | ||
| 599 | } | ||
| 600 | |||
| 593 | static inline struct bio *bio_list_pop(struct bio_list *bl) | 601 | static inline struct bio *bio_list_pop(struct bio_list *bl) |
| 594 | { | 602 | { |
| 595 | struct bio *bio = bl->head; | 603 | struct bio *bio = bl->head; |
| @@ -629,8 +637,9 @@ static inline struct bio *bio_list_get(struct bio_list *bl) | |||
| 629 | 637 | ||
| 630 | #define bio_integrity(bio) (bio->bi_integrity != NULL) | 638 | #define bio_integrity(bio) (bio->bi_integrity != NULL) |
| 631 | 639 | ||
| 640 | extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); | ||
| 632 | 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); |
| 633 | extern void bio_integrity_free(struct bio *); | 642 | extern void bio_integrity_free(struct bio *, struct bio_set *); |
| 634 | 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); |
| 635 | extern int bio_integrity_enabled(struct bio *bio); | 644 | extern int bio_integrity_enabled(struct bio *bio); |
| 636 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); | 645 | extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); |
| @@ -640,21 +649,27 @@ extern void bio_integrity_endio(struct bio *, int); | |||
| 640 | extern void bio_integrity_advance(struct bio *, unsigned int); | 649 | extern void bio_integrity_advance(struct bio *, unsigned int); |
| 641 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); | 650 | extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); |
| 642 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); | 651 | extern void bio_integrity_split(struct bio *, struct bio_pair *, int); |
| 643 | 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); | ||
| 644 | 656 | ||
| 645 | #else /* CONFIG_BLK_DEV_INTEGRITY */ | 657 | #else /* CONFIG_BLK_DEV_INTEGRITY */ |
| 646 | 658 | ||
| 647 | #define bio_integrity(a) (0) | 659 | #define bio_integrity(a) (0) |
| 660 | #define bioset_integrity_create(a, b) (0) | ||
| 648 | #define bio_integrity_prep(a) (0) | 661 | #define bio_integrity_prep(a) (0) |
| 649 | #define bio_integrity_enabled(a) (0) | 662 | #define bio_integrity_enabled(a) (0) |
| 650 | #define bio_integrity_clone(a, b, c) (0) | 663 | #define bio_integrity_clone(a, b, c, d) (0) |
| 651 | #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) | ||
| 652 | #define bio_integrity_endio(a, b) do { } while (0) | 666 | #define bio_integrity_endio(a, b) do { } while (0) |
| 653 | #define bio_integrity_advance(a, b) do { } while (0) | 667 | #define bio_integrity_advance(a, b) do { } while (0) |
| 654 | #define bio_integrity_trim(a, b, c) do { } while (0) | 668 | #define bio_integrity_trim(a, b, c) do { } while (0) |
| 655 | #define bio_integrity_split(a, b, c) do { } while (0) | 669 | #define bio_integrity_split(a, b, c) do { } while (0) |
| 656 | #define bio_integrity_set_tag(a, b, c) do { } while (0) | 670 | #define bio_integrity_set_tag(a, b, c) do { } while (0) |
| 657 | #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) | ||
| 658 | 673 | ||
| 659 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ | 674 | #endif /* CONFIG_BLK_DEV_INTEGRITY */ |
| 660 | 675 | ||
