From patchwork Thu Aug 2 20:50:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10554247 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C2C213B4 for ; Thu, 2 Aug 2018 20:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AEF52C3B9 for ; Thu, 2 Aug 2018 20:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 555462C4D7; Thu, 2 Aug 2018 20:50:45 +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=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 BF1962C3B9 for ; Thu, 2 Aug 2018 20:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732074AbeHBWn2 (ORCPT ); Thu, 2 Aug 2018 18:43:28 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34637 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731181AbeHBWn1 (ORCPT ); Thu, 2 Aug 2018 18:43:27 -0400 Received: by mail-lj1-f193.google.com with SMTP id f8-v6so3117280ljk.1 for ; Thu, 02 Aug 2018 13:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Fkdwr2evrSJglSAPSVfeflKs6pLfnTQBDxlgPCc4y4E=; b=wBRSzQBf1sXS6yyzxPxCv39vk3h7budIW6tzgymkFhpQGlrVEm8P02Ho2tsSDKSFcx P8Ywmpk7jksjZNV/5iV7+IYQvzjvsBiKp4sLX22rXDiow+yX8OBMm6iGRAf7Yza0FrIO QFcxc2MbRSBdDdOXSFG3hk/k2RxOncvN9fkw/SW/iTnwEim9vrphIrMGRAwr1o5mvZ/2 IRRcwrLyxL8FuV3OC7UVfRj6jT5Plesaw9j6QHLuTppK+HYX/dVSJF1JEXf+Z/rYLxkh VYvmxctzo17kYdeuMI80mDc0IIGls4U28oyNV4sm/yB+nYr5zthUsw7L6NyvEquXkZTA opBQ== 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:mime-version :content-transfer-encoding; bh=Fkdwr2evrSJglSAPSVfeflKs6pLfnTQBDxlgPCc4y4E=; b=XolA8kC0EklSixp0Hp4bj5WMFEDfcr7uNg3bF2fVSYcZNQRSNPhds3fZrvz+xhiWMP ezL/hhgXqCQjWWjKQBVx3Djs5N2vzUUiKt8ulMLtwOK2fw4uV1AwfAMKkcWdTON9IzMN FrNMtolAsvKDfG+eicVLlqdUli+Y/R6/swpEkGfLWyQpKr/6AO3SpoJa/xazosGz2FNE S0ICJAz9S2TrUZs5YVI7/YEO+caXHKOyxFstcA4qi9BgVJfqj+aZaFyVs+s4ZXbBZLm8 ypsx2jFC/zeGJFCbvyPLbWM9wa775b8+xAqATGqZJM5ZFT/mJ/BBghDIy08iFQ5Qdux2 geRg== X-Gm-Message-State: AOUpUlFcRiWE98ZnI4iHgF/EBMb5bkjEuOSWsTzXPYWlaJMMmk/p3uqO LOhgoBqJI1TJ1NAzLr65OS2TKg== X-Google-Smtp-Source: AAOMgpd3Y1m078njui2K4Nsa9O1qKiUtBUL2qm1Jc1ZTM1Tt8AU+bqZcJysKq+9lawZyrkHpUfukGw== X-Received: by 2002:a2e:8807:: with SMTP id x7-v6mr3198480ljh.98.1533243037318; Thu, 02 Aug 2018 13:50:37 -0700 (PDT) Received: from localhost.localdomain (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id u10-v6sm560344ljk.83.2018.08.02.13.50.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Aug 2018 13:50:36 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, javier@cnexlabs.com, hans.holmberg@cnexlabs.com, hlitz@ucsc.edu, youngtack.jin@circuitblvd.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mat?= =?utf-8?q?ias_Bj=C3=B8rling?= Subject: [PATCH] lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync Date: Thu, 2 Aug 2018 22:50:23 +0200 Message-Id: <20180802205023.29094-1-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 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 rqd.error is masked by the return value of pblk_submit_io_sync. The rqd structure is then passed on to the end_io function, which assumes that any error should lead to a chunk being marked offline/bad. Since the pblk_submit_io_sync can fail before the command is issued to the device, the error value maybe not correspond to a media failure, leading to chunks being immaturely retired. Also, the pblk_blk_erase_sync function prints an error message in case the erase fails. Since the caller prints an error message by itself, remove the error message in this function. Signed-off-by: Matias Bjørling Reviewed-by: Javier González Reviewed-by: Hans Holmberg --- drivers/lightnvm/pblk-core.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c index 72acf2f6dbd6..814204d22a2e 100644 --- a/drivers/lightnvm/pblk-core.c +++ b/drivers/lightnvm/pblk-core.c @@ -886,10 +886,8 @@ static void pblk_setup_e_rq(struct pblk *pblk, struct nvm_rq *rqd, static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) { - struct nvm_rq rqd; - int ret = 0; - - memset(&rqd, 0, sizeof(struct nvm_rq)); + struct nvm_rq rqd = {0}; + int ret; pblk_setup_e_rq(pblk, &rqd, ppa); @@ -897,19 +895,6 @@ static int pblk_blk_erase_sync(struct pblk *pblk, struct ppa_addr ppa) * with writes. Thus, there is no need to take the LUN semaphore. */ ret = pblk_submit_io_sync(pblk, &rqd); - if (ret) { - struct nvm_tgt_dev *dev = pblk->dev; - struct nvm_geo *geo = &dev->geo; - - pblk_err(pblk, "could not sync erase line:%d,blk:%d\n", - pblk_ppa_to_line(ppa), - pblk_ppa_to_pos(geo, ppa)); - - rqd.error = ret; - goto out; - } - -out: rqd.private = pblk; __pblk_end_io_erase(pblk, &rqd);