aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fat
diff options
context:
space:
mode:
authorVignesh Babu BM <vignesh.babu@wipro.com>2007-05-08 03:24:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:59 -0400
commite7d709c096487078652a1384d7a2d0e4459e18b6 (patch)
treefff2b8ecac3e9611182e83a21e95130d1cba308a /fs/fat
parent4fa156ea846daae44d60b05ea066d0e28fd3b6c4 (diff)
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.c7
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 @@
25#include <linux/parser.h> 25#include <linux/parser.h>
26#include <linux/uio.h> 26#include <linux/uio.h>
27#include <linux/writeback.h> 27#include <linux/writeback.h>
28#include <linux/log2.h>
28#include <asm/unaligned.h> 29#include <asm/unaligned.h>
29 30
30#ifndef CONFIG_FAT_DEFAULT_IOCHARSET 31#ifndef CONFIG_FAT_DEFAULT_IOCHARSET
@@ -1217,8 +1218,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
1217 } 1218 }
1218 logical_sector_size = 1219 logical_sector_size =
1219 le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); 1220 le16_to_cpu(get_unaligned((__le16 *)&b->sector_size));
1220 if (!logical_sector_size 1221 if (!is_power_of_2(logical_sector_size)
1221 || (logical_sector_size & (logical_sector_size - 1))
1222 || (logical_sector_size < 512) 1222 || (logical_sector_size < 512)
1223 || (PAGE_CACHE_SIZE < logical_sector_size)) { 1223 || (PAGE_CACHE_SIZE < logical_sector_size)) {
1224 if (!silent) 1224 if (!silent)
@@ -1228,8 +1228,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
1228 goto out_invalid; 1228 goto out_invalid;
1229 } 1229 }
1230 sbi->sec_per_clus = b->sec_per_clus; 1230 sbi->sec_per_clus = b->sec_per_clus;
1231 if (!sbi->sec_per_clus 1231 if (!is_power_of_2(sbi->sec_per_clus)) {
1232 || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) {
1233 if (!silent) 1232 if (!silent)
1234 printk(KERN_ERR "FAT: bogus sectors per cluster %u\n", 1233 printk(KERN_ERR "FAT: bogus sectors per cluster %u\n",
1235 sbi->sec_per_clus); 1234 sbi->sec_per_clus);