From: Kemeng Shi Date: Tue, 1 Aug 2023 14:31:58 +0000 (+0800) Subject: ext4: use is_power_of_2 helper in ext4_mb_regular_allocator X-Git-Tag: v6.6.7~1886^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb60caa2db6697c20a0842b5b3c192aa1800da1a;p=platform%2Fkernel%2Flinux-starfive.git ext4: use is_power_of_2 helper in ext4_mb_regular_allocator Use intuitive is_power_of_2 helper in ext4_mb_regular_allocator. Signed-off-by: Kemeng Shi Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/r/20230801143204.2284343-5-shikemeng@huaweicloud.com Signed-off-by: Theodore Ts'o --- diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 880b973..3dd2609 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2799,10 +2799,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)); }