From patchwork Tue Oct 9 11:11:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10632339 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 00C00112B for ; Tue, 9 Oct 2018 11:17:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5A4028A45 for ; Tue, 9 Oct 2018 11:17:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C971728A6E; Tue, 9 Oct 2018 11:17:49 +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 6AFA528A45 for ; Tue, 9 Oct 2018 11:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726886AbeJIS3v (ORCPT ); Tue, 9 Oct 2018 14:29:51 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41987 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbeJIS3v (ORCPT ); Tue, 9 Oct 2018 14:29:51 -0400 Received: by mail-pg1-f195.google.com with SMTP id i4-v6so645405pgq.9 for ; Tue, 09 Oct 2018 04:13:24 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=sbpLUYkovpvd4K56ZaJIN/SCdn/2o6uCz0wZ+7EaWrI=; b=TkCwfIhTNdE5hP9eFab3BYYrfns5XOa3FKMzZ72TolpTWbX5rSrWzJ0e4CoXlDa8EU 17z4VF2+TMJaLkvQQIShmEj2eFr5NDDNxrz8r1+scqoxurlx7AOSLWASfIfe+mt6xZ/8 7sARzuqLmuxd8iBzkZBbdyqG2psszilF/m1gFiAcCDgRUc/xF0/CJ+yaAmXxMESY8tSP pVnn2zU9pZIlwo7GN+sD6FGmAkxqZ07yCOeyATJPnOiqYUbcPTejAiy0Ai/OWgSDRTUz VUu+t/JfuYC0o53dEN/BMsInHs0ZtjgqLAbIaDbYmpoI7IA66LZBdgTIdbUndCm2xham yojw== 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=sbpLUYkovpvd4K56ZaJIN/SCdn/2o6uCz0wZ+7EaWrI=; b=oUO0ciJ9BfjPu4bXPEI3+xj/2uxeP/oM/hbluJr+KN2OO/C5ZQH+9hmCcTx3YGrsNi YtOfHKS2VT5YHfCVj4O0wRSemeZ1b6B+K4WTmwqC5/cD0WyqyiBxFFtpb4kso+rxxTbR 3m0SXVaCXlFYSmigB5fXWti41qUFae8sWck+yVgoAc/XZkmkSFPyDIW8PCT8HzQRDXDH JWqo1p26pA1jwLUeFnWyCRCdQbXcSwp4Xp4Qdem+Pri7JiEaZhmgoXeklZDovqbHCAgA UEd2YNa4a5bnFAp8H/DP8fHTqY/Om7DEL1uNag6TGrQJj3XgF3s+IobltxiX5Cpuf/ns zk8A== X-Gm-Message-State: ABuFfohEX/noK3p2Bv+Pvmc31CPMrAzSed/Bto3lfPE/XSXtxSj9L2JR QTIS5kURJlQa5Q8Od4YAMYkc4YVgkc85GQ== X-Google-Smtp-Source: ACcGV63F8lTwMJE0YpPel90xK3SESQCu3eVSTwNWTWyxog5PMUYT/57MffrfHKEhxh71UIQi1wNC7A== X-Received: by 2002:a63:f5a:: with SMTP id 26-v6mr25058334pgp.100.1539083604193; Tue, 09 Oct 2018 04:13:24 -0700 (PDT) Received: from skyninja.hgst.com (rap-us.hgst.com. [199.255.44.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm25342380pff.128.2018.10.09.04.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Oct 2018 04:13:22 -0700 (PDT) From: =?utf-8?q?Matias_Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Mat?= =?utf-8?q?ias_Bj=C3=B8rling?= Subject: [GIT PULL 03/45] lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync Date: Tue, 9 Oct 2018 13:11:33 +0200 Message-Id: <20181009111215.7653-4-mb@lightnvm.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009111215.7653-1-mb@lightnvm.io> References: <20181009111215.7653-1-mb@lightnvm.io> 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..72de7456845b 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 = {NULL}; + 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);