All of lore.kernel.org
 help / color / mirror / Atom feed
* + is_power_of_2-in-fat.patch added to -mm tree
@ 2007-02-25 12:27 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2007-02-25 12:27 UTC (permalink / raw)
  To: mm-commits; +Cc: vignesh.babu, hirofumi


The patch titled
     is_power_of_2 in fat
has been added to the -mm tree.  Its filename is
     is_power_of_2-in-fat.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: is_power_of_2 in fat
From: Vignesh Babu BM <vignesh.babu@wipro.com>

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>
---

 fs/fat/inode.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff -puN fs/fat/inode.c~is_power_of_2-in-fat fs/fat/inode.c
--- a/fs/fat/inode.c~is_power_of_2-in-fat
+++ a/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 *s
 	}
 	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 *s
 		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);
_

Patches currently in -mm which might be from vignesh.babu@wipro.com are

is_power_of_2-in-fat.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-25 12:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-25 12:27 + is_power_of_2-in-fat.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.