Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10628479rwp; Fri, 21 Jul 2023 02:14:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlHgS4KcJANA7xNI3mrbNNbtH2NpB2qPsUPisfg3MbAgroKPmjNlKuZ2QYTM7bgNfWuSJbk5 X-Received: by 2002:a17:907:771a:b0:993:d617:bdc5 with SMTP id kw26-20020a170907771a00b00993d617bdc5mr1207221ejc.37.1689930861494; Fri, 21 Jul 2023 02:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689930861; cv=none; d=google.com; s=arc-20160816; b=NlyOtYnoRAz3U7AS0m5QE4DTQGgIIvHgId1IFIuipBKutVDtr1o1qr8f+abbHmvMt0 ADQi23i2kEyDtWVtZqs1HAbpEDjZGng8VjrnR1dYACqoctyO4hsVsfHq14Abv/FEbxgO 4qlOHJR4BbtelJC3Lh418C9DgCyYWoi7Q2OJ82jifeHGEBXC2rdJeMtgZAWJfkLDmqt/ C+HIt9UVKfTDOzkvmsUXoYOJFmyFjCC9Tw8VQrX2F+3n/fg4XdYiJ8jIYZuMq0qdpVGk HDI55bEQSoL4RgfZc7Lh98ywQoATEhbIsh0qE9Dcj8iRW0Jkw/Jbi1e5Z6CKTrNJQCXu XozA== 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=ylLZU6PXbMpwQ6lvleHo0lBP+vVxkO1xJLXMXj0o/ZWlT/u4UZWj7YqXog483GcU2l RzvEEyZEbqk/Cu6X7NupPFpDaHbEADiYL7Ms26s2YLfIHSlLsKi2Dn33vwAkkYz0xcLo JuReq8wq0B1/NV7MLSoi0zLUaGLKgy+neNoARiNZAmQ8fmx8FPOoJwAtzaF81lWK0XJO dyplfubXYQqqktA4wvciu4WgAGOhsRBMaNeIB2Iz8lzWbzxEu9rtTD8MDhn3AtvhYCub 0AyuIvp10IwCNeRcZMF0hgXkphXP6vNpmRJPJM2oEbyTXD1BblC1029YfLW4JyMxNooA DeCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a1709062c0900b00993a9a951f9si1861992ejh.28.2023.07.21.02.13.57; Fri, 21 Jul 2023 02:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231616AbjGUJJv (ORCPT + 99 others); Fri, 21 Jul 2023 05:09:51 -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 ); 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 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: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- fs/ext4/mballoc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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