Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2066629rwb; Fri, 19 Aug 2022 14:43:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6wnro2xuwtSyIa9g8UtMPl+KEU8n4KegPjHrwvlWgpGJeCcPEgedzC1P/kZ5JCVBvfXyLv X-Received: by 2002:a05:6a00:174e:b0:52b:c705:a42c with SMTP id j14-20020a056a00174e00b0052bc705a42cmr10012453pfc.68.1660945406582; Fri, 19 Aug 2022 14:43:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660945406; cv=none; d=google.com; s=arc-20160816; b=AHUH4aiJrUwF+yjjn6eVcxh4GBvxqHDKdCxLeVoe9C/fRkh2U4HgD96zECTrXK4arS cgE4N2PQCBAFOG+75sOw3ZVS0NFZn0PfQLrZhoH9TStB8mV/tl/bBBrrc0buP7KuLBEn 38FQbpPMHRc1sJS+0YFejfyS9bZ8w5MO8QC9WNYZ6a4Ht7/aDa19y3mWDBU8RbH+i95v XKKJc3AA+SkMWm8HTnIOW0Ed4RzsWUxLw10m9wbYvpGtebO+pUlfFbBZsUJLm/J6F5KJ U1s2Ni6rMu8g7atP9wmlnuMPczfErKvS7lOkFfQAoTkaZrqT5u8HdKO18RuhZqBtpbCp cwoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=rAnrw9otmub1Qzzbh/NibQEgaaLhPsQe9FvrX3vIToU=; b=n8dEtUYvQHCga3gpqdBgOM0oDK0hN6SsSfC+LyR88R8kttGT2VqVG6ju176Hm2Qzpr UOVohdgC88Bmh7Fx9G+28g5PP/VDZD+6vmNmpZiXjNUraWvpTQOg/We+K7i9Sc2LoTbE pBW+8VfkqabG4/IkLRmyCzCor0/TcbQXS8pzzwgaFunrh+wEdbxK5OOIHhciNXrWK+yk HaWvg5JFowOgZ8rrI8iCuy4PZzvGH9nXoP3JdhToJS2RUxnH+Np/4FB09xQMLAig1jG8 95mTjgrU675qd2Cu2qnclKxwFr7Y6iGkn6oGq8WmOQQMUMfhonJKLFIMLkdzpv+vryYU DtXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i26-20020a633c5a000000b0042966cc11b9si5057321pgn.77.2022.08.19.14.42.51; Fri, 19 Aug 2022 14:43:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352657AbiHSVbx convert rfc822-to-8bit (ORCPT + 99 others); Fri, 19 Aug 2022 17:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350061AbiHSVbv (ORCPT ); Fri, 19 Aug 2022 17:31:51 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AFE2114189 for ; Fri, 19 Aug 2022 14:31:49 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-257-ftTluvfLP_yQT57jEBdPxg-1; Fri, 19 Aug 2022 22:31:46 +0100 X-MC-Unique: ftTluvfLP_yQT57jEBdPxg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Fri, 19 Aug 2022 22:31:46 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.040; Fri, 19 Aug 2022 22:31:45 +0100 From: David Laight To: "'cgel.zte@gmail.com'" , "konishi.ryusuke@gmail.com" CC: "linux-nilfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Minghao Chi , Zeal Robot Subject: RE: [PATCH] nilfs2: delete unnecessary checks before brelse() Thread-Topic: [PATCH] nilfs2: delete unnecessary checks before brelse() Thread-Index: AQHYs6QzVivB1J0+p0G/dRvjohFw+a22vqKA Date: Fri, 19 Aug 2022 21:31:45 +0000 Message-ID: <0d78d24dd26441818dbaedffde611485@AcuMS.aculab.com> References: <20220819081700.96279-1-chi.minghao@zte.com.cn> In-Reply-To: <20220819081700.96279-1-chi.minghao@zte.com.cn> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: cgel.zte@gmail.com > Sent: 19 August 2022 09:17 > > The brelse() function tests whether its argument is NULL > and then returns immediately. > Thus remove the tests which are not needed around the shown calls. The test is the caller makes sense if it is a 'hot' path and bh is normally NULL. David > > Reported-by: Zeal Robot > Signed-off-by: Minghao Chi > --- > fs/nilfs2/btree.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c > index f544c22fff78..b3b5a46488c2 100644 > --- a/fs/nilfs2/btree.c > +++ b/fs/nilfs2/btree.c > @@ -1668,8 +1668,7 @@ static int nilfs_btree_check_delete(struct nilfs_bmap *btree, __u64 key) > maxkey = nilfs_btree_node_get_key(node, nchildren - 1); > nextmaxkey = (nchildren > 1) ? > nilfs_btree_node_get_key(node, nchildren - 2) : 0; > - if (bh != NULL) > - brelse(bh); > + brelse(bh); > > return (maxkey == key) && (nextmaxkey < NILFS_BMAP_LARGE_LOW); > } > @@ -1717,8 +1716,7 @@ static int nilfs_btree_gather_data(struct nilfs_bmap *btree, > ptrs[i] = le64_to_cpu(dptrs[i]); > } > > - if (bh != NULL) > - brelse(bh); > + brelse(bh); > > return nitems; > } > -- > 2.25.1 - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)