From patchwork Thu Aug 1 23:45:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Logan Gunthorpe X-Patchwork-Id: 11071567 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAC9E13B1 for ; Thu, 1 Aug 2019 23:46:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAA5928701 for ; Thu, 1 Aug 2019 23:46:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEFBA28758; Thu, 1 Aug 2019 23:46:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6962428701 for ; Thu, 1 Aug 2019 23:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732904AbfHAXqe (ORCPT ); Thu, 1 Aug 2019 19:46:34 -0400 Received: from ale.deltatee.com ([207.54.116.67]:32988 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388590AbfHAXpW (ORCPT ); Thu, 1 Aug 2019 19:45:22 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1htKl2-0002MZ-Tp; Thu, 01 Aug 2019 17:45:21 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1htKl2-00025g-Ol; Thu, 01 Aug 2019 17:45:16 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Christoph Hellwig , Sagi Grimberg , Keith Busch , Jens Axboe , Chaitanya Kulkarni , Max Gurtovoy , Stephen Bates , Logan Gunthorpe Date: Thu, 1 Aug 2019 17:45:13 -0600 Message-Id: <20190801234514.7941-15-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190801234514.7941-1-logang@deltatee.com> References: <20190801234514.7941-1-logang@deltatee.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@lst.de, sagi@grimberg.me, kbusch@kernel.org, axboe@fb.com, Chaitanya.Kulkarni@wdc.com, maxg@mellanox.com, sbates@raithlin.com, logang@deltatee.com X-SA-Exim-Mail-From: gunthorp@deltatee.com Subject: [PATCH v7 14/14] nvmet-passthru: support block accounting X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Support block disk accounting by setting the RQF_IO_STAT flag and gendisk in the request. After this change, IO counts will be reflected correctly in /proc/diskstats for drives being used by passthru. Signed-off-by: Logan Gunthorpe --- drivers/nvme/target/io-cmd-passthru.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/target/io-cmd-passthru.c b/drivers/nvme/target/io-cmd-passthru.c index 06a919283cc5..cb193b434545 100644 --- a/drivers/nvme/target/io-cmd-passthru.c +++ b/drivers/nvme/target/io-cmd-passthru.c @@ -441,6 +441,9 @@ static struct request *nvmet_passthru_blk_make_request(struct nvmet_req *req, if (unlikely(IS_ERR(rq))) return rq; + if (blk_queue_io_stat(q) && cmd->common.opcode != nvme_cmd_flush) + rq->rq_flags |= RQF_IO_STAT; + if (req->sg_cnt) { ret = nvmet_passthru_map_sg(req, rq); if (unlikely(ret)) { @@ -505,7 +508,7 @@ static void nvmet_passthru_execute_cmd(struct nvmet_req *req) rq->end_io_data = req; if (req->sq->qid != 0) { - blk_execute_rq_nowait(rq->q, NULL, rq, 0, + blk_execute_rq_nowait(rq->q, ns->disk, rq, 0, nvmet_passthru_req_done); } else { req->p.rq = rq;