From patchwork Sat Nov 21 07:28:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 7673751 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B0A19F1D3 for ; Sat, 21 Nov 2015 07:33:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF5BA203A9 for ; Sat, 21 Nov 2015 07:33:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D020B203A1 for ; Sat, 21 Nov 2015 07:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752293AbbKUHdg (ORCPT ); Sat, 21 Nov 2015 02:33:36 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:41162 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbbKUHdf (ORCPT ); Sat, 21 Nov 2015 02:33:35 -0500 Received: from p4ff2e08a.dip0.t-ipconnect.de ([79.242.224.138] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1a02fs-0004td-A0; Sat, 21 Nov 2015 07:33:32 +0000 From: Christoph Hellwig To: keith.busch@intel.com, axboe@fb.com Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 09/16] nvme: switch delete SQ/CQ to blk_execute_rq_nowait Date: Sat, 21 Nov 2015 08:28:27 +0100 Message-Id: <1448090914-13121-10-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448090914-13121-1-git-send-email-hch@lst.de> References: <1448090914-13121-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Christoph Hellwig --- drivers/nvme/host/pci.c | 49 +++++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index e6ce398..6602d29 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -85,8 +85,6 @@ static void nvme_unmap_data(struct nvme_dev *dev, struct nvme_iod *iod); struct async_cmd_info { struct kthread_work work; struct kthread_worker *worker; - struct request *req; - u32 result; int status; void *ctx; }; @@ -390,16 +388,6 @@ static void abort_completion(struct nvme_queue *nvmeq, void *ctx, atomic_inc(&nvmeq->dev->ctrl.abort_limit); } -static void async_completion(struct nvme_queue *nvmeq, void *ctx, - struct nvme_completion *cqe) -{ - struct async_cmd_info *cmdinfo = ctx; - cmdinfo->result = le32_to_cpup(&cqe->result); - cmdinfo->status = le16_to_cpup(&cqe->status) >> 1; - queue_kthread_work(cmdinfo->worker, &cmdinfo->work); - blk_mq_free_request(cmdinfo->req); -} - static inline struct nvme_cmd_info *get_cmd_from_tag(struct nvme_queue *nvmeq, unsigned int tag) { @@ -983,28 +971,13 @@ static int nvme_submit_async_admin_req(struct nvme_dev *dev) return 0; } -static int nvme_submit_admin_async_cmd(struct nvme_dev *dev, - struct nvme_command *cmd, - struct async_cmd_info *cmdinfo, unsigned timeout) +static void async_cmd_info_endio(struct request *req, int error) { - struct nvme_queue *nvmeq = dev->queues[0]; - struct request *req; - struct nvme_cmd_info *cmd_rq; - - req = blk_mq_alloc_request(dev->ctrl.admin_q, WRITE, 0); - if (IS_ERR(req)) - return PTR_ERR(req); + struct async_cmd_info *cmdinfo = req->end_io_data; - req->timeout = timeout; - cmd_rq = blk_mq_rq_to_pdu(req); - cmdinfo->req = req; - nvme_set_info(cmd_rq, cmdinfo, async_completion); - cmdinfo->status = -EINTR; - - cmd->common.command_id = req->tag; - - nvme_submit_cmd(nvmeq, cmd); - return 0; + cmdinfo->status = req->errors; + queue_kthread_work(cmdinfo->worker, &cmdinfo->work); + blk_mq_free_request(req); } static int adapter_delete_queue(struct nvme_dev *dev, u8 opcode, u16 id) @@ -2008,6 +1981,7 @@ static void nvme_del_queue_end(struct nvme_queue *nvmeq) static int adapter_async_del_queue(struct nvme_queue *nvmeq, u8 opcode, kthread_work_func_t fn) { + struct request *req; struct nvme_command c; memset(&c, 0, sizeof(c)); @@ -2015,8 +1989,15 @@ static int adapter_async_del_queue(struct nvme_queue *nvmeq, u8 opcode, c.delete_queue.qid = cpu_to_le16(nvmeq->qid); init_kthread_work(&nvmeq->cmdinfo.work, fn); - return nvme_submit_admin_async_cmd(nvmeq->dev, &c, &nvmeq->cmdinfo, - ADMIN_TIMEOUT); + + req = nvme_alloc_request(nvmeq->dev->ctrl.admin_q, &c, 0); + if (IS_ERR(req)) + return PTR_ERR(req); + + req->timeout = ADMIN_TIMEOUT; + req->end_io_data = &nvmeq->cmdinfo; + blk_execute_rq_nowait(req->q, NULL, req, 0, async_cmd_info_endio); + return 0; } static void nvme_del_cq_work_handler(struct kthread_work *work)