From patchwork Mon Dec 14 13:17:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 7844491 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 AE83C9F350 for ; Mon, 14 Dec 2015 13:18:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF5E4203AE for ; Mon, 14 Dec 2015 13:18:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBEE2203AB for ; Mon, 14 Dec 2015 13:18:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932525AbbLNNS3 (ORCPT ); Mon, 14 Dec 2015 08:18:29 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:34614 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975AbbLNNRe (ORCPT ); Mon, 14 Dec 2015 08:17:34 -0500 Received: by mail-wm0-f54.google.com with SMTP id p66so61527453wmp.1 for ; Mon, 14 Dec 2015 05:17:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=jjXt+3+pRwrazzNaogVwAgbswHv1Ok0pFWA0f+K67tQ=; b=xbN9fXAbU/+VQoS+WW64vxNLN1mDjLw+kV0+R4uvGAuT43lxiQ5GsUmh8C9I09OwdG ejf+SlIK/1OpjM7WgdMKxo9gt7Qo1jt2W3DafvIzYIkHP3LkT43sZR1FaRclY9OqoD49 1MURKOEvfwA29Y/PQ3Jg7NETxIH3+a9Kbupgs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=jjXt+3+pRwrazzNaogVwAgbswHv1Ok0pFWA0f+K67tQ=; b=GTiK8sqknjSJHjIUODfWAdSokSjIY5TPBJbAeRvwrsv+FoOcSUD3TomWxsCqIRrOTq xhVjI/kX0r64tkym5qvtC+PvTycrMIVcXcEvtOhJts3MV2bUv5GErhRfHTKRR2JKug42 V3JQDQ/atxEo5tpUa34ihzp8E2olRBGLtOcqNi/inWJAiJtgckiRhu21e7tqxLy/r662 U3TTIY6Wn9PQcvwwri5ydChjRamgT1KU0QslufqfC3htG588JZ1CYERCq90PnON7XjUR g3vL6sSCThkOZ0xWLNjW0GzJ+u5TjzfRt36Uj+XYuwHoYldfSrSjxUG2A6pF+y1kG+Kw T4ZA== X-Gm-Message-State: ALoCoQkfy3oMy34Ekmo2SVU9lXBeQMUWIH0BR2hXfMEajU+Me9ApcmSwkYI2BP+VLaRH5mjbMUoYq96bWUMD/JkyjY+Ogr1RGw== X-Received: by 10.194.89.226 with SMTP id br2mr41833941wjb.22.1450099052847; Mon, 14 Dec 2015 05:17:32 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id u139sm16080298wmu.22.2015.12.14.05.17.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Dec 2015 05:17:32 -0800 (PST) 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 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 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 {