* [PATCH 0/4] blk-mq ->queue_rq error return fixes
@ 2014-02-11 16:26 Christoph Hellwig
2014-02-11 16:26 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Christoph Hellwig @ 2014-02-11 16:26 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig @ 2014-02-11 16:26 ` Christoph Hellwig 2014-02-11 16:26 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2014-02-11 16:26 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel [-- 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 [flat|nested] 6+ messages in thread
* [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig 2014-02-11 16:26 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig @ 2014-02-11 16:26 ` Christoph Hellwig 2014-02-11 16:26 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2014-02-11 16:26 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel [-- 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 [flat|nested] 6+ messages in thread
* [PATCH 3/4] blk-mq: handle dma_drain_size 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig 2014-02-11 16:26 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig 2014-02-11 16:26 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig @ 2014-02-11 16:26 ` Christoph Hellwig 2014-02-11 16:26 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig 2014-02-11 16:28 ` [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig 4 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2014-02-11 16:26 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel [-- 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 [flat|nested] 6+ messages in thread
* [PATCH 4/4] blk-mq: initialize sg_reserved_size 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig ` (2 preceding siblings ...) 2014-02-11 16:26 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig @ 2014-02-11 16:26 ` Christoph Hellwig 2014-02-11 16:28 ` [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig 4 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2014-02-11 16:26 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel [-- 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 [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] blk-mq ->queue_rq error return fixes 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig ` (3 preceding siblings ...) 2014-02-11 16:26 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig @ 2014-02-11 16:28 ` Christoph Hellwig 4 siblings, 0 replies; 6+ messages in thread From: Christoph Hellwig @ 2014-02-11 16:28 UTC (permalink / raw) To: Jens Axboe; +Cc: linux-kernel sorry, this was a resend of an older series, ignore it. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-11 16:28 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-02-11 16:26 [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig 2014-02-11 16:26 ` [PATCH 1/4] blk-mq: support at_head inserations for blk_execute_rq Christoph Hellwig 2014-02-11 16:26 ` [PATCH 2/4] blk-mq: divert __blk_put_request for MQ ops Christoph Hellwig 2014-02-11 16:26 ` [PATCH 3/4] blk-mq: handle dma_drain_size Christoph Hellwig 2014-02-11 16:26 ` [PATCH 4/4] blk-mq: initialize sg_reserved_size Christoph Hellwig 2014-02-11 16:28 ` [PATCH 0/4] blk-mq ->queue_rq error return fixes Christoph Hellwig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®