Message ID | 20230721171007.2065423-10-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 l16csp77601vqg; Fri, 21 Jul 2023 02:24:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLpo9T4SkkvBsuG5DB4C2nHzVg5gfsy/+Im8EWNAY9lde61pie0G0dquCBEJp9M3v5QEvu X-Received: by 2002:a50:fa91:0:b0:51e:1692:1111 with SMTP id w17-20020a50fa91000000b0051e16921111mr1043321edr.3.1689931467774; Fri, 21 Jul 2023 02:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689931467; cv=none; d=google.com; s=arc-20160816; b=lzs31U/omMSK8m6CMn9ZuJkbET7U0pR/up0YAmcHiICsGPXNCdTUqkoO0vxd/CHlHo jNzTrGdcIfJoP3zVlkaq+FiyGQPZd2MfMeiJBNyMvnllj3Qs/Fw3urS0iHZVyfGEGr0s pPC6HkRJGTQt+iUBIIZ5Doe45w7IIGPAvMwFPKeI9EDzyvu/6CCCL3WaRgcY+fohZ8xC IslwuiFVGZcoxTf4+H6omjLqwssFZINPi+gsoJ1oiv5RCS5ydkQNrSRE6H9ETIccmQDb C2TQOXwE17gd28DqBiYNzVm9suTLbicRQHwn6SoPTZDWPqf35YBtbuD6OWdl/cyukBKy VOpw== 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=a6rlyf5OsSn4vMohd9fdFn0hbfv0Ek+BXiN5b1akbWI=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=KRsKN+TuRESt4d/cY0zTxxYl92GzoznzCixStTQ3/e1IrZ4RiKmvS+318lZzmphtQU uflq+gJfQSRZgiGq/YddpKiTekzkX0+c6NIdhZP93Dz/8EZ/yHbgi8SWJkQkQ+4QM/gn 6QVWCEcGOTHjiDWgHlndS+e7jyMXrTfnn2kXuSRbFpcnO3+xzuLnzmGrzFKWcdKtDj43 e47KiyX8lKLfK34QNHD4eHnP/sgSg8npBXQhgkWjTE4TG96hV96a+RxSemZChoXIRKgw QMF8X41ipiZjHecCr4G7xBiq1Zu+bWvcrZQyfeJIB1K7mbXiHxZQrLCovUQKPsIJJfQ2 grvg== 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 o14-20020aa7d3ce000000b0051df7bb12d4si2035567edr.525.2023.07.21.02.24.02; Fri, 21 Jul 2023 02:24:27 -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 S231643AbjGUJKF (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Fri, 21 Jul 2023 05:10:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231403AbjGUJJn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Jul 2023 05:09:43 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70EE01984; Fri, 21 Jul 2023 02:09:42 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4R6kJx2ck9z4f3q35; Fri, 21 Jul 2023 17:09:37 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrFPS7pkqi7fOQ--.527S11; 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 09/10] ext4: return found group directly in ext4_mb_choose_next_group_best_avail Date: Sat, 22 Jul 2023 01:10:06 +0800 Message-Id: <20230721171007.2065423-10-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--.527S11 X-Coremail-Antispam: 1UD129KBjvJXoW7ArykJw1DKF4DJr45ZF4kXrb_yoW8JFWrpr n3WF1I9Fn7W3W5JFsrGaykW3WIkw4xKFy8tryrZw1rJFy3JFWkGanrta40vF97CrWkCFn8 Zw4ktrySkF17u3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_JF0E3s1l82xGYIkIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0 rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6x IIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xv wVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFc xC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_ Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2 IErcIFxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Cr0_Gr1UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JV WxJwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjTRKfOw UUUUU 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772021578707763216 X-GMAIL-MSGID: 1772021578707763216 |
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 | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 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 | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 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 6f8e804905d5..b04eceeab967 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -1043,18 +1043,16 @@ static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context > ac->ac_g_ex.fe_len); > > grp = ext4_mb_find_good_group_avg_frag_lists(ac, frag_order); > - if (grp) > - break; > + if (grp) { > + *group = grp->bb_group; > + ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED; > + return; > + } > } > > - if (grp) { > - *group = grp->bb_group; > - ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED; > - } else { > - /* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */ > - ac->ac_g_ex.fe_len = ac->ac_orig_goal_len; > - *new_cr = CR_GOAL_LEN_SLOW; > - } > + /* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */ > + ac->ac_g_ex.fe_len = ac->ac_orig_goal_len; > + *new_cr = CR_GOAL_LEN_SLOW; > } > > static inline int should_optimize_scan(struct ext4_allocation_context *ac) > -- > 2.30.0
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 6f8e804905d5..b04eceeab967 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1043,18 +1043,16 @@ static void ext4_mb_choose_next_group_best_avail(struct ext4_allocation_context ac->ac_g_ex.fe_len); grp = ext4_mb_find_good_group_avg_frag_lists(ac, frag_order); - if (grp) - break; + if (grp) { + *group = grp->bb_group; + ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED; + return; + } } - if (grp) { - *group = grp->bb_group; - ac->ac_flags |= EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED; - } else { - /* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */ - ac->ac_g_ex.fe_len = ac->ac_orig_goal_len; - *new_cr = CR_GOAL_LEN_SLOW; - } + /* Reset goal length to original goal length before falling into CR_GOAL_LEN_SLOW */ + ac->ac_g_ex.fe_len = ac->ac_orig_goal_len; + *new_cr = CR_GOAL_LEN_SLOW; } static inline int should_optimize_scan(struct ext4_allocation_context *ac)