From patchwork Sat Apr 15 18:55:52 2017 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: 9682381 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 44D8C60138 for ; Sat, 15 Apr 2017 18:58:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37DA525223 for ; Sat, 15 Apr 2017 18:58:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CA2928305; Sat, 15 Apr 2017 18:58:07 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 C2B0525223 for ; Sat, 15 Apr 2017 18:58:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756107AbdDOS5v (ORCPT ); Sat, 15 Apr 2017 14:57:51 -0400 Received: from mail-dm3nam03on0053.outbound.protection.outlook.com ([104.47.41.53]:42825 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755983AbdDOS5U (ORCPT ); Sat, 15 Apr 2017 14:57:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=G3dXvSF6GNkQLZGAwb8sw9pXIY4h55qvzCWY4wxvjZA=; b=orJ9MqbK+nWmJO8OWZaHZiXGBTSHexkmlSytv3rWHBgDEKmlxHir5+N5orPgvVJWqSMpV/pPFxbcQDNNc/1R6Zin/CziFsdGYeHoYsc04AU8gynTBLQbWLpyRmparPoRTKnQ9KFUP2+UFtbrUqLC08IuLXKHf1MrRTD8AEEJW5k= Authentication-Results: fb.com; dkim=none (message not signed) header.d=none; fb.com; dmarc=none action=none header.from=cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Sat, 15 Apr 2017 18:56:39 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , Dan Carpenter , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 18/19] lightnvm: fix some WARN() messages Date: Sat, 15 Apr 2017 20:55:52 +0200 Message-ID: <20170415185553.16098-19-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170415185553.16098-1-matias@cnexlabs.com> References: <20170415185553.16098-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: AM5PR0701CA0069.eurprd07.prod.outlook.com (10.169.145.159) To CY4PR06MB2774.namprd06.prod.outlook.com (10.175.117.142) X-MS-Office365-Filtering-Correlation-Id: 6c9a8cc5-d973-497b-877c-08d4843126c6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 3:cjS3XbT/CKaCiEn0c5knOaLwMlPedBYNqvuYgvBkvdMLlx9Epy1Qkfqdy7197O/mZkPYYcydxBKw2o3itsTrP9NCyFOgi863tw4XZ7N7He//7AMzLGp9aH7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Hfvf9pFL+cALIb1Pa8VTR9PnOZSs6zuxjLGwDkYwbrz/so9nDs6xml4tk5kNByGn0DdibRgorPeQv0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201703061421075)(20161123555025)(6072148); SRVR:CY4PR06MB2774; BCL:0; PCL:0; RULEID:; SRVR:CY4PR06MB2774; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 4:kywbzNAn3DaH6wC1PDwviI6sGHDOt5qB4WCaX0waNM3pMYF4IPQSL9ovuZjbMRqCtS8jxFVAwVZ9QDb8AAL3+zMKefB7Qa4CQgWowZPjro7XBIjMDl0ft+Fl6RF7Jq1ZlqUv+I1h3EjXH9CXZDspdi4Jq1Y7LpKXE2lAhuU6lKNTus+vnpr2ZmwCmY8yfa/7jwCZjSrqn6/TygB4pNfc0Jv8xmiGF/iqIvfe9lof3EmMYYnbWfq1l6Z0SWaKW+qFyLo5+HsqDwdXwMbqBNpOlowW8jrKNbsbgGif71EEU14zu0nZsWgXLkLDJVztUB3QWRjgrWUZyjnsKa5xlcKhqwvK7Bk2tJhhgrUWnsTOxccx934ldyZjpcN0lvU94HIgA+KnUB5hUaVXZj4VKsvNXbjji4mD9tgLSII4sE9vQA6naS/BqK+xZgndA9YWHyH/ZHSYScW3JIMgozPx1Wii/b+KbxuLh3j1Fe9l+9B3O2aqeRTAoBstm9vYYfbutHiYL0jGXib+CP77Pu5uNceN2K+aENaBkxZ7OA9ogvGCF1JN49ls9q7xz0OEmlYJf6Pt+myb62zgryd6kCFviX9rfME5pEAysuvUL9YG0lkTakIgP6CuNRg3WFuO9w9+y2VTIYTBF/oo6oDMb+67/GJkICPcXLis9EBM/uC5lLv3p/E0Nsxb5DEBN8NZB6zo3fN+ZoG7PStvDnnirUUk0xh5KXMqF5jGAIhQf4eDUQyFxh4= X-Forefront-PRVS: 02788FF38E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39400400002)(39450400003)(86362001)(305945005)(1076002)(6916009)(6666003)(25786009)(2950100002)(6486002)(2906002)(3846002)(6116002)(2870700001)(54906002)(189998001)(53936002)(53416004)(107886003)(110136004)(5660300001)(38730400002)(50986999)(15650500001)(76176999)(2351001)(4326008)(66066001)(5820100001)(23676002)(81166006)(47776003)(42186005)(36756003)(33646002)(50226002)(8676002)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR06MB2774; H:skyninja.cnexlabs.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjA2TUIyNzc0OzIzOlN2UDQwRFFreDJPNVJnN3RqalRQTzJVc2pq?= =?utf-8?B?cXIwSFR3QWIzL2FvZ2xxSW10Y3QyeWdSQU5nWGNIK2lRclEzMEJ6SzRYVkY5?= =?utf-8?B?RklzWTc0U1k1ODZEekVPOU1HT0hmcGl3SnN1Q0hEVGtyeWJoNWlJVUdlbWY3?= =?utf-8?B?S2RRcC9Zb0pZc1BEQUE2SEc1dFczSXRZN2g5RGRGK041TG5kL0hEdkNmRWpq?= =?utf-8?B?dGllWmsxVFVVd0UraUV3dkMxYVdrZ0VsTkxQd0p1Wkh3Y0h0Ry9MVGxCQ1Yx?= =?utf-8?B?bmZERzFLWkRKWG9zMUJmWFp4bDd5anRWbVZBZE1oQWwzZWNFRlhIWlVBNGZu?= =?utf-8?B?eWljbmJOeHFIdHI4aEtjcXNFM0w1NnM3S2lMQ1ZoU2Z3VCs0cm1ITjdscHJM?= =?utf-8?B?UEJubFcyWUtqUEdMeFVKZTg4Q0lLbkNYanAyQjBIQ0ExSUtXcEpmb2NSL2Zv?= =?utf-8?B?djh6YUNQQ2lhRmVHZDMzMWhVM0tjeHI4UUlLRjY1UFJk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ft-Exchange-Diagnostics: 1; CY4PR06MB2774; 6:KZq4yxpD4MBqe8rX/TItrMsOVGECqQhvR8d+veU+gYChKigHWC9ecmKQKk/Q/HIMEcje6TLvaVVuD61Rci00P3/4zeplRHwQXriLSWp3YRAyneBM7AAXv64YQvGcVKmeAAGD1IOLLCsw6cSDLzRyhEEZPGIJU9SLpHj8XWGlDqUm/dBJGH8vIJXAfk8E6bqjprpQ3LwhdZq2mCbP2K0OtioAWF6//CqCKX7X0eOT0rsF1Y4Sbf8y97yKjQJahLRS3NPNYkDmEOmkDAerGED7kfOq1JmXHu+qDd4GdNltJshimN9n3BRgu+ErPUz/XBIA2JvbS+nLKEBMIYblV//cZe6QNv7QELxlokyII93qJKbcuvPu9XB398Lq9flfPdUD3yYWecOx4B29gg91w8Bz7PzRDriXB+j9aRqadqCmLBVVrO/4QlDF2z7zA8V+I/6Qkb9II5GJQsfEMOPh6Kajmg==; 5:GNHJGet4AmqAIylNPfgUhcwssrFAAgyUN58hmFQubg7wbqZC38PBxJzqSFipmf+wDRPBXd1FyIpbts2EfUsx1tQhZM2BHr+tvhPREy64S4AqBKiVFYo08qbACsO10LTlbjfOIAtedz+0Ya3Dx6wHhA==; 24:/F5aYqR/QnmfDNfVReMPiGW7Hu5AwKqp36oPJ9pBi3rI6yjqY06YvNlnldV+SMfDDaVlwhapm5/sWi4S5xo9ioUSfc/nqeJm+6lIGMyY0oU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2774; 7:qVKQOBwtr4tCKrTEJuTo/eIiCh1d7dMSQ3FLsVvANxb3b0bctoDoRoJ6YD/EqS9DB7dsUyBRujvoCPjgjnR2h9z5v3y4jGwJi/qoGNXwTWgILvB8nJcwNxzdt5wDGEnA3eMMaShC7vu2OFYAmqmS7m2kC4mJEw8KuLF5TCPerH7uEZmFxhBfSvfRhSxc8p/IVQ2I+4mMIBaWM+89yGYih+xjinXglAmiUpd77gSFhWSZ9+Jwm65ZHDUoJZHJfjV2Tyv2GiMmHnQpBjUM/WPp67WHTXdlUxtqwBgOkm6vrfI/WXz6jhhV5FjQpZsRjzqxe2Rnwr1SAL51N248cFnSQw== X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2017 18:56:39.4622 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2774 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 From: Dan Carpenter WARN_ON() takes a condition, not an error message. I slightly tweaked some conditions so hopefully it's more clear. Signed-off-by: Dan Carpenter Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-read.c | 12 ++++++------ drivers/lightnvm/pblk-recovery.c | 2 +- drivers/lightnvm/pblk-write.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index eff0982..bce7ed5 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c @@ -49,8 +49,8 @@ static void pblk_read_ppalist_rq(struct pblk *pblk, struct nvm_rq *rqd, int i, j = 0; /* logic error: lba out-of-bounds. Ignore read request */ - if (!(blba + nr_secs < pblk->rl.nr_secs)) { - WARN_ON("pblk: read lbas out of bounds\n"); + if (blba + nr_secs >= pblk->rl.nr_secs) { + WARN(1, "pblk: read lbas out of bounds\n"); return; } @@ -254,8 +254,8 @@ static void pblk_read_rq(struct pblk *pblk, struct nvm_rq *rqd, sector_t lba = pblk_get_lba(bio); /* logic error: lba out-of-bounds. Ignore read request */ - if (!(lba < pblk->rl.nr_secs)) { - WARN_ON("pblk: read lba out of bounds\n"); + if (lba >= pblk->rl.nr_secs) { + WARN(1, "pblk: read lba out of bounds\n"); return; } @@ -411,8 +411,8 @@ static int read_rq_gc(struct pblk *pblk, struct nvm_rq *rqd, int valid_secs = 0; /* logic error: lba out-of-bounds */ - if (!(lba < pblk->rl.nr_secs)) { - WARN_ON("pblk: read lba out of bounds\n"); + if (lba >= pblk->rl.nr_secs) { + WARN(1, "pblk: read lba out of bounds\n"); goto out; } diff --git a/drivers/lightnvm/pblk-recovery.c b/drivers/lightnvm/pblk-recovery.c index 0d50f41..f8f8508 100644 --- a/drivers/lightnvm/pblk-recovery.c +++ b/drivers/lightnvm/pblk-recovery.c @@ -167,7 +167,7 @@ static int pblk_recov_l2p_from_emeta(struct pblk *pblk, struct pblk_line *line) if (le64_to_cpu(lba_list[i]) == ADDR_EMPTY) { spin_lock(&line->lock); if (test_and_set_bit(i, line->invalid_bitmap)) - WARN_ON_ONCE("pblk: rec. double invalidate:\n"); + WARN_ONCE(1, "pblk: rec. double invalidate:\n"); else line->vsc--; spin_unlock(&line->lock); diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c index ee57db9..74f7413 100644 --- a/drivers/lightnvm/pblk-write.c +++ b/drivers/lightnvm/pblk-write.c @@ -141,7 +141,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd) /* Logic error */ if (bit > c_ctx->nr_valid) { - WARN_ON_ONCE("pblk: corrupted write request\n"); + WARN_ONCE(1, "pblk: corrupted write request\n"); goto out; }