Message ID | 20230721171007.2065423-9-shikemeng@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp82469vqg; Fri, 21 Jul 2023 02:36:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdi1HV/27IxsKQIyK+Te2K7WovmyegOFeLRfXVD8B54mW0m7pjdim/pGpU2xBfEsuOvaji X-Received: by 2002:a17:906:106:b0:986:d833:3cf9 with SMTP id 6-20020a170906010600b00986d8333cf9mr1223465eje.39.1689932168445; Fri, 21 Jul 2023 02:36:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932168; cv=none; d=google.com; s=arc-20160816; b=fyNMjWKBLdJ3FBhAozHQEU+OgvfaTXHo8uohOycqTBw9SCahkClvQnzmXXhorFdiNs 6CzYLvA6TfcMb1/zvwkCLU1C7nioq7U1KzlZ53XFqLO8RJIHn7BxOeqK2GAy41QvVhP9 sqqXp5NJ75OWZYYpcbJHKvlK0kasU+pdVBNUor1TH5kmjYR5d0NH2W+/1S3Tqrie0pa3 4Kcgz+PT1bsU/bYrW8qXtuIZGXZx+tC9cnHLTRGJBtudQiHY40GbkKxlmn1j5eSkLhNe TK3cOQ/Kux0SupCz81JqYkiUJjxRd+6CQR/ARomRsDjJj+H8MoPzGGR6GUh+yqwdQ5wj 3sOw== 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=VxBSH+vrvjCNahfAjpGKgMvfiRPTMPo1u7N+uDDjr+U=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=K0bOTiGl+5SoYdKuCYdgWfiUUsn7xlfccSRzNvACQ0oEoYAcyw0QJ56cYeP3wQ6PYH KgR8sewzraGbpyS3dgMjFGOp4cus9jyqBBlGALkFrMyheMeUaw2lryrMyhRr7K/v0WBW mHHrTKpmlWJGVoFej8aPADxF8avyAjCgBAdUzHa0MqOg9Usr2cOwtvuoUmIqzVhzwLGt XjAHklIIfUIIddb957q6OLued9jP0vfY77EpHhZ/eXla2WLqu82kNaH/LmI4C/CGUZ+U LQN7h46pkJAmuDwex7vgzjaOX4S9GxEoRpq+p82vN2Q8+1XuVKpQw4aAStFCss/e06R/ JHTA== 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 b26-20020a170906039a00b00992d262f9f7si2002959eja.933.2023.07.21.02.35.44; Fri, 21 Jul 2023 02:36:08 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231695AbjGUJKL (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Fri, 21 Jul 2023 05:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231407AbjGUJJn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Jul 2023 05:09:43 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A19E92D7E; Fri, 21 Jul 2023 02:09:42 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4R6kJy46JNz4f3wRh; Fri, 21 Jul 2023 17:09:38 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrFPS7pkqi7fOQ--.527S10; Fri, 21 Jul 2023 17:09:39 +0800 (CST) From: Kemeng Shi <shikemeng@huaweicloud.com> To: tytso@mit.edu, adilger.kernel@dilger.ca, ritesh.list@gmail.com, ojaswin@linux.ibm.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 08/10] ext4: return found group directly in ext4_mb_choose_next_group_goal_fast Date: Sat, 22 Jul 2023 01:10:05 +0800 Message-Id: <20230721171007.2065423-9-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230721171007.2065423-1-shikemeng@huaweicloud.com> References: <20230721171007.2065423-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHvrFPS7pkqi7fOQ--.527S10 X-Coremail-Antispam: 1UD129KBjvdXoWrZFykAr45Wry5CFWxAFy7KFg_yoWDWFX_Ja 47AFs3AayrAw18G3W09wnYyr48KF4kAr4DXry3tr45X3WUuFWkKw1q9r4rAay7ua1jvryf Gas0qFWxGF4SqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVWxJVW8Jr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRvJPtU UUUU= 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, KHOP_HELO_FCRDNS,MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772022313628210925 X-GMAIL-MSGID: 1772022313628210925 |
Series |
A few fixes and cleanups to mballoc
|
|
Commit Message
Kemeng Shi
July 21, 2023, 5:10 p.m. UTC
Return good group when it's found in loop to remove futher check if good
group is found after loop.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
fs/ext4/mballoc.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Comments
Kemeng Shi <shikemeng@huaweicloud.com> writes: > Return good group when it's found in loop to remove futher check if good > group is found after loop. > > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com> > --- > fs/ext4/mballoc.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) Looks good to me, feel free to add: Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> -ritesh > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 412d335583fe..6f8e804905d5 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -960,16 +960,14 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context * > for (i = mb_avg_fragment_size_order(ac->ac_sb, ac->ac_g_ex.fe_len); > i < MB_NUM_ORDERS(ac->ac_sb); i++) { > grp = ext4_mb_find_good_group_avg_frag_lists(ac, i); > - if (grp) > - break; > + if (grp) { > + *group = grp->bb_group; > + ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED; > + return; > + } > } > > - if (grp) { > - *group = grp->bb_group; > - ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED; > - } else { > - *new_cr = CR_BEST_AVAIL_LEN; > - } > + *new_cr = CR_BEST_AVAIL_LEN; > } > > /* > -- > 2.30.0
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 412d335583fe..6f8e804905d5 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -960,16 +960,14 @@ static void ext4_mb_choose_next_group_goal_fast(struct ext4_allocation_context * for (i = mb_avg_fragment_size_order(ac->ac_sb, ac->ac_g_ex.fe_len); i < MB_NUM_ORDERS(ac->ac_sb); i++) { grp = ext4_mb_find_good_group_avg_frag_lists(ac, i); - if (grp) - break; + if (grp) { + *group = grp->bb_group; + ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED; + return; + } } - if (grp) { - *group = grp->bb_group; - ac->ac_flags |= EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED; - } else { - *new_cr = CR_BEST_AVAIL_LEN; - } + *new_cr = CR_BEST_AVAIL_LEN; } /*