diff options
| -rw-r--r-- | include/linux/bio.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index f53568c5852e..0942765cf8c0 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -173,6 +173,24 @@ struct bio { | |||
| 173 | 173 | ||
| 174 | #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) | 174 | #define BIO_RW_SYNC (BIO_RW_SYNCIO | BIO_RW_UNPLUG) |
| 175 | 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) | ||
| 193 | |||
| 176 | /* | 194 | /* |
| 177 | * 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 |
| 178 | */ | 196 | */ |
| @@ -196,16 +214,6 @@ struct bio { | |||
| 196 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 214 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
| 197 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 215 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) |
| 198 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 216 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
| 199 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) | ||
| 200 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNCIO)) | ||
| 201 | #define bio_unplug(bio) ((bio)->bi_rw & (1 << BIO_RW_UNPLUG)) | ||
| 202 | #define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV)) | ||
| 203 | #define bio_failfast_transport(bio) \ | ||
| 204 | ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT)) | ||
| 205 | #define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER)) | ||
| 206 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | ||
| 207 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | ||
| 208 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) | ||
| 209 | #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)) |
| 210 | 218 | ||
| 211 | static inline unsigned int bio_cur_sectors(struct bio *bio) | 219 | static inline unsigned int bio_cur_sectors(struct bio *bio) |
