* [PATCH 0/4] minor blk-mq updates
@ 2014-02-07 18:22 Christoph Hellwig
2014-02-07 18:22 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-02-07 18:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, linux-scsi
Hi Jens,
these small blk-mq core updates fell out of the scsi multiqueue work.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
@ 2014-02-07 18:22 ` Christoph Hellwig
2014-02-07 18:22 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-02-07 18:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, linux-scsi
[-- Attachment #1: 0001-blk-mq-support-at_head-inserations-for-blk_execute_r.patch --]
[-- Type: text/plain, Size: 3495 bytes --]
This is neede for proper SG_IO operation as well as various uses of
blk_execute_rq from the SCSI midlayer.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-exec.c | 2 +-
block/blk-mq.c | 17 ++++++++++-------
include/linux/blk-mq.h | 3 ++-
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/block/blk-exec.c b/block/blk-exec.c
index bbfc072..c68613b 100644
--- a/block/blk-exec.c
+++ b/block/blk-exec.c
@@ -65,7 +65,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
* be resued after dying flag is set
*/
if (q->mq_ops) {
- blk_mq_insert_request(q, rq, true);
+ blk_mq_insert_request(q, rq, at_head, true);
return;
}
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 57039fc..40fc4dd 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -693,13 +693,16 @@ static void blk_mq_work_fn(struct work_struct *work)
}
static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx,
- struct request *rq)
+ struct request *rq, bool at_head)
{
struct blk_mq_ctx *ctx = rq->mq_ctx;
trace_block_rq_insert(hctx->queue, rq);
- list_add_tail(&rq->queuelist, &ctx->rq_list);
+ if (at_head)
+ list_add(&rq->queuelist, &ctx->rq_list);
+ else
+ list_add_tail(&rq->queuelist, &ctx->rq_list);
blk_mq_hctx_mark_pending(hctx, ctx);
/*
@@ -709,7 +712,7 @@ static void __blk_mq_insert_request(struct blk_mq_hw_ctx *hctx,
}
void blk_mq_insert_request(struct request_queue *q, struct request *rq,
- bool run_queue)
+ bool at_head, bool run_queue)
{
struct blk_mq_hw_ctx *hctx;
struct blk_mq_ctx *ctx, *current_ctx;
@@ -728,7 +731,7 @@ void blk_mq_insert_request(struct request_queue *q, struct request *rq,
rq->mq_ctx = ctx;
}
spin_lock(&ctx->lock);
- __blk_mq_insert_request(hctx, rq);
+ __blk_mq_insert_request(hctx, rq, at_head);
spin_unlock(&ctx->lock);
blk_mq_put_ctx(current_ctx);
@@ -760,7 +763,7 @@ void blk_mq_run_request(struct request *rq, bool run_queue, bool async)
/* ctx->cpu might be offline */
spin_lock(&ctx->lock);
- __blk_mq_insert_request(hctx, rq);
+ __blk_mq_insert_request(hctx, rq, false);
spin_unlock(&ctx->lock);
blk_mq_put_ctx(current_ctx);
@@ -798,7 +801,7 @@ static void blk_mq_insert_requests(struct request_queue *q,
rq = list_first_entry(list, struct request, queuelist);
list_del_init(&rq->queuelist);
rq->mq_ctx = ctx;
- __blk_mq_insert_request(hctx, rq);
+ __blk_mq_insert_request(hctx, rq, false);
}
spin_unlock(&ctx->lock);
@@ -950,7 +953,7 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio)
__blk_mq_free_request(hctx, ctx, rq);
else {
blk_mq_bio_to_request(rq, bio);
- __blk_mq_insert_request(hctx, rq);
+ __blk_mq_insert_request(hctx, rq, false);
}
spin_unlock(&ctx->lock);
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index 161b231..8e6e710 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -119,7 +119,8 @@ void blk_mq_init_commands(struct request_queue *, void (*init)(void *data, struc
void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule);
-void blk_mq_insert_request(struct request_queue *, struct request *, bool);
+void blk_mq_insert_request(struct request_queue *, struct request *,
+ bool, bool);
void blk_mq_run_queues(struct request_queue *q, bool async);
void blk_mq_free_request(struct request *rq);
bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
2014-02-07 18:22 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig
@ 2014-02-07 18:22 ` Christoph Hellwig
2014-02-07 18:22 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-02-07 18:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, linux-scsi
[-- Attachment #1: 0002-blk-mq-divert-__blk_put_request-for-MQ-ops.patch --]
[-- Type: text/plain, Size: 673 bytes --]
__blk_put_request needs to call into the blk-mq code just like
blk_put_request. As we don't have the queue lock in this case both
end up calling the same function.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index c00e0bd..06636f3 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1278,6 +1278,11 @@ void __blk_put_request(struct request_queue *q, struct request *req)
if (unlikely(!q))
return;
+ if (q->mq_ops) {
+ blk_mq_free_request(req);
+ return;
+ }
+
blk_pm_put_request(req);
elv_completed_request(q, req);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] blk-mq: handle dma_drain_size
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
2014-02-07 18:22 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig
2014-02-07 18:22 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig
@ 2014-02-07 18:22 ` Christoph Hellwig
2014-02-07 18:22 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-02-07 18:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, linux-scsi
[-- Attachment #1: 0003-blk-mq-handle-dma_drain_size.patch --]
[-- Type: text/plain, Size: 876 bytes --]
Make blk-mq handle the dma_drain_size field the same way as the old request
path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-mq.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 40fc4dd..35800e1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -561,6 +561,16 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
list_del_init(&rq->queuelist);
blk_mq_start_request(rq);
+ if (q->dma_drain_size && blk_rq_bytes(rq)) {
+ /*
+ * make sure space for the drain appears we
+ * know we can do this because max_hw_segments
+ * has been adjusted to be one fewer than the
+ * device can handle
+ */
+ rq->nr_phys_segments++;
+ }
+
/*
* Last request in the series. Flag it as such, this
* enables drivers to know when IO should be kicked off,
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] blk-mq: initialize sg_reserved_size
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
` (2 preceding siblings ...)
2014-02-07 18:22 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig
@ 2014-02-07 18:22 ` Christoph Hellwig
2014-02-07 18:59 ` [PATCH 0/4] minor blk-mq updates Jens Axboe
2014-02-07 19:36 ` Nicholas A. Bellinger
5 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2014-02-07 18:22 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel, linux-scsi
[-- Attachment #1: 0004-blk-mq-initialize-sg_reserved_size.patch --]
[-- Type: text/plain, Size: 599 bytes --]
To behave the same way as the old request path.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-mq.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 35800e1..f5fcd9a 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1373,6 +1373,8 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_reg *reg,
q->mq_ops = reg->ops;
q->queue_flags |= QUEUE_FLAG_MQ_DEFAULT;
+ q->sg_reserved_size = INT_MAX;
+
blk_queue_make_request(q, blk_mq_make_request);
blk_queue_rq_timed_out(q, reg->ops->timeout);
if (reg->timeout)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] minor blk-mq updates
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
` (3 preceding siblings ...)
2014-02-07 18:22 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig
@ 2014-02-07 18:59 ` Jens Axboe
2014-02-07 19:36 ` Nicholas A. Bellinger
5 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2014-02-07 18:59 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-kernel, linux-scsi
On Fri, Feb 07 2014, Christoph Hellwig wrote:
> Hi Jens,
>
> these small blk-mq core updates fell out of the scsi multiqueue work.
Thanks, all nice and simple, applied to for-linus.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] minor blk-mq updates
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
` (4 preceding siblings ...)
2014-02-07 18:59 ` [PATCH 0/4] minor blk-mq updates Jens Axboe
@ 2014-02-07 19:36 ` Nicholas A. Bellinger
2014-02-07 20:45 ` Jens Axboe
5 siblings, 1 reply; 8+ messages in thread
From: Nicholas A. Bellinger @ 2014-02-07 19:36 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Jens Axboe, linux-kernel, linux-scsi
On Fri, 2014-02-07 at 10:22 -0800, Christoph Hellwig wrote:
> Hi Jens,
>
> these small blk-mq core updates fell out of the scsi multiqueue work.
That reminds me, the following blk-mq patch was required to get DIF
working with scsi-mq.
Jens, care to pick this up as well..?
--nab
>From 1428a390cc16025f93905852777d4afd8aeba05d Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <nab@linux-iscsi.org>
Date: Sun, 22 Dec 2013 11:58:49 +0000
Subject: blk-mq: Add bio_integrity setup to blk_mq_make_request
This patch adds the missing bio_integrity_enabled() +
bio_integrity_prep() setup into blk_mq_make_request()
in order to use DIF protection with scsi-mq.
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
---
diff --git a/block/blk-mq.c b/block/blk-mq.c
index c79126e..a520c39 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -916,6 +916,11 @@ static void blk_mq_make_request(struct request_queue *q, struct bio *bio)
blk_queue_bounce(q, &bio);
+ if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) {
+ bio_endio(bio, -EIO);
+ return;
+ }
+
if (use_plug && blk_attempt_plug_merge(q, bio, &request_count))
return;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] minor blk-mq updates
2014-02-07 19:36 ` Nicholas A. Bellinger
@ 2014-02-07 20:45 ` Jens Axboe
0 siblings, 0 replies; 8+ messages in thread
From: Jens Axboe @ 2014-02-07 20:45 UTC (permalink / raw)
To: Nicholas A. Bellinger; +Cc: Christoph Hellwig, linux-kernel, linux-scsi
On Fri, Feb 07 2014, Nicholas A. Bellinger wrote:
> On Fri, 2014-02-07 at 10:22 -0800, Christoph Hellwig wrote:
> > Hi Jens,
> >
> > these small blk-mq core updates fell out of the scsi multiqueue work.
>
> That reminds me, the following blk-mq patch was required to get DIF
> working with scsi-mq.
>
> Jens, care to pick this up as well..?
Yep, added, thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-02-07 20:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 18:22 [PATCH 0/4] minor blk-mq updates Christoph Hellwig
2014-02-07 18:22 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig
2014-02-07 18:22 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig
2014-02-07 18:22 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig
2014-02-07 18:22 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig
2014-02-07 18:59 ` [PATCH 0/4] minor blk-mq updates Jens Axboe
2014-02-07 19:36 ` Nicholas A. Bellinger
2014-02-07 20:45 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox