History

block: introduce bio zone helpers

Introduce the helper functions bio_zone_no() and bio_zone_is_seq(). Both are the BIO counterparts of the request helpers blk_rq_zone_no() and blk_rq_zone_is_seq(), respectively returning the number of the target zone of a bio and true if the BIO target zone is sequential.

Damien Le Moal committed 5 years ago

Commit d0ea6bd1 parent 1ee533e1 file · +12 −0Browse files

Unified · Split

include/linux/blkdev.h+12−0
@@ -1008,6 +1008,18 @@ static inline unsigned int blk_rq_stats_sectors(const struct request *rq) · 1007 unmodified lines
10081008 /* Helper to convert BLK_ZONE_ZONE_XXX to its string format XXX */
10091009 const char *blk_zone_cond_str(enum blk_zone_cond zone_cond);
10101010
1011+static inline unsigned int bio_zone_no(struct bio *bio)
1012+{
1013+ return blk_queue_zone_no(bdev_get_queue(bio->bi_bdev),
1014+ bio->bi_iter.bi_sector);
1015+}
1016+
1017+static inline unsigned int bio_zone_is_seq(struct bio *bio)
1018+{
1019+ return blk_queue_zone_is_seq(bdev_get_queue(bio->bi_bdev),
1020+ bio->bi_iter.bi_sector);
1021+}
1022+
10111023 static inline unsigned int blk_rq_zone_no(struct request *rq)
10121024 {
10131025 return blk_queue_zone_no(rq->q, blk_rq_pos(rq));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t