aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bio.h
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-11 08:32:04 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-11 08:33:31 -0400
commit1f98a13f623e0ef666690a18c1250335fc6d7ef1 (patch)
tree15ca2dddffaa18a0d1844957f4f8cc707cbb8117 /include/linux/bio.h
parente7e503aedb1f4d165081cb8d47a58c38f80f0cb4 (diff)
bio: first step in sanitizing the bio->bi_rw flag testing
Get rid of any functions that test for these bits and make callers use bio_rw_flagged() directly. Then it is at least directly apparent what variable and flag they check. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r--include/linux/bio.h25
1 files changed, 7 insertions, 18 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 4f8fd0221cd2..5be93f18d842 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -177,29 +177,18 @@ enum bio_rw_flags {
177 BIO_RW_NOIDLE, 177 BIO_RW_NOIDLE,
178}; 178};
179 179
180/*
181 * First four bits must match between bio->bi_rw and rq->cmd_flags, make
182 * that explicit here.
183 */
184#define BIO_RW_RQ_MASK 0xf
185
180static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag) 186static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
181{ 187{
182 return (bio->bi_rw & (1 << flag)) != 0; 188 return (bio->bi_rw & (1 << flag)) != 0;
183} 189}
184 190
185/* 191/*
186 * Old defines, these should eventually be replaced by direct usage of
187 * bio_rw_flagged()
188 */
189#define bio_barrier(bio) bio_rw_flagged(bio, BIO_RW_BARRIER)
190#define bio_sync(bio) bio_rw_flagged(bio, BIO_RW_SYNCIO)
191#define bio_unplug(bio) bio_rw_flagged(bio, BIO_RW_UNPLUG)
192#define bio_failfast_dev(bio) bio_rw_flagged(bio, BIO_RW_FAILFAST_DEV)
193#define bio_failfast_transport(bio) \
194 bio_rw_flagged(bio, BIO_RW_FAILFAST_TRANSPORT)
195#define bio_failfast_driver(bio) \
196 bio_rw_flagged(bio, BIO_RW_FAILFAST_DRIVER)
197#define bio_rw_ahead(bio) bio_rw_flagged(bio, BIO_RW_AHEAD)
198#define bio_rw_meta(bio) bio_rw_flagged(bio, BIO_RW_META)
199#define bio_discard(bio) bio_rw_flagged(bio, BIO_RW_DISCARD)
200#define bio_noidle(bio) bio_rw_flagged(bio, BIO_RW_NOIDLE)
201
202/*
203 * upper 16 bits of bi_rw define the io priority of this bio 192 * upper 16 bits of bi_rw define the io priority of this bio
204 */ 193 */
205#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) 194#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
@@ -222,7 +211,7 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag)
222#define bio_offset(bio) bio_iovec((bio))->bv_offset 211#define bio_offset(bio) bio_iovec((bio))->bv_offset
223#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) 212#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
224#define bio_sectors(bio) ((bio)->bi_size >> 9) 213#define bio_sectors(bio) ((bio)->bi_size >> 9)
225#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) 214#define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD))
226 215
227static inline unsigned int bio_cur_bytes(struct bio *bio) 216static inline unsigned int bio_cur_bytes(struct bio *bio)
228{ 217{