From: Keith Busch <kbusch@kernel.org> To: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, linux-block@vger.kernel.org Cc: Yuanyuan Zhong <yzhong@purestorage.com>, Casey Chen <cachen@purestorage.com>, Ming Lei <ming.lei@redhat.com>, Keith Busch <kbusch@kernel.org> Subject: [PATCHv3 1/4] block: support polling through blk_execute_rq Date: Fri, 21 May 2021 13:21:42 -0700 [thread overview] Message-ID: <20210521202145.3674904-2-kbusch@kernel.org> (raw) In-Reply-To: <20210521202145.3674904-1-kbusch@kernel.org> Poll for completions if the request's hctx is a polling type. Signed-off-by: Keith Busch <kbusch@kernel.org> --- v1->v2: Moved blk_execute_rq's poll handling into a small helper function block/blk-exec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/block/blk-exec.c b/block/blk-exec.c index beae70a0e5e5..38f88552aa31 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c @@ -63,6 +63,19 @@ void blk_execute_rq_nowait(struct gendisk *bd_disk, struct request *rq, } EXPORT_SYMBOL_GPL(blk_execute_rq_nowait); +static bool blk_rq_is_poll(struct request *rq) +{ + return rq->mq_hctx && rq->mq_hctx->type == HCTX_TYPE_POLL; +} + +static void blk_rq_poll_completion(struct request *rq, struct completion *wait) +{ + do { + blk_poll(rq->q, request_to_qc_t(rq->mq_hctx, rq), true); + cond_resched(); + } while (!completion_done(wait)); +} + /** * blk_execute_rq - insert a request into queue for execution * @bd_disk: matching gendisk @@ -83,7 +96,10 @@ void blk_execute_rq(struct gendisk *bd_disk, struct request *rq, int at_head) /* Prevent hang_check timer from firing at us during very long I/O */ hang_check = sysctl_hung_task_timeout_secs; - if (hang_check) + + if (blk_rq_is_poll(rq)) + blk_rq_poll_completion(rq, &wait); + else if (hang_check) while (!wait_for_completion_io_timeout(&wait, hang_check * (HZ/2))); else wait_for_completion_io(&wait); -- 2.25.4
WARNING: multiple messages have this Message-ID (diff)
From: Keith Busch <kbusch@kernel.org> To: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, linux-block@vger.kernel.org Cc: Yuanyuan Zhong <yzhong@purestorage.com>, Casey Chen <cachen@purestorage.com>, Ming Lei <ming.lei@redhat.com>, Keith Busch <kbusch@kernel.org> Subject: [PATCHv3 1/4] block: support polling through blk_execute_rq Date: Fri, 21 May 2021 13:21:42 -0700 [thread overview] Message-ID: <20210521202145.3674904-2-kbusch@kernel.org> (raw) In-Reply-To: <20210521202145.3674904-1-kbusch@kernel.org> Poll for completions if the request's hctx is a polling type. Signed-off-by: Keith Busch <kbusch@kernel.org> --- v1->v2: Moved blk_execute_rq's poll handling into a small helper function block/blk-exec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/block/blk-exec.c b/block/blk-exec.c index beae70a0e5e5..38f88552aa31 100644 --- a/block/blk-exec.c +++ b/block/blk-exec.c @@ -63,6 +63,19 @@ void blk_execute_rq_nowait(struct gendisk *bd_disk, struct request *rq, } EXPORT_SYMBOL_GPL(blk_execute_rq_nowait); +static bool blk_rq_is_poll(struct request *rq) +{ + return rq->mq_hctx && rq->mq_hctx->type == HCTX_TYPE_POLL; +} + +static void blk_rq_poll_completion(struct request *rq, struct completion *wait) +{ + do { + blk_poll(rq->q, request_to_qc_t(rq->mq_hctx, rq), true); + cond_resched(); + } while (!completion_done(wait)); +} + /** * blk_execute_rq - insert a request into queue for execution * @bd_disk: matching gendisk @@ -83,7 +96,10 @@ void blk_execute_rq(struct gendisk *bd_disk, struct request *rq, int at_head) /* Prevent hang_check timer from firing at us during very long I/O */ hang_check = sysctl_hung_task_timeout_secs; - if (hang_check) + + if (blk_rq_is_poll(rq)) + blk_rq_poll_completion(rq, &wait); + else if (hang_check) while (!wait_for_completion_io_timeout(&wait, hang_check * (HZ/2))); else wait_for_completion_io(&wait); -- 2.25.4 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-05-21 20:21 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-21 20:21 [PATCHv3 0/4] block and nvme passthrough error handling Keith Busch 2021-05-21 20:21 ` Keith Busch 2021-05-21 20:21 ` Keith Busch [this message] 2021-05-21 20:21 ` [PATCHv3 1/4] block: support polling through blk_execute_rq Keith Busch 2021-05-24 7:38 ` Christoph Hellwig 2021-05-24 7:38 ` Christoph Hellwig 2021-05-26 8:16 ` Ming Lei 2021-05-26 8:16 ` Ming Lei 2021-05-21 20:21 ` [PATCHv3 2/4] nvme: use blk_execute_rq() for passthrough commands Keith Busch 2021-05-21 20:21 ` Keith Busch 2021-05-24 7:38 ` Christoph Hellwig 2021-05-24 7:38 ` Christoph Hellwig 2021-05-26 8:24 ` Ming Lei 2021-05-26 8:24 ` Ming Lei 2021-05-26 8:47 ` Kanchan Joshi 2021-05-26 8:47 ` Kanchan Joshi 2021-06-07 16:15 ` Keith Busch 2021-06-07 16:15 ` Keith Busch 2021-06-08 5:26 ` Christoph Hellwig 2021-06-08 5:26 ` Christoph Hellwig 2021-05-21 20:21 ` [PATCHv3 3/4] block: return errors from blk_execute_rq() Keith Busch 2021-05-21 20:21 ` Keith Busch 2021-05-24 7:39 ` Christoph Hellwig 2021-05-24 7:39 ` Christoph Hellwig 2021-05-26 8:26 ` Ming Lei 2021-05-26 8:26 ` Ming Lei 2021-05-21 20:21 ` [PATCHv3 4/4] nvme: use return value " Keith Busch 2021-05-21 20:21 ` Keith Busch 2021-05-24 8:04 ` Christoph Hellwig 2021-05-24 8:04 ` Christoph Hellwig 2021-06-07 16:58 ` Keith Busch 2021-06-07 16:58 ` Keith Busch 2021-06-08 5:26 ` Christoph Hellwig 2021-06-08 5:26 ` Christoph Hellwig
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=20210521202145.3674904-2-kbusch@kernel.org \ --to=kbusch@kernel.org \ --cc=axboe@kernel.dk \ --cc=cachen@purestorage.com \ --cc=hch@lst.de \ --cc=linux-block@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=ming.lei@redhat.com \ --cc=sagi@grimberg.me \ --cc=yzhong@purestorage.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.