From: Shaohua Li <shli@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org, axboe@kernel.dk
Subject: Re: [patch]blk-mq: blk_mq_tag_to_rq should handle flush request
Date: Sat, 10 May 2014 12:00:23 +0800 [thread overview]
Message-ID: <20140510040023.GA13788@kernel.org> (raw)
In-Reply-To: <20140509150018.GA26215@infradead.org>
On Fri, May 09, 2014 at 08:00:18AM -0700, Christoph Hellwig wrote:
> On Fri, May 09, 2014 at 08:07:33PM +0800, Shaohua Li wrote:
> >
> > flush request is special, which borrows tag from other request. Need a special
> > handling to get it from tag.
>
> Thanks, we probably need this one. But I think you can simply test
> REQ_FLUSH_SEQ the passed in request instead of the flush_rq_tag_valid
> flag/
fair enough. updated one.
Subject: blk-mq: blk_mq_tag_to_rq should handle flush request
flush request is special, which borrows tag from other request. Need a special
handling to get it from tag.
Signed-off-by: Shaohua Li <shli@fusionio.com>
---
block/blk-flush.c | 4 +++-
block/blk-mq.c | 8 ++++++--
drivers/block/mtip32xx/mtip32xx.c | 2 +-
include/linux/blk-mq.h | 3 ++-
4 files changed, 12 insertions(+), 5 deletions(-)
Index: linux/block/blk-flush.c
===================================================================
--- linux.orig/block/blk-flush.c 2014-05-10 11:49:21.646830000 +0800
+++ linux/block/blk-flush.c 2014-05-10 11:49:21.638830100 +0800
@@ -231,8 +231,10 @@ static void flush_end_io(struct request
struct request *rq, *n;
unsigned long flags = 0;
- if (q->mq_ops)
+ if (q->mq_ops) {
spin_lock_irqsave(&q->mq_flush_lock, flags);
+ q->flush_rq->cmd_flags = 0;
+ }
running = &q->flush_queue[q->flush_running_idx];
BUG_ON(q->flush_pending_idx == q->flush_running_idx);
Index: linux/block/blk-mq.c
===================================================================
--- linux.orig/block/blk-mq.c 2014-05-10 11:49:21.646830000 +0800
+++ linux/block/blk-mq.c 2014-05-10 11:49:21.638830100 +0800
@@ -481,8 +481,12 @@ void blk_mq_requeue_request(struct reque
}
EXPORT_SYMBOL(blk_mq_requeue_request);
-struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
+struct request *blk_mq_tag_to_rq(struct request_queue *q,
+ struct blk_mq_tags *tags, unsigned int tag)
{
+ if ((q->flush_rq->cmd_flags & REQ_FLUSH_SEQ) &&
+ q->flush_rq->tag == tag)
+ return q->flush_rq;
return tags->rqs[tag];
}
EXPORT_SYMBOL(blk_mq_tag_to_rq);
@@ -512,7 +516,7 @@ static void blk_mq_timeout_check(void *_
if (tag >= hctx->tags->nr_tags)
break;
- rq = blk_mq_tag_to_rq(hctx->tags, tag++);
+ rq = blk_mq_tag_to_rq(hctx->queue, hctx->tags, tag++);
if (rq->q != hctx->queue)
continue;
if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))
Index: linux/include/linux/blk-mq.h
===================================================================
--- linux.orig/include/linux/blk-mq.h 2014-05-10 11:49:21.646830000 +0800
+++ linux/include/linux/blk-mq.h 2014-05-10 11:49:21.638830100 +0800
@@ -149,7 +149,8 @@ void blk_mq_free_request(struct request
bool blk_mq_can_queue(struct blk_mq_hw_ctx *);
struct request *blk_mq_alloc_request(struct request_queue *q, int rw, gfp_t gfp);
struct request *blk_mq_alloc_reserved_request(struct request_queue *q, int rw, gfp_t gfp);
-struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag);
+struct request *blk_mq_tag_to_rq(struct request_queue *q,
+ struct blk_mq_tags *tags, unsigned int tag);
struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *, const int ctx_index);
struct blk_mq_hw_ctx *blk_mq_alloc_single_hw_queue(struct blk_mq_tag_set *, unsigned int);
Index: linux/drivers/block/mtip32xx/mtip32xx.c
===================================================================
--- linux.orig/drivers/block/mtip32xx/mtip32xx.c 2014-05-10 11:49:21.646830000 +0800
+++ linux/drivers/block/mtip32xx/mtip32xx.c 2014-05-10 11:49:21.638830100 +0800
@@ -195,7 +195,7 @@ static struct request *mtip_rq_from_tag(
{
struct blk_mq_hw_ctx *hctx = dd->queue->queue_hw_ctx[0];
- return blk_mq_tag_to_rq(hctx->tags, tag);
+ return blk_mq_tag_to_rq(dd->queue, hctx->tags, tag);
}
static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd,
next prev parent reply other threads:[~2014-05-10 4:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 12:07 [patch]blk-mq: blk_mq_tag_to_rq should handle flush request Shaohua Li
2014-05-09 15:00 ` Christoph Hellwig
2014-05-10 4:00 ` Shaohua Li [this message]
2014-05-11 17:40 ` Jens Axboe
2014-05-30 14:09 ` Jens Axboe
2014-06-04 11:11 ` Christoph Hellwig
2014-06-04 14:15 ` Jens Axboe
2014-06-04 14:20 ` Christoph Hellwig
2014-06-04 14:54 ` Jens Axboe
2014-06-04 14:58 ` Christoph Hellwig
2014-06-04 15:02 ` Jens Axboe
2014-06-04 15:05 ` Christoph Hellwig
2014-06-04 15:08 ` Jens Axboe
2014-06-04 15:10 ` Christoph Hellwig
2014-06-04 15:11 ` Jens Axboe
2014-06-04 15:16 ` Christoph Hellwig
2014-06-04 15:19 ` Jens Axboe
2014-06-04 15:22 ` Christoph Hellwig
2014-06-04 15:28 ` Jens Axboe
2014-06-04 15:31 ` Christoph Hellwig
2014-06-04 15:39 ` Jens Axboe
2014-06-04 15:47 ` Jens Axboe
2014-06-04 16:25 ` Jens Axboe
2014-06-05 1:27 ` Shaohua Li
2014-06-05 2:05 ` Jens Axboe
2014-06-05 2:27 ` Shaohua Li
2014-06-05 2:40 ` Jens Axboe
2014-06-04 15:43 ` Ming Lei
2014-06-04 15:48 ` Jens Axboe
2014-06-04 16:00 ` Ming Lei
2014-06-04 16:09 ` Jens Axboe
2014-06-04 16:26 ` Ming Lei
2014-06-04 16:28 ` Jens Axboe
2014-06-04 16:33 ` Christoph Hellwig
2014-06-04 16:36 ` Ming Lei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140510040023.GA13788@kernel.org \
--to=shli@kernel.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox