diff mbox

[4/7] blk-mq: add and export helper to tell if a request is reserved

Message ID 1493391340-24629-5-git-send-email-axboe@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jens Axboe April 28, 2017, 2:55 p.m. UTC
We only have an internal helper for checking a tag value. Add
an exported helper that takes a request and hardware queue,
and check against the driver tags.

Signed-off-by: Jens Axboe <axboe@fb.com>
---
 block/blk-mq-tag.c     | 6 ++++++
 include/linux/blk-mq.h | 1 +
 2 files changed, 7 insertions(+)

Comments

Bart Van Assche April 28, 2017, 3:04 p.m. UTC | #1
On Fri, 2017-04-28 at 08:55 -0600, Jens Axboe wrote:
> We only have an internal helper for checking a tag value. Add
> an exported helper that takes a request and hardware queue,
> and check against the driver tags.
> 
> Signed-off-by: Jens Axboe <axboe@fb.com>
> ---
>  block/blk-mq-tag.c     | 6 ++++++
>  include/linux/blk-mq.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index d0be72ccb091..0a04b5c14076 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -476,3 +476,9 @@ u32 blk_mq_unique_tag(struct request *rq)
>  		(rq->tag & BLK_MQ_UNIQUE_TAG_MASK);
>  }
>  EXPORT_SYMBOL(blk_mq_unique_tag);
> +
> +bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq)
> +{
> +	return blk_mq_tag_is_reserved(hctx->tags, rq->tag);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_rq_is_reserved);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 32bd8eb5ba67..13e51520fa27 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -224,6 +224,7 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
>  	return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
>  }
>  
> +bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq);
>  
>  int blk_mq_request_started(struct request *rq);
>  void blk_mq_start_request(struct request *rq);

Hello Jens,

Have you considered to derive the hctx information from rq->mq_ctx instead of
passing hctx as an argument (hctx = blk_mq_map_queue(rq->q, rq->mq_ctx->cpu))?
Anyway, since otherwise this patch looks fine to me:

Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Ming Lei April 28, 2017, 3:22 p.m. UTC | #2
On Fri, Apr 28, 2017 at 08:55:37AM -0600, Jens Axboe wrote:
> We only have an internal helper for checking a tag value. Add
> an exported helper that takes a request and hardware queue,
> and check against the driver tags.
> 
> Signed-off-by: Jens Axboe <axboe@fb.com>
> ---
>  block/blk-mq-tag.c     | 6 ++++++
>  include/linux/blk-mq.h | 1 +
>  2 files changed, 7 insertions(+)
> 
> diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
> index d0be72ccb091..0a04b5c14076 100644
> --- a/block/blk-mq-tag.c
> +++ b/block/blk-mq-tag.c
> @@ -476,3 +476,9 @@ u32 blk_mq_unique_tag(struct request *rq)
>  		(rq->tag & BLK_MQ_UNIQUE_TAG_MASK);
>  }
>  EXPORT_SYMBOL(blk_mq_unique_tag);
> +
> +bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq)
> +{
> +	return blk_mq_tag_is_reserved(hctx->tags, rq->tag);
> +}
> +EXPORT_SYMBOL_GPL(blk_mq_rq_is_reserved);
> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index 32bd8eb5ba67..13e51520fa27 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -224,6 +224,7 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
>  	return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
>  }
>  
> +bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq);
>  
>  int blk_mq_request_started(struct request *rq);
>  void blk_mq_start_request(struct request *rq);

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming
Hannes Reinecke May 2, 2017, 6:12 a.m. UTC | #3
On 04/28/2017 04:55 PM, Jens Axboe wrote:
> We only have an internal helper for checking a tag value. Add
> an exported helper that takes a request and hardware queue,
> and check against the driver tags.
> 
> Signed-off-by: Jens Axboe <axboe@fb.com>
> ---
>  block/blk-mq-tag.c     | 6 ++++++
>  include/linux/blk-mq.h | 1 +
>  2 files changed, 7 insertions(+)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox

Patch

diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index d0be72ccb091..0a04b5c14076 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -476,3 +476,9 @@  u32 blk_mq_unique_tag(struct request *rq)
 		(rq->tag & BLK_MQ_UNIQUE_TAG_MASK);
 }
 EXPORT_SYMBOL(blk_mq_unique_tag);
+
+bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq)
+{
+	return blk_mq_tag_is_reserved(hctx->tags, rq->tag);
+}
+EXPORT_SYMBOL_GPL(blk_mq_rq_is_reserved);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 32bd8eb5ba67..13e51520fa27 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -224,6 +224,7 @@  static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag)
 	return unique_tag & BLK_MQ_UNIQUE_TAG_MASK;
 }
 
+bool blk_mq_rq_is_reserved(struct blk_mq_hw_ctx *hctx, struct request *rq);
 
 int blk_mq_request_started(struct request *rq);
 void blk_mq_start_request(struct request *rq);