From patchwork Tue Jan 12 06:49:15 2016 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: 8014151 X-Patchwork-Delegate: axboe@kernel.dk Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 428C1BEEE5 for ; Tue, 12 Jan 2016 06:56:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6061C20379 for ; Tue, 12 Jan 2016 06:56:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83037201F4 for ; Tue, 12 Jan 2016 06:56:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761532AbcALGvW (ORCPT ); Tue, 12 Jan 2016 01:51:22 -0500 Received: from mail-wm0-f48.google.com ([74.125.82.48]:36199 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbcALGtz (ORCPT ); Tue, 12 Jan 2016 01:49:55 -0500 Received: by mail-wm0-f48.google.com with SMTP id l65so238864944wmf.1 for ; Mon, 11 Jan 2016 22:49:54 -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=SFQVCcev4m+5U8P5vgH7PeEKqGthfs9uZ2YJT6Y2CKo=; b=opW/4YIR5IMMURalVSNMyMeI9ThcDwzBxTe2I8sPIzcYfS7SSVG5oxb5VXTVS3L2Er D9gJUk46GSjgRQhaqbsBHOGtjbd192/rO7IGA9NBuZcXKhow93tcrSQbUllBg7bjU+yO Cz/ZYz9Z2pKbvmZB5GmYvdG7dVpZzLJ6hJGk4= 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=SFQVCcev4m+5U8P5vgH7PeEKqGthfs9uZ2YJT6Y2CKo=; b=NTDmwToGUovi+StiWDuCgaYWJ66PY9UI3k6bPbqJo5GmRJydM4Rnb89qDHS0MOJQUW Fbo/o9kU7VqCySGVRnP2hUI3yc8t13HnRx7nmvj2g5++zMn1veHnHd3df/AaTCuFSEmf afRDV4FSUIuT3bOHNhVqRdEykBAiLekdafAs+qSkzYWaeADY0Kg6wwWTFVs/ae0Sd/gi R0Xv+/hPrHsORSclRSGfSSmlmGB3t45dNkTbewyHNvlXQu1FsRUZzNpOulusNkEWNdWi SH6FvsQfbLbS+ZLENUH5oWlmaEJrEJGYrgvKNv1W0H8kZFBcSGjtH5BgaWl9oXohOIyB ljxQ== X-Gm-Message-State: ALoCoQmke+0kvJtfuTHLuX3vnixkt3WZoR79KF5FmqslrrtvX6yc+i5NVosWHRw/HgkuKTz5Tt7TTBX2DsiNSjMcuwlSV61LGg== X-Received: by 10.28.223.134 with SMTP id w128mr16803514wmg.69.1452581393924; Mon, 11 Jan 2016 22:49:53 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id yz5sm70776886wjc.36.2016.01.11.22.49.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 22:49:52 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: Wenwei Tao , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 01/25] lightnvm: fix bio submission issue Date: Tue, 12 Jan 2016 07:49:15 +0100 Message-Id: <1452581379-18162-2-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452581379-18162-1-git-send-email-m@bjorling.me> References: <1452581379-18162-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,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Wenwei Tao Put bio when submission fails, since we get it before submission. And return error when backend device driver doesn't provide a submit_io method, thus we can end IO properly. Signed-off-by: Wenwei Tao Signed-off-by: Matias Bjørling --- drivers/lightnvm/gennvm.c | 2 +- drivers/lightnvm/rrpc.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c index a54b339..62c6f4d 100644 --- a/drivers/lightnvm/gennvm.c +++ b/drivers/lightnvm/gennvm.c @@ -345,7 +345,7 @@ static void gennvm_generic_to_addr_mode(struct nvm_dev *dev, struct nvm_rq *rqd) static int gennvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) { if (!dev->ops->submit_io) - return 0; + return -ENODEV; /* Convert address space */ gennvm_generic_to_addr_mode(dev, rqd); diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c index 134e4fa..a1e7488 100644 --- a/drivers/lightnvm/rrpc.c +++ b/drivers/lightnvm/rrpc.c @@ -650,11 +650,12 @@ static int rrpc_end_io(struct nvm_rq *rqd, int error) if (bio_data_dir(rqd->bio) == WRITE) rrpc_end_io_write(rrpc, rrqd, laddr, npages); + bio_put(rqd->bio); + if (rrqd->flags & NVM_IOTYPE_GC) return 0; rrpc_unlock_rq(rrpc, rqd); - bio_put(rqd->bio); if (npages > 1) nvm_dev_dma_free(rrpc->dev, rqd->ppa_list, rqd->dma_ppa_list); @@ -841,6 +842,7 @@ static int rrpc_submit_io(struct rrpc *rrpc, struct bio *bio, err = nvm_submit_io(rrpc->dev, rqd); if (err) { pr_err("rrpc: I/O submission failed: %d\n", err); + bio_put(bio); return NVM_IO_ERR; }