From patchwork Tue Jun 14 04:35:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 9174961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B36D96048C for ; Tue, 14 Jun 2016 04:37:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A8A5F281DB for ; Tue, 14 Jun 2016 04:37:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D7D62821F; Tue, 14 Jun 2016 04:37:05 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, URIBL_BLACK 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 2197B281DB for ; Tue, 14 Jun 2016 04:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933457AbcFNEhA (ORCPT ); Tue, 14 Jun 2016 00:37:00 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:38535 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933196AbcFNEg7 (ORCPT ); Tue, 14 Jun 2016 00:36:59 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id 23A4322D9D9; Tue, 14 Jun 2016 04:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1465878962; bh=5LwcXaXj3QKVb1Tt5gQjv0UKBW8l70V UdQKNTPG4G+w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References; b=Uvp+rTpBdxT5oPEGDbSEZ0ygvcYqZAGIjBHSi0IGvov4U8eb0pyO dp5NWg9YnfIGJ+CknCX2LWMpP/AqV+f+YVEnmu07MnU1uGCd1SBw7MCI002nso0oijN WQ+MCGJY9olfgZUEyM+XT01sKb8EfXlnQ0AOvqe4lCyfgJKQRmRQ= From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , linux-nvme , Jens Axboe , Christoph Hellwig , Keith Busch , Jay Freyensee , Martin Petersen , Sagi Grimberg , Hannes Reinecke , Mike Christie , Dave B Minturn , Nicholas Bellinger Subject: [RFC-v2 08/11] nvmet/io-cmd: Hookup sbc_ops->execute_sync_cache backend ops Date: Tue, 14 Jun 2016 04:35:43 +0000 Message-Id: <1465878946-26556-9-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1465878946-26556-1-git-send-email-nab@linux-iscsi.org> References: <1465878946-26556-1-git-send-email-nab@linux-iscsi.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger This patch converts nvmet_execute_flush() to utilize sbc_ops->execute_sync_cache() for target_iostate submission into existing backends drivers via configfs in /sys/kernel/config/target/core/. Cc: Jens Axboe Cc: Christoph Hellwig Cc: Martin Petersen Cc: Sagi Grimberg Cc: Hannes Reinecke Cc: Mike Christie Signed-off-by: Nicholas Bellinger --- drivers/nvme/target/io-cmd.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/target/io-cmd.c b/drivers/nvme/target/io-cmd.c index 133a14a..23905a8 100644 --- a/drivers/nvme/target/io-cmd.c +++ b/drivers/nvme/target/io-cmd.c @@ -109,18 +109,21 @@ static void nvmet_execute_rw(struct nvmet_req *req) static void nvmet_execute_flush(struct nvmet_req *req) { -#if 0 - struct bio *bio; + struct target_iostate *ios = &req->t_iostate; + struct se_device *dev = rcu_dereference_raw(req->ns->dev); + struct sbc_ops *sbc_ops = dev->transport->sbc_ops; + sense_reason_t rc; - nvmet_inline_bio_init(req); - bio = &req->inline_bio; + if (!sbc_ops || !sbc_ops->execute_sync_cache) { + nvmet_req_complete(req, NVME_SC_INTERNAL | NVME_SC_DNR); + return; + } - bio->bi_bdev = req->ns->bdev; - bio->bi_private = req; - bio->bi_end_io = nvmet_bio_done; + ios->se_dev = dev; + ios->iomem = NULL; + ios->t_comp_func = &nvmet_complete_ios; - submit_bio(WRITE_FLUSH, bio); -#endif + rc = sbc_ops->execute_sync_cache(ios, false); } #if 0