* [PATCH 0/3] blk-mq ->queue_rq error return fixes
@ 2014-02-11 16:27 Christoph Hellwig
2014-02-11 16:27 ` [PATCH 1/3] blk-mq: dont assume rq->errors is set when returning an error from ->queue_rq Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:27 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] blk-mq: dont assume rq->errors is set when returning an error from ->queue_rq
2014-02-11 16:27 [PATCH 0/3] blk-mq ->queue_rq error return fixes Christoph Hellwig
@ 2014-02-11 16:27 ` Christoph Hellwig
2014-02-11 16:27 ` [PATCH 2/3] blk-mq: pair blk_mq_start_request / blk_mq_requeue_request Christoph Hellwig
2014-02-11 16:27 ` [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series Christoph Hellwig
2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:27 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
[-- Attachment #1: 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch --]
[-- Type: text/plain, Size: 903 bytes --]
rq->errors never has been part of the communication protocol between drivers
and the block stack and most drivers will not have initialized it.
Return -EIO to upper layers when the driver returns BLK_MQ_RQ_QUEUE_ERROR
unconditionally. If a driver want to return a different error it can easily
do so by returning success after calling blk_mq_end_io itself.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-mq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index a59b056..0480710 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -605,8 +605,8 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
break;
default:
pr_err("blk-mq: bad return on queue: %d\n", ret);
- rq->errors = -EIO;
case BLK_MQ_RQ_QUEUE_ERROR:
+ rq->errors = -EIO;
blk_mq_end_io(rq, rq->errors);
break;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] blk-mq: pair blk_mq_start_request / blk_mq_requeue_request
2014-02-11 16:27 [PATCH 0/3] blk-mq ->queue_rq error return fixes Christoph Hellwig
2014-02-11 16:27 ` [PATCH 1/3] blk-mq: dont assume rq->errors is set when returning an error from ->queue_rq Christoph Hellwig
@ 2014-02-11 16:27 ` Christoph Hellwig
2014-02-11 16:27 ` [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series Christoph Hellwig
2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:27 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
[-- Attachment #1: 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch --]
[-- Type: text/plain, Size: 3102 bytes --]
Make sure we have a proper pairing between starting and requeueing
requests. Move the dma drain and REQ_END setup into blk_mq_start_request,
and make sure blk_mq_requeue_request properly undoes them, giving us
a pair of function to prepare and unprepare a request without leaving
side effects.
Together this ensures we always clean up properly after
BLK_MQ_RQ_QUEUE_BUSY returns from ->queue_rq.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-mq.c | 49 ++++++++++++++++++++++++++-----------------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 0480710..1fa9dd1 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -377,7 +377,7 @@ void blk_mq_complete_request(struct request *rq)
}
EXPORT_SYMBOL(blk_mq_complete_request);
-static void blk_mq_start_request(struct request *rq)
+static void blk_mq_start_request(struct request *rq, bool last)
{
struct request_queue *q = rq->q;
@@ -390,6 +390,25 @@ static void blk_mq_start_request(struct request *rq)
*/
rq->deadline = jiffies + q->rq_timeout;
set_bit(REQ_ATOM_STARTED, &rq->atomic_flags);
+
+ 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++;
+ }
+
+ /*
+ * Flag the last request in the series so that drivers know when IO
+ * should be kicked off, if they don't do it on a per-request basis.
+ *
+ * Note: the flag isn't the only condition drivers should do kick off.
+ * If drive is busy, the last request might not have the bit set.
+ */
+ if (last)
+ rq->cmd_flags |= REQ_END;
}
static void blk_mq_requeue_request(struct request *rq)
@@ -398,6 +417,11 @@ static void blk_mq_requeue_request(struct request *rq)
trace_block_rq_requeue(q, rq);
clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags);
+
+ rq->cmd_flags &= ~REQ_END;
+
+ if (q->dma_drain_size && blk_rq_bytes(rq))
+ rq->nr_phys_segments--;
}
struct blk_mq_timeout_data {
@@ -565,29 +589,8 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
rq = list_first_entry(&rq_list, struct request, queuelist);
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,
- * if they don't do it on a per-request basis.
- *
- * Note: the flag isn't the only condition drivers
- * should do kick off. If drive is busy, the last
- * request might not have the bit set.
- */
- if (list_empty(&rq_list))
- rq->cmd_flags |= REQ_END;
+ blk_mq_start_request(rq, list_empty(&rq_list));
ret = q->mq_ops->queue_rq(hctx, rq);
switch (ret) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series
2014-02-11 16:27 [PATCH 0/3] blk-mq ->queue_rq error return fixes Christoph Hellwig
2014-02-11 16:27 ` [PATCH 1/3] blk-mq: dont assume rq->errors is set when returning an error from ->queue_rq Christoph Hellwig
2014-02-11 16:27 ` [PATCH 2/3] blk-mq: pair blk_mq_start_request / blk_mq_requeue_request Christoph Hellwig
@ 2014-02-11 16:27 ` Christoph Hellwig
2014-02-11 16:31 ` Jens Axboe
2 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:27 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
[-- Attachment #1: series --]
[-- Type: text/plain, Size: 1 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series
2014-02-11 16:27 ` [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series Christoph Hellwig
@ 2014-02-11 16:31 ` Jens Axboe
2014-02-11 16:35 ` Christoph Hellwig
0 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2014-02-11 16:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-kernel
On Tue, Feb 11 2014, Christoph Hellwig wrote:
>
looks like the last one got botched?
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series
2014-02-11 16:31 ` Jens Axboe
@ 2014-02-11 16:35 ` Christoph Hellwig
2014-02-11 16:41 ` Jens Axboe
0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:35 UTC (permalink / raw)
To: Jens Axboe; +Cc: Christoph Hellwig, linux-kernel
On Tue, Feb 11, 2014 at 09:31:04AM -0700, Jens Axboe wrote:
> On Tue, Feb 11 2014, Christoph Hellwig wrote:
> >
>
> looks like the last one got botched?
That was quilt sending along the series file which I created by doing
ls > series
just ignore it, hopefully one day quilt and I will get along fine..
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series
2014-02-11 16:35 ` Christoph Hellwig
@ 2014-02-11 16:41 ` Jens Axboe
0 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2014-02-11 16:41 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-kernel
On Tue, Feb 11 2014, Christoph Hellwig wrote:
> On Tue, Feb 11, 2014 at 09:31:04AM -0700, Jens Axboe wrote:
> > On Tue, Feb 11 2014, Christoph Hellwig wrote:
> > >
> >
> > looks like the last one got botched?
>
> That was quilt sending along the series file which I created by doing
>
> ls > series
>
> just ignore it, hopefully one day quilt and I will get along fine..
Ignored, applied the other two, thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-02-11 16:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 16:27 [PATCH 0/3] blk-mq ->queue_rq error return fixes Christoph Hellwig
2014-02-11 16:27 ` [PATCH 1/3] blk-mq: dont assume rq->errors is set when returning an error from ->queue_rq Christoph Hellwig
2014-02-11 16:27 ` [PATCH 2/3] blk-mq: pair blk_mq_start_request / blk_mq_requeue_request Christoph Hellwig
2014-02-11 16:27 ` [PATCH 3/3] 0001-blk-mq-don-t-assume-rq-errors-is-set-when-returning-.patch 0002-blk-mq-pair-blk_mq_start_request-blk_mq_requeue_requ.patch series Christoph Hellwig
2014-02-11 16:31 ` Jens Axboe
2014-02-11 16:35 ` Christoph Hellwig
2014-02-11 16:41 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox