diff options
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 18462c5b8fff..2aa283ab062b 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -144,7 +144,7 @@ struct bio { | |||
144 | * bit 1 -- rw-ahead when set | 144 | * bit 1 -- rw-ahead when set |
145 | * bit 2 -- barrier | 145 | * bit 2 -- barrier |
146 | * Insert a serialization point in the IO queue, forcing previously | 146 | * Insert a serialization point in the IO queue, forcing previously |
147 | * submitted IO to be completed before this oen is issued. | 147 | * submitted IO to be completed before this one is issued. |
148 | * bit 3 -- synchronous I/O hint: the block layer will unplug immediately | 148 | * bit 3 -- synchronous I/O hint: the block layer will unplug immediately |
149 | * Note that this does NOT indicate that the IO itself is sync, just | 149 | * Note that this does NOT indicate that the IO itself is sync, just |
150 | * that the block layer will not postpone issue of this IO by plugging. | 150 | * that the block layer will not postpone issue of this IO by plugging. |
@@ -163,12 +163,33 @@ struct bio { | |||
163 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ | 163 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ |
164 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ | 164 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ |
165 | #define BIO_RW_BARRIER 2 | 165 | #define BIO_RW_BARRIER 2 |
166 | #define BIO_RW_SYNC 3 | 166 | #define BIO_RW_SYNCIO 3 |
167 | #define BIO_RW_META 4 | 167 | #define BIO_RW_UNPLUG 4 |
168 | #define BIO_RW_DISCARD 5 | 168 | #define BIO_RW_META 5 |
169 | #define BIO_RW_FAILFAST_DEV 6 | 169 | #define BIO_RW_DISCARD 6 |
170 | #define BIO_RW_FAILFAST_TRANSPORT 7 | 170 | #define BIO_RW_FAILFAST_DEV 7 |
171 | #define BIO_RW_FAILFAST_DRIVER 8 | 171 | #define BIO_RW_FAILFAST_TRANSPORT 8 |
172 | #define BIO_RW_FAILFAST_DRIVER 9 | ||
173 | |||
174 | #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) | ||
175 | |||
176 | #define bio_rw_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag))) | ||
177 | |||
178 | /* | ||
179 | * Old defines, these should eventually be replaced by direct usage of | ||
180 | * bio_rw_flagged() | ||
181 | */ | ||
182 | #define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER) | ||
183 | #define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO) | ||
184 | #define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG) | ||
185 | #define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV) | ||
186 | #define bio_failfast_transport(bio) \ | ||
187 | bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT) | ||
188 | #define bio_failfast_driver(bio) \ | ||
189 | bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER) | ||
190 | #define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD) | ||
191 | #define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META) | ||
192 | #define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD) | ||
172 | 193 | ||
173 | /* | 194 | /* |
174 | * upper 16 bits of bi_rw define the io priority of this bio | 195 | * upper 16 bits of bi_rw define the io priority of this bio |
@@ -193,15 +214,6 @@ struct bio { | |||
193 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 214 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
194 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 215 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) |
195 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 216 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
196 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) | ||
197 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) | ||
198 | #define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV)) | ||
199 | #define bio_failfast_transport(bio) \ | ||
200 | ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT)) | ||
201 | #define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER)) | ||
202 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | ||
203 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | ||
204 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) | ||
205 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) | 217 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) |
206 | 218 | ||
207 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 219 | static inline unsigned int bio_cur_sectors(struct bio *bio) |
@@ -312,7 +324,6 @@ struct bio_integrity_payload { | |||
312 | void *bip_buf; /* generated integrity data */ | 324 | void *bip_buf; /* generated integrity data */ |
313 | bio_end_io_t *bip_end_io; /* saved I/O completion fn */ | 325 | bio_end_io_t *bip_end_io; /* saved I/O completion fn */ |
314 | 326 | ||
315 | int bip_error; /* saved I/O error */ | ||
316 | unsigned int bip_size; | 327 | unsigned int bip_size; |
317 | 328 | ||
318 | unsigned short bip_pool; /* pool the ivec came from */ | 329 | unsigned short bip_pool; /* pool the ivec came from */ |
@@ -440,12 +451,13 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly; | |||
440 | 451 | ||
441 | #ifdef CONFIG_HIGHMEM | 452 | #ifdef CONFIG_HIGHMEM |
442 | /* | 453 | /* |
443 | * remember to add offset! and never ever reenable interrupts between a | 454 | * remember never ever reenable interrupts between a bvec_kmap_irq and |
444 | * bvec_kmap_irq and bvec_kunmap_irq!! | 455 | * bvec_kunmap_irq! |
445 | * | 456 | * |
446 | * This function MUST be inlined - it plays with the CPU interrupt flags. | 457 | * This function MUST be inlined - it plays with the CPU interrupt flags. |
447 | */ | 458 | */ |
448 | static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | 459 | static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec, |
460 | unsigned long *flags) | ||
449 | { | 461 | { |
450 | unsigned long addr; | 462 | unsigned long addr; |
451 | 463 | ||
@@ -461,7 +473,8 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
461 | return (char *) addr + bvec->bv_offset; | 473 | return (char *) addr + bvec->bv_offset; |
462 | } | 474 | } |
463 | 475 | ||
464 | static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | 476 | static __always_inline void bvec_kunmap_irq(char *buffer, |
477 | unsigned long *flags) | ||
465 | { | 478 | { |
466 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 479 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
467 | 480 | ||