Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10628883rwp; Fri, 21 Jul 2023 02:14:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlG1UDEUAMQqsr3qds5DkNK4CuEgr48M0ciXSXQuuPOixMLwh8yS5PGT10Ejd/ElIOgk1ccC X-Received: by 2002:ac2:5225:0:b0:4fa:ce08:a9d0 with SMTP id i5-20020ac25225000000b004face08a9d0mr740669lfl.57.1689930892693; Fri, 21 Jul 2023 02:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689930892; cv=none; d=google.com; s=arc-20160816; b=xDqkQjoYdjb6AeZJVeB2DZTHQXMeMM2vZC77PlIRbyD3ZIjG/z8pJTnmYZiNntgofP 8fMTaqTbCpbiopvMlg21j6HTc+/J087bq/xu3+4p76hGVydBMhPsIIHqjd88mYbFXt8y mslE4DMl654+5ii4Eq+mKUHvAAxWio+yXTyyTnKtv4nvNyi2bHaaIbXW8vTRqcMGlgZn LVZ+hy8gv/2uzGac6hGM2hmaaWfDQhnOul6DFYQblbtBn8mgD8wC5uOpFs2wC1ICXv9b J8SlrO3bt1Yilr5NuqGPGVxSCYwR9X58QspIxfPYEu01j1pI1X6+jxvNN2vinH188B+3 7rAQ== 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=5DT9OI3Wwc6ZScG6Kc/ZdvUyDgrqJpfUyDixGCeXroU=; fh=MlGqaUnvBjpXmiP990bdf+mzv9VjPrVaE5OVdv29XYE=; b=rhm/RRn01Uceo+hFolghblAZXSfF1n/4P4jOBiS2BuAsLOofnna22WZ+YBULiWONtf rig8ABwH7C/7qImJP7c/bTXeTJQbutnbNoPxsFV9TU+exlwVNGT8zWtMRO5gczZBJ2I3 psVBkgxBYgcWyXlXGL55jcv1qGUlamti/Tp+7SfZZgKaWz2uG5kQh+O0KJb24l8djrEs A0cEZK0n6alA91BM4ALSxordGAJaabVRZJ3L+WIAMkpgDYv0NHpEhRQWcIEr6lNsok4N FToI7tdDhHa48Gt+tICIp7fI/LIUU5VEhC0tN7839tewsgPTsP00D1vW7ER6YiK9h3dN 3e8g== 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 v23-20020aa7cd57000000b0051dec563f99si2187650edw.73.2023.07.21.02.14.21; Fri, 21 Jul 2023 02:14:52 -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 S231516AbjGUJJq (ORCPT + 99 others); Fri, 21 Jul 2023 05:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbjGUJJm (ORCPT ); Fri, 21 Jul 2023 05:09:42 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D69ED2D7F; Fri, 21 Jul 2023 02:09:40 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4R6kJv3g8Xz4f3s6K; Fri, 21 Jul 2023 17:09:35 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgAHvrFPS7pkqi7fOQ--.527S6; Fri, 21 Jul 2023 17:09:37 +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 04/10] ext4: use is_power_of_2 helper in ext4_mb_regular_allocator Date: Sat, 22 Jul 2023 01:10:01 +0800 Message-Id: <20230721171007.2065423-5-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--.527S6 X-Coremail-Antispam: 1UD129KBjvdXoW7GF1rJr1UWFWDKFy7Xr1rCrg_yoW3uFb_Ga 4UCr4kGFWfJr1xC3ZYyF4kt3s0qFn3AF45XFs3JrZxZF1UZFWxKw1Dtrs3Zr48Wr47ZrZ3 Wa43GFW0yasa9jkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbDkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AK xVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr 1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRiVbyDUU UUU== 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 Use intuitive is_power_of_2 helper in ext4_mb_regular_allocator. Signed-off-by: Kemeng Shi --- fs/ext4/mballoc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 4031f8e2a660..b838944b5f09 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2795,10 +2795,7 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac) * requests upto maximum buddy size we have constructed. */ if (i >= sbi->s_mb_order2_reqs && i <= MB_NUM_ORDERS(sb)) { - /* - * This should tell if fe_len is exactly power of 2 - */ - if ((ac->ac_g_ex.fe_len & (~(1 << (i - 1)))) == 0) + if (is_power_of_2(ac->ac_g_ex.fe_len)) ac->ac_2order = array_index_nospec(i - 1, MB_NUM_ORDERS(sb)); } -- 2.30.0