diff options
Diffstat (limited to 'include/linux/bio.h')
| -rw-r--r-- | include/linux/bio.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 089a8bc55dd4..4da441337d6e 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
| @@ -176,13 +176,28 @@ struct bio { | |||
| 176 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 176 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
| 177 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 177 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) |
| 178 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 178 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
| 179 | #define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9) | ||
| 180 | #define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio))) | ||
| 181 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) | 179 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) |
| 182 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) | 180 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) |
| 183 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) | 181 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) |
| 184 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | 182 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) |
| 185 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | 183 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) |
| 184 | #define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) | ||
| 185 | |||
| 186 | static inline unsigned int bio_cur_sectors(struct bio *bio) | ||
| 187 | { | ||
| 188 | if (bio->bi_vcnt) | ||
| 189 | return bio_iovec(bio)->bv_len >> 9; | ||
| 190 | |||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | |||
| 194 | static inline void *bio_data(struct bio *bio) | ||
| 195 | { | ||
| 196 | if (bio->bi_vcnt) | ||
| 197 | return page_address(bio_page(bio)) + bio_offset(bio); | ||
| 198 | |||
| 199 | return NULL; | ||
| 200 | } | ||
| 186 | 201 | ||
| 187 | /* | 202 | /* |
| 188 | * will die | 203 | * will die |
