Introduce a function that makes it easy to verify whether a write request is for a sequential write required or sequential write preferred zone. Cc: Damien Le Moal <damien.lemoal@xxxxxxx> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> --- include/linux/blk-mq.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index e2d9daf7e8dd..3e7feb48105f 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -1129,6 +1129,15 @@ static inline unsigned int blk_rq_zone_is_seq(struct request *rq) return blk_queue_zone_is_seq(rq->q, blk_rq_pos(rq)); } +/** + * blk_rq_is_seq_write() - Whether @rq is a write request for a sequential zone. + * @rq: Request to examine. + */ +static inline bool blk_rq_is_seq_write(struct request *rq) +{ + return req_op(rq) == REQ_OP_WRITE && blk_rq_zone_is_seq(rq); +} + bool blk_req_needs_zone_write_lock(struct request *rq); bool blk_req_zone_write_trylock(struct request *rq); void __blk_req_zone_write_lock(struct request *rq); @@ -1159,6 +1168,11 @@ static inline bool blk_req_can_dispatch_to_zone(struct request *rq) return !blk_req_zone_is_write_locked(rq); } #else /* CONFIG_BLK_DEV_ZONED */ +static inline bool blk_rq_is_seq_write(struct request *rq) +{ + return false; +} + static inline bool blk_req_needs_zone_write_lock(struct request *rq) { return false;