Message ID | 20230209194825.511043-19-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp291337wrn; Thu, 9 Feb 2023 04:02:04 -0800 (PST) X-Google-Smtp-Source: AK7set8vMH/OJfOjno947EU+Ro1XrmvEn/f7PAP6n7qwbJko51TmpiGlB0T9GlsPHvUatmUlkHZa X-Received: by 2002:a05:6a20:d002:b0:af:fcb6:2ee2 with SMTP id hu2-20020a056a20d00200b000affcb62ee2mr8750252pzb.47.1675944124187; Thu, 09 Feb 2023 04:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675944124; cv=none; d=google.com; s=arc-20160816; b=QYZDNcesizaso5fSgcJsrFvfifo0Akb7Le1UwkSG2hnD4CU+kbCXd9lthrZY47F/08 RsouwMorT6/8J/rU5kydqY8rxO0YoljhpKsAjSZ1CfqzdENTk7vnJSzuFcBD287vDin0 AAF8dhKiOpPmfpICFh0pvb24/D0xnX3X57tl2JDR4kf66Qkn22pfoEjR4UV1bgimP3IK UXuNY0Of7344g2+/aJ4jvMtcN79bQNjCvcc8mqm7+EeKHU8Nx+yz9thDD3LKWkWu+P5/ k8OD29TErOxQKCq0PnHppRUk5Js+ANSNz7JMJ3ozW5qcwaHTc0o2kUG9Fdm7Sy0V+YQZ obZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6S7mxx3rkcQFbLF8zJSI+RY82xes6SjYyBBaqorpMog=; b=FUyabKZ0LjEu7hbFCotmRDW8KClXbLy3XKccN3ZIIgsZisCS2pomoPdARL9jgDHBoQ 9HUxkjwbKqxfyrZDtPfORzz7F05jTF+hZkFqsRzCdR1/+H4rUhfKXXj4M4HknKqUl/kU +RN6WMDF0wG03c0Aj2tCqGhqhXlFrjRW09+Cb5pjMz6jFgnJwk6iAdwtiaj/w85Y5TPa X/Mbn0Wx1ts9AiqXNzINa4zjAIXsVy4Ok5abha4bhv6BZRYHmGODp5vdC2PIDRrhdlLf m7Gd3NlcCQdTdGzjo2kMG/5pdYjIShTVHjUz60g5uHhao0ICVFCn4JwsGA3J1SCf4arl wPPg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u69-20020a638548000000b004fb456c442bsi1732999pgd.840.2023.02.09.04.01.41; Thu, 09 Feb 2023 04:02:04 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbjBIL6I (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 9 Feb 2023 06:58:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjBIL4Q (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Feb 2023 06:56:16 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A775C4BA; Thu, 9 Feb 2023 03:46:33 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4PCFSj1VSRz4f3jpt; Thu, 9 Feb 2023 19:46:29 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAn3rEQ3eRjgb0tDQ--.53508S20; Thu, 09 Feb 2023 19:46:31 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/21] ext4: remove unnecessary goto in ext4_mb_mark_diskspace_used Date: Fri, 10 Feb 2023 03:48:22 +0800 Message-Id: <20230209194825.511043-19-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230209194825.511043-1-shikemeng@huaweicloud.com> References: <20230209194825.511043-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAn3rEQ3eRjgb0tDQ--.53508S20 X-Coremail-Antispam: 1UD129KBjvdXoWrZrWrKrWrGF43GFWkXFykGrg_yoW3WFX_Ja 47Ar48ZFWrJF1fuF1vy3WFyr4kKa9YkF18XrWxtrWfZa4DWayruw4kArnayrZrW3Way343 GasxuryUXrWFvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbSxYFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l87I20VAvwVAaII0Ic2I_JFv_Gryl82 xGYIkIc2x26280x7IE14v26r126s0DM28IrcIa0xkI8VCY1x0267AKxVW5JVCq3wA2ocxC 64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM2 8EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq 3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x 0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E 7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcV C0I7IYx2IY67AKxVW8JVW5JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUIL05UUUUU X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757354785773233960?= X-GMAIL-MSGID: =?utf-8?q?1757354785773233960?= |
Series |
Some bugfix and cleanup to mballoc
|
|
Commit Message
Kemeng Shi
Feb. 9, 2023, 7:48 p.m. UTC
When ext4_read_block_bitmap fails, we can return PTR_ERR(bitmap_bh) to
remove unnecessary NULL check of bitmap_bh.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/mballoc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On Fri, Feb 10, 2023 at 03:48:22AM +0800, Kemeng Shi wrote: > When ext4_read_block_bitmap fails, we can return PTR_ERR(bitmap_bh) to > remove unnecessary NULL check of bitmap_bh. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> > --- > fs/ext4/mballoc.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index f9fc461b633f..7d6991af50d8 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -3739,9 +3739,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, > > bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group); > if (IS_ERR(bitmap_bh)) { > - err = PTR_ERR(bitmap_bh); > - bitmap_bh = NULL; It's probably trivial but the fact that we no longer have `bitmap_bh = NULL` is making me a bit paranoid. Although I think it should be okay but maybe someone else can help double check this :) > - goto out_err; > + return PTR_ERR(bitmap_bh); > } > > BUFFER_TRACE(bitmap_bh, "getting write access"); > -- > 2.30.0 >
Kemeng Shi <shikemeng@huaweicloud.com> writes: > When ext4_read_block_bitmap fails, we can return PTR_ERR(bitmap_bh) to > remove unnecessary NULL check of bitmap_bh. bitmap_bh is a local pointer variable. So not setting it to NULL is not a problem. I guess for consistency in return error code paths the author would have kept it this way, but since this is the first return from the function in case of an error, hence it looks ok if we simply call return PTR_ERR(bitmap_bh), rather than a goto out_err. Hence this looks good to me. Feel free to add - Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> > --- > fs/ext4/mballoc.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index f9fc461b633f..7d6991af50d8 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -3739,9 +3739,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, > > bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group); > if (IS_ERR(bitmap_bh)) { > - err = PTR_ERR(bitmap_bh); > - bitmap_bh = NULL; > - goto out_err; > + return PTR_ERR(bitmap_bh); > } > > BUFFER_TRACE(bitmap_bh, "getting write access"); > -- > 2.30.0
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index f9fc461b633f..7d6991af50d8 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3739,9 +3739,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group); if (IS_ERR(bitmap_bh)) { - err = PTR_ERR(bitmap_bh); - bitmap_bh = NULL; - goto out_err; + return PTR_ERR(bitmap_bh); } BUFFER_TRACE(bitmap_bh, "getting write access");