diff mbox series

[1/5] block: Introduce the blk_rq_is_seq_write() function

Message ID 20220614174943.611369-2-bvanassche@acm.org (mailing list archive)
State New, archived
Headers show
Series Improve zoned storage write performance | expand

Commit Message

Bart Van Assche June 14, 2022, 5:49 p.m. UTC
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@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/blk-mq.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Jens Axboe June 16, 2022, 8:41 p.m. UTC | #1
On 6/14/22 11:49 AM, Bart Van Assche wrote:
> 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@wdc.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  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);
> +}

This should include something telling us it's a zone thing, because it
sounds generic. blk_rq_is_zoned_seq_write()?
Bart Van Assche June 16, 2022, 9:16 p.m. UTC | #2
On 6/16/22 13:41, Jens Axboe wrote:
> On 6/14/22 11:49 AM, Bart Van Assche wrote:
>> 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@wdc.com>
>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>> ---
>>   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);
>> +}
> 
> This should include something telling us it's a zone thing, because it
> sounds generic. blk_rq_is_zoned_seq_write()?

Agreed. I will rename this function before I repost this patch series.

Thanks,

Bart.
diff mbox series

Patch

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;