Skip to content

Commit 1330593

Browse files
Vignesh Babutytso
authored andcommitted
ext4: Use is_power_of_2()
Replace (n & (n-1)) in the context of power of 2 checks with is_power_of_2() Signed-off-by: Vignesh Babu <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Dave Kleikamp <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent fc0e15a commit 1330593

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext4/super.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <linux/namei.h>
3737
#include <linux/quotaops.h>
3838
#include <linux/seq_file.h>
39+
#include <linux/log2.h>
3940

4041
#include <asm/uaccess.h>
4142

@@ -1644,7 +1645,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
16441645
sbi->s_inode_size = le16_to_cpu(es->s_inode_size);
16451646
sbi->s_first_ino = le32_to_cpu(es->s_first_ino);
16461647
if ((sbi->s_inode_size < EXT4_GOOD_OLD_INODE_SIZE) ||
1647-
(sbi->s_inode_size & (sbi->s_inode_size - 1)) ||
1648+
(!is_power_of_2(sbi->s_inode_size)) ||
16481649
(sbi->s_inode_size > blocksize)) {
16491650
printk (KERN_ERR
16501651
"EXT4-fs: unsupported inode size: %d\n",

0 commit comments

Comments
 (0)