diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bio.h | 16 | ||||
| -rw-r--r-- | include/linux/blk_types.h | 19 |
2 files changed, 20 insertions, 15 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 060ff695085c..e2e0bc642ed1 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -62,19 +62,19 @@ | |||
| 62 | * on highmem page vectors | 62 | * on highmem page vectors |
| 63 | */ | 63 | */ |
| 64 | #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) | 64 | #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) |
| 65 | #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx) | 65 | #define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) |
| 66 | #define bio_page(bio) bio_iovec((bio))->bv_page | 66 | #define bio_page(bio) bio_iovec((bio))->bv_page |
| 67 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 67 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
| 68 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 68 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx) |
| 69 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 69 | #define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9) |
| 70 | #define bio_end_sector(bio) ((bio)->bi_sector + bio_sectors((bio))) | 70 | #define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) |
| 71 | 71 | ||
| 72 | static inline unsigned int bio_cur_bytes(struct bio *bio) | 72 | static inline unsigned int bio_cur_bytes(struct bio *bio) |
| 73 | { | 73 | { |
| 74 | if (bio->bi_vcnt) | 74 | if (bio->bi_vcnt) |
| 75 | return bio_iovec(bio)->bv_len; | 75 | return bio_iovec(bio)->bv_len; |
| 76 | else /* dataless requests such as discard */ | 76 | else /* dataless requests such as discard */ |
| 77 | return bio->bi_size; | 77 | return bio->bi_iter.bi_size; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | static inline void *bio_data(struct bio *bio) | 80 | static inline void *bio_data(struct bio *bio) |
| @@ -108,7 +108,7 @@ static inline void *bio_data(struct bio *bio) | |||
| 108 | */ | 108 | */ |
| 109 | 109 | ||
| 110 | #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) | 110 | #define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1) |
| 111 | #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx) | 111 | #define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) |
| 112 | 112 | ||
| 113 | /* Default implementation of BIOVEC_PHYS_MERGEABLE */ | 113 | /* Default implementation of BIOVEC_PHYS_MERGEABLE */ |
| 114 | #define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ | 114 | #define __BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ |
| @@ -150,7 +150,7 @@ static inline void *bio_data(struct bio *bio) | |||
| 150 | i++) | 150 | i++) |
| 151 | 151 | ||
| 152 | #define bio_for_each_segment(bvl, bio, i) \ | 152 | #define bio_for_each_segment(bvl, bio, i) \ |
| 153 | for (i = (bio)->bi_idx; \ | 153 | for (i = (bio)->bi_iter.bi_idx; \ |
| 154 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ | 154 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ |
| 155 | i++) | 155 | i++) |
| 156 | 156 | ||
| @@ -365,7 +365,7 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx, | |||
| 365 | #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) | 365 | #define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags) |
| 366 | 366 | ||
| 367 | #define bio_kmap_irq(bio, flags) \ | 367 | #define bio_kmap_irq(bio, flags) \ |
| 368 | __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) | 368 | __bio_kmap_irq((bio), (bio)->bi_iter.bi_idx, (flags)) |
| 369 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) | 369 | #define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) |
| 370 | 370 | ||
| 371 | /* | 371 | /* |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 238ef0ed62f8..29b5b84d8a29 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h | |||
| @@ -28,13 +28,19 @@ struct bio_vec { | |||
| 28 | unsigned int bv_offset; | 28 | unsigned int bv_offset; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | struct bvec_iter { | ||
| 32 | sector_t bi_sector; /* device address in 512 byte | ||
| 33 | sectors */ | ||
| 34 | unsigned int bi_size; /* residual I/O count */ | ||
| 35 | |||
| 36 | unsigned int bi_idx; /* current index into bvl_vec */ | ||
| 37 | }; | ||
| 38 | |||
| 31 | /* | 39 | /* |
| 32 | * main unit of I/O for the block layer and lower layers (ie drivers and | 40 | * main unit of I/O for the block layer and lower layers (ie drivers and |
| 33 | * stacking drivers) | 41 | * stacking drivers) |
| 34 | */ | 42 | */ |
| 35 | struct bio { | 43 | struct bio { |
| 36 | sector_t bi_sector; /* device address in 512 byte | ||
| 37 | sectors */ | ||
| 38 | struct bio *bi_next; /* request queue link */ | 44 | struct bio *bi_next; /* request queue link */ |
| 39 | struct block_device *bi_bdev; | 45 | struct block_device *bi_bdev; |
| 40 | unsigned long bi_flags; /* status, command, etc */ | 46 | unsigned long bi_flags; /* status, command, etc */ |
| @@ -42,16 +48,13 @@ struct bio { | |||
| 42 | * top bits priority | 48 | * top bits priority |
| 43 | */ | 49 | */ |
| 44 | 50 | ||
| 45 | unsigned short bi_vcnt; /* how many bio_vec's */ | 51 | struct bvec_iter bi_iter; |
| 46 | unsigned short bi_idx; /* current index into bvl_vec */ | ||
| 47 | 52 | ||
| 48 | /* Number of segments in this BIO after | 53 | /* Number of segments in this BIO after |
| 49 | * physical address coalescing is performed. | 54 | * physical address coalescing is performed. |
| 50 | */ | 55 | */ |
| 51 | unsigned int bi_phys_segments; | 56 | unsigned int bi_phys_segments; |
| 52 | 57 | ||
| 53 | unsigned int bi_size; /* residual I/O count */ | ||
| 54 | |||
| 55 | /* | 58 | /* |
| 56 | * To keep track of the max segment size, we account for the | 59 | * To keep track of the max segment size, we account for the |
| 57 | * sizes of the first and last mergeable segments in this bio. | 60 | * sizes of the first and last mergeable segments in this bio. |
| @@ -74,11 +77,13 @@ struct bio { | |||
| 74 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | 77 | struct bio_integrity_payload *bi_integrity; /* data integrity */ |
| 75 | #endif | 78 | #endif |
| 76 | 79 | ||
| 80 | unsigned short bi_vcnt; /* how many bio_vec's */ | ||
| 81 | |||
| 77 | /* | 82 | /* |
| 78 | * Everything starting with bi_max_vecs will be preserved by bio_reset() | 83 | * Everything starting with bi_max_vecs will be preserved by bio_reset() |
| 79 | */ | 84 | */ |
| 80 | 85 | ||
| 81 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | 86 | unsigned short bi_max_vecs; /* max bvl_vecs we can hold */ |
| 82 | 87 | ||
| 83 | atomic_t bi_cnt; /* pin count */ | 88 | atomic_t bi_cnt; /* pin count */ |
| 84 | 89 | ||
