From patchwork Fri Sep 14 07:37:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 10600561 X-Patchwork-Delegate: snitzer@redhat.com 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 E4A9A112B for ; Fri, 14 Sep 2018 09:22:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1D352ADEC for ; Fri, 14 Sep 2018 09:22:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B66FB2AE25; Fri, 14 Sep 2018 09:22:21 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 922FA2ADEC for ; Fri, 14 Sep 2018 09:22:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1BA8A30026D9; Fri, 14 Sep 2018 09:22:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD31E100195E; Fri, 14 Sep 2018 09:22:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7CC6C181A130; Fri, 14 Sep 2018 09:22:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8E7dPtW003507 for ; Fri, 14 Sep 2018 03:39:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5FC7B2010D06; Fri, 14 Sep 2018 07:39:25 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B03B2010D03; Fri, 14 Sep 2018 07:39:21 +0000 (UTC) Received: from www.osadl.org (www.osadl.org [62.245.132.105]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFB31C057F80; Fri, 14 Sep 2018 07:39:18 +0000 (UTC) Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w8E7dBPR016836; Fri, 14 Sep 2018 09:39:11 +0200 From: Nicholas Mc Guire To: Alasdair Kergon Date: Fri, 14 Sep 2018 09:37:03 +0200 Message-Id: <1536910623-18013-1-git-send-email-hofrat@osadl.org> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 14 Sep 2018 07:39:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 14 Sep 2018 07:39:20 +0000 (UTC) for IP:'62.245.132.105' DOMAIN:'www.osadl.org' HELO:'www.osadl.org' FROM:'hofrat@osadl.org' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW) 62.245.132.105 www.osadl.org 62.245.132.105 www.osadl.org X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 14 Sep 2018 05:21:54 -0400 Cc: dm-devel@redhat.com, linux-kernel@vger.kernel.org, Mike Snitzer , Nicholas Mc Guire Subject: [dm-devel] [PATCH] dm integrity: drop excess unlikely() from BUG_ON() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 14 Sep 2018 09:22:19 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP include/asm-generic/bug.h defines BUG_ON(condition) as do { if (unlikely(condition)) BUG(); } while (0). So BUG_ON already provides unlikely() on the condition thus there is no point in having BUG_ON(unlikely(condition)), thus simply drop the excess unlikely(). Signed-off-by: Nicholas Mc Guire --- Found during code review Patch was compile tested with: x86_64_defconfig + SCSI_LOWLEVEL=y, DM_INTEGRITY=y (with warnings from sparse and smatch - not related to the proposed change though) Patch is against 4.19-rc3 (localversion-next is next-20180913) drivers/md/dm-integrity.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 89ccb64..8574e73 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -1948,7 +1948,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start, if (journal_entry_is_unused(je)) continue; - BUG_ON(unlikely(journal_entry_is_inprogress(je)) && !from_replay); + BUG_ON(journal_entry_is_inprogress(je) && + !from_replay); sec = journal_entry_get_sector(je); if (unlikely(from_replay)) { if (unlikely(sec & (unsigned)(ic->sectors_per_block - 1))) { @@ -1963,7 +1964,8 @@ static void do_journal_write(struct dm_integrity_c *ic, unsigned write_start, sector_t sec2, area2, offset2; if (journal_entry_is_unused(je2)) break; - BUG_ON(unlikely(journal_entry_is_inprogress(je2)) && !from_replay); + BUG_ON(journal_entry_is_inprogress(je2) && + !from_replay); sec2 = journal_entry_get_sector(je2); get_area_and_offset(ic, sec2, &area2, &offset2); if (area2 != area || offset2 != offset + ((k - j) << ic->sb->log2_sectors_per_block))