Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932467AbbLNNRg (ORCPT ); Mon, 14 Dec 2015 08:17:36 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36616 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752970AbbLNNRd (ORCPT ); Mon, 14 Dec 2015 08:17:33 -0500 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH RFC 3/5] lightnvm: add sync support for submit_io Date: Mon, 14 Dec 2015 14:17:05 +0100 Message-Id: <1450099027-24745-4-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450099027-24745-1-git-send-email-m@bjorling.me> References: <1450099027-24745-1-git-send-email-m@bjorling.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1465 Lines: 49 Allow read and write I/Os to be issued synchronous. Users include the LightNVM core to implement system block support and similar. Signed-off-by: Matias Bjørling --- drivers/nvme/host/lightnvm.c | 7 +++++++ include/linux/lightnvm.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 15f2acb..1454e53 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -496,6 +496,13 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) rq->cmd_len = sizeof(struct nvme_nvm_command); rq->special = (void *)0; + if (rqd->flags & NVM_IO_F_SYNC) { + int err = blk_execute_rq(q, NULL, rq, 0); + kfree(cmd); + blk_mq_free_request(rq); + return err; + } + rq->end_io_data = rqd; blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io); diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 2fd6871..770278a 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -60,6 +60,9 @@ enum { NVM_BLK_T_BAD = 0x1, NVM_BLK_T_DEV = 0x2, NVM_BLK_T_HOST = 0x4, + + /* NVM Request Flags */ + NVM_IO_F_SYNC = 0x1, }; struct nvm_id_group { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/