Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5300239rwb; Mon, 31 Jul 2023 23:32:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlEZXJKfLrd0bphtcB1PzYzZVWBWF+f2AfxS+RyGv4B/zWemcA5eKf+gO4a+U1oECStPOHmI X-Received: by 2002:a05:6808:130b:b0:3a3:9ae0:efe2 with SMTP id y11-20020a056808130b00b003a39ae0efe2mr14730786oiv.20.1690871560750; Mon, 31 Jul 2023 23:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690871560; cv=none; d=google.com; s=arc-20160816; b=U+8mgvEDLvKpTJby05iZAWNeSzwLw6KuQnp8XrTLCRK55EPzlAIpsKVdP7PTgImeQj CL5OhdJ6HKbD4SX7RS6DKumI2hHw1cylvJ2eEmxOFmpPAr7eSihSAJIan90Ajp8SK/lE Dvx2lJScHdaB8HK5SZBk3eeP2o1w91itSVu4lrQy/CKoRpJttVj+P3PD5ScF1VWe82vp c+emFeMQhfrn1DckHnoliSbGdsOmFeCA3Ib9JgUGPs6bv0DIamDoLmgRSBGrKfq+1jRX wQD92uGT8rOZCj8Z/tv48ByFfX7vGzDGgnoYXfCbkCtsOtXYsqN8zq+K6wOyEARhqKGK D0OQ== 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=4TyZipRKFuLrunU29wcodWazWx5eTViSoMVXB2q6kwI=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=xMY+6Xr/PXgOSuC9GHgvrzBSMQEZ1VgEukm4WkCTVRoRS+nemK+7YeuVbc72DSCkeu cTh5vdmvSqhFEKtYCXsDnvFrSb4QpUA/cbp4AdVbVPiL3HQNfEajB3zJU7pdQTWkWxlj WNjx3nCj3N34UBUFEOleFP8kdG8sqqBr4LowVL9NSVcaDu9OPuvh9sg/r1Of6frzgfGH 22piq5CcOkS36KikxbpCAbI82zH4dxYDAwzszxE+i6rZCnmzGlOoyunxLCuh1ayJluwF L7DpuJEyFPPGfQXrkKEoyivGxlmCD1pS3zA8N81hJsNzPcxBgTOBUp8gYETgw8+PmdD4 Df1g== 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 b26-20020a6567da000000b0056428dcea78si5363025pgs.17.2023.07.31.23.32.27; Mon, 31 Jul 2023 23:32:40 -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 S231691AbjHAGcF (ORCPT + 99 others); Tue, 1 Aug 2023 02:32:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231516AbjHAGbz (ORCPT ); Tue, 1 Aug 2023 02:31:55 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 975C3DB; Mon, 31 Jul 2023 23:31:53 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RFQHn3B1Jz4f4YQZ; Tue, 1 Aug 2023 14:31:49 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgDnjOrQpshkMcvqPA--.21719S10; Tue, 01 Aug 2023 14:31:50 +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 v3 08/10] ext4: return found group directly in ext4_mb_choose_next_group_goal_fast Date: Tue, 1 Aug 2023 22:32:02 +0800 Message-Id: <20230801143204.2284343-9-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230801143204.2284343-1-shikemeng@huaweicloud.com> References: <20230801143204.2284343-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgDnjOrQpshkMcvqPA--.21719S10 X-Coremail-Antispam: 1UD129KBjvdXoWrZFykAr45Wry5CFWxAFy5Arb_yoWDKrb_Ga 47AFsayFWfAw18G3WF9wsYyr48KFWkAr4DXry3tr4Yq3WUuaykK3Wq9r45Aa18ua10yrWf Ka9IvFWxKF4SvjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVWxJr0_GcWl84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vE x4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I64 8v4I1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AK xVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrx kI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v2 6F4j6r4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr 1lIxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0pRvJPtU 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, RCVD_IN_DNSWL_BLOCKED,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 Reviewed-by: Ritesh Harjani (IBM) --- 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 35b7a0ba25a3..e9e37ffe5c10 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -959,16 +959,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