diff options
author | Vignesh Babu BM <vignesh.babu@wipro.com> | 2007-05-08 00:24:27 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 11:14:59 -0700 |
commit | e7d709c096487078652a1384d7a2d0e4459e18b6 (patch) | |
tree | fff2b8ecac3e9611182e83a21e95130d1cba308a /fs/fat | |
parent | 4fa156ea846daae44d60b05ea066d0e28fd3b6c4 (diff) | |
download | blackbird-op-linux-e7d709c096487078652a1384d7a2d0e4459e18b6.tar.gz blackbird-op-linux-e7d709c096487078652a1384d7a2d0e4459e18b6.zip |
is_power_of_2 in fat
Replacing (n & (n-1)) in the context of power of 2 checks with
is_power_of_2
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat')
-rw-r--r-- | fs/fat/inode.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 65cb54bde481..a8129e82d594 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -25,6 +25,7 @@ #include <linux/parser.h> #include <linux/uio.h> #include <linux/writeback.h> +#include <linux/log2.h> #include <asm/unaligned.h> #ifndef CONFIG_FAT_DEFAULT_IOCHARSET @@ -1217,8 +1218,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, } logical_sector_size = le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); - if (!logical_sector_size - || (logical_sector_size & (logical_sector_size - 1)) + if (!is_power_of_2(logical_sector_size) || (logical_sector_size < 512) || (PAGE_CACHE_SIZE < logical_sector_size)) { if (!silent) @@ -1228,8 +1228,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, goto out_invalid; } sbi->sec_per_clus = b->sec_per_clus; - if (!sbi->sec_per_clus - || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) { + if (!is_power_of_2(sbi->sec_per_clus)) { if (!silent) printk(KERN_ERR "FAT: bogus sectors per cluster %u\n", sbi->sec_per_clus); |