ANDROID: block: Introduce the blk_rq_is_seq_zone_write() function
Introduce a function that makes it easy to verify whether a write request is for a sequential write required or sequential write preferred zone. Simplify blk_req_needs_zone_write_lock() by using the new function. Bug: 264714656 Change-Id: I24677065f0c3b63900a885da5b4c8ea4ba0fb14c Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
@@ -1020,6 +1020,25 @@ 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_zone_write() - Whether @rq is a write request for a sequential zone.
|
||||
* @rq: Request to examine.
|
||||
*
|
||||
* In this context sequential zone means either a sequential write required or
|
||||
* to a sequential write preferred zone.
|
||||
*/
|
||||
static inline bool blk_rq_is_seq_zone_write(struct request *rq)
|
||||
{
|
||||
switch (req_op(rq)) {
|
||||
case REQ_OP_WRITE_ZEROES:
|
||||
case REQ_OP_WRITE_SAME:
|
||||
case REQ_OP_WRITE:
|
||||
return blk_rq_zone_is_seq(rq);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BLK_DEV_ZONED */
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user