aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h57
1 files changed, 34 insertions, 23 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 18462c5b8fff..d8bd43bfdcf5 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,31 @@ 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_flagged(bio, flag) ((bio)->bi_rw & (1 << (flag)))
175
176/*
177 * Old defines, these should eventually be replaced by direct usage of
178 * bio_rw_flagged()
179 */
180#define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER)
181#define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO)
182#define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG)
183#define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV)
184#define bio_failfast_transport(bio) \
185 bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT)
186#define bio_failfast_driver(bio) \
187 bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
188#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
189#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
190#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
172 191
173/* 192/*
174 * upper 16 bits of bi_rw define the io priority of this bio 193 * upper 16 bits of bi_rw define the io priority of this bio
@@ -193,15 +212,6 @@ struct bio {
193#define bio_offset(bio) bio_iovec((bio))->bv_offset 212#define bio_offset(bio) bio_iovec((bio))->bv_offset
194#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 213#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
195#define bio_sectors(bio) ((bio)->bi_size >> 9) 214#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)) 215#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
206 216
207static inline unsigned int bio_cur_sectors(struct bio *bio) 217static inline unsigned int bio_cur_sectors(struct bio *bio)
@@ -312,7 +322,6 @@ struct bio_integrity_payload {
312 void *bip_buf; /* generated integrity data */ 322 void *bip_buf; /* generated integrity data */
313 bio_end_io_t *bip_end_io; /* saved I/O completion fn */ 323 bio_end_io_t *bip_end_io; /* saved I/O completion fn */
314 324
315 int bip_error; /* saved I/O error */
316 unsigned int bip_size; 325 unsigned int bip_size;
317 326
318 unsigned short bip_pool; /* pool the ivec came from */ 327 unsigned short bip_pool; /* pool the ivec came from */
@@ -440,12 +449,13 @@ extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
440 449
441#ifdef CONFIG_HIGHMEM 450#ifdef CONFIG_HIGHMEM
442/* 451/*
443 * remember to add offset! and never ever reenable interrupts between a 452 * remember never ever reenable interrupts between a bvec_kmap_irq and
444 * bvec_kmap_irq and bvec_kunmap_irq!! 453 * bvec_kunmap_irq!
445 * 454 *
446 * This function MUST be inlined - it plays with the CPU interrupt flags. 455 * This function MUST be inlined - it plays with the CPU interrupt flags.
447 */ 456 */
448static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) 457static __always_inline char *bvec_kmap_irq(struct bio_vec *bvec,
458 unsigned long *flags)
449{ 459{
450 unsigned long addr; 460 unsigned long addr;
451 461
@@ -461,7 +471,8 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
461 return (char *) addr + bvec->bv_offset; 471 return (char *) addr + bvec->bv_offset;
462} 472}
463 473
464static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) 474static __always_inline void bvec_kunmap_irq(char *buffer,
475 unsigned long *flags)
465{ 476{
466 unsigned long ptr = (unsigned long) buffer & PAGE_MASK; 477 unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
467 478
@@ -520,7 +531,7 @@ extern void bio_integrity_endio(struct bio *, int);
520extern void bio_integrity_advance(struct bio *, unsigned int); 531extern void bio_integrity_advance(struct bio *, unsigned int);
521extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); 532extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
522extern void bio_integrity_split(struct bio *, struct bio_pair *, int); 533extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
523extern int bio_integrity_clone(struct bio *, struct bio *, struct bio_set *); 534extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *);
524extern int bioset_integrity_create(struct bio_set *, int); 535extern int bioset_integrity_create(struct bio_set *, int);
525extern void bioset_integrity_free(struct bio_set *); 536extern void bioset_integrity_free(struct bio_set *);
526extern void bio_integrity_init_slab(void); 537extern void bio_integrity_init_slab(void);
@@ -531,7 +542,7 @@ extern void bio_integrity_init_slab(void);
531#define bioset_integrity_create(a, b) (0) 542#define bioset_integrity_create(a, b) (0)
532#define bio_integrity_prep(a) (0) 543#define bio_integrity_prep(a) (0)
533#define bio_integrity_enabled(a) (0) 544#define bio_integrity_enabled(a) (0)
534#define bio_integrity_clone(a, b, c) (0) 545#define bio_integrity_clone(a, b, c,d ) (0)
535#define bioset_integrity_free(a) do { } while (0) 546#define bioset_integrity_free(a) do { } while (0)
536#define bio_integrity_free(a, b) do { } while (0) 547#define bio_integrity_free(a, b) do { } while (0)
537#define bio_integrity_endio(a, b) do { } while (0) 548#define bio_integrity_endio(a, b) do { } while (0)