From patchwork Mon Apr 30 09:10:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Javier_Gonz=C3=A1lez?= X-Patchwork-Id: 10371181 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 0DFD260234 for ; Mon, 30 Apr 2018 09:13:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 005AE2894A for ; Mon, 30 Apr 2018 09:13:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E976128996; Mon, 30 Apr 2018 09:13: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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 8442F2894A for ; Mon, 30 Apr 2018 09:13:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbeD3JMU (ORCPT ); Mon, 30 Apr 2018 05:12:20 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54158 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753725AbeD3JKW (ORCPT ); Mon, 30 Apr 2018 05:10:22 -0400 Received: by mail-wm0-f67.google.com with SMTP id a67so4328669wmf.3 for ; Mon, 30 Apr 2018 02:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2So0/T7YU86Mz6m93qlNqJE7ovLM2DzIfTMRubfGVeA=; b=fSV6UTHSE0+CTbeT15Cr/Uod+7PO/iVgSoxRn/sG2AMDeCe79pSwrZF9ehvjtHmFRP JL94grh4nDJ4UwAolloy6dhY/7rg/35ZB9Fsn+Ttk4Se9Q4JwsrMTZysYWNfqsLApMjM dXPEmJEMSb40l3FcUXC9M9/+8qsVXQEAEMiYUQd3eQ4nqcUM0vpOvoJfrhh5ftMnF2v/ KbSLtHgRurnDPwObalJ2Y5bKdC1ihsFKlpjZpnmzE8f3kMzThzJXmyJyZruwoKGCVvlS nLPcW31u9JhT53v2PiE+GYvO+AeMxSRw7N7FHu/siGRXtW+UUJIJOj4l7RCJycm8pPcs cv2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2So0/T7YU86Mz6m93qlNqJE7ovLM2DzIfTMRubfGVeA=; b=Wg1aaN2ue/rFLghi3nyhLLvVLwP+Xh+F6o1D7foPTbSefHHzyB3lpjBlivQjhn0uXW DwLva9rdmvlJp7857fx4uqewOmeqUbp9cdbwnnrlimHB88M6jKfTmu0v1sEKv8cvz3SU Gmq8BoxFgtlWh4xQezQUlWRK4+XGYGcGJQFdKmTCh6TpENB2cmCBGjlBRyrqizkKXGDT bqEmumjGLvI2bMczZ960Agm2WFBlJWaPoMOA3lCU0aQishNJ5yKZO/3/sTS1wfvtccIZ 55LHcbMFwUdU/QSNcKyLdjjFs6wUmO0da0/l6bQDbqRMyI5KJompnUp1McINA7fgOgcT o04w== X-Gm-Message-State: ALQs6tC/GY7rA+6s85vZ1peq8RuxNrVu/y4OjYTznuInqfgGa3zzh205 nysSUmzN2Sdq23OLAbrZC4TXmQ== X-Google-Smtp-Source: AB8JxZrPDFq7ySpci8fvyJkerMakjzY04Ntn6FDnRhQ+fOg+waRdY1JXQA1g3eERx7Eh27LIiIO9Zw== X-Received: by 2002:a50:b654:: with SMTP id c20-v6mr15957617ede.190.1525079421790; Mon, 30 Apr 2018 02:10:21 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id b56-v6sm2108638edd.85.2018.04.30.02.10.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Apr 2018 02:10:21 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 06/11] lightnvm: pblk: return NVM_ error on failed submission Date: Mon, 30 Apr 2018 11:10:04 +0200 Message-Id: <1525079409-6588-7-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> References: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Return a meaningful error when the sanity vector I/O check fails. Signed-off-by: Javier González --- drivers/lightnvm/pblk-core.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 128101f9e606..6bc0c7f61aac 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -467,16 +467,13 @@ int pblk_submit_io(struct pblk *pblk, struct nvm_rq *rqd) { struct nvm_tgt_dev *dev = pblk->dev; + atomic_inc(&pblk->inflight_io); + #ifdef CONFIG_NVM_DEBUG - int ret; - - ret = pblk_check_io(pblk, rqd); - if (ret) - return ret; + if (pblk_check_io(pblk, rqd)) + return NVM_IO_ERR; #endif - atomic_inc(&pblk->inflight_io); - return nvm_submit_io(dev, rqd); } @@ -484,16 +481,13 @@ int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd) { struct nvm_tgt_dev *dev = pblk->dev; + atomic_inc(&pblk->inflight_io); + #ifdef CONFIG_NVM_DEBUG - int ret; - - ret = pblk_check_io(pblk, rqd); - if (ret) - return ret; + if (pblk_check_io(pblk, rqd)) + return NVM_IO_ERR; #endif - atomic_inc(&pblk->inflight_io); - return nvm_submit_io_sync(dev, rqd); }