diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-01-06 03:21:49 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-01-30 06:34:37 -0500 |
commit | 1dfa17f4ab8543d82caf4d36636b93916a18f456 (patch) | |
tree | bce24202f9f4d9b0d82cd5303dcfa5ccf4dc6886 /include/linux | |
parent | 213d9417fec62ef4c3675621b9364a667954d4dd (diff) |
block: add bio_rw_flagged() for testing bio->bi_rw
The existing functions for checking bio->bi_rw are badly named. So lets
mirror what we do for bio->bi_flags testing, use a properly named
function so that it's immediately obvious what is being tested.
Maintain compatability names for the old macros, eventually we'll get
rid of these.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux')
-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) |