summaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorVignesh Babu BM <vignesh.babu@wipro.com>2007-05-08 00:24:32 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 11:14:59 -0700
commit1368c4f2482c9e06bcb297217433818b171cc9e3 (patch)
tree0b9da8f7841e370cb44de9504843591a223b8c1d /fs/block_dev.c
parente1b5c1d3da05c91129120d045dfcdfc7761f44f1 (diff)
downloadlwn-1368c4f2482c9e06bcb297217433818b171cc9e3.tar.gz
lwn-1368c4f2482c9e06bcb297217433818b171cc9e3.zip
is_power_of_2 in fs/block_dev.c
Replace (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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index f02b7bdd9864..742899240872 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -22,6 +22,7 @@
#include <linux/mount.h>
#include <linux/uio.h>
#include <linux/namei.h>
+#include <linux/log2.h>
#include <asm/uaccess.h>
#include "internal.h"
@@ -67,7 +68,7 @@ static void kill_bdev(struct block_device *bdev)
int set_blocksize(struct block_device *bdev, int size)
{
/* Size must be a power of two, and between 512 and PAGE_SIZE */
- if (size > PAGE_SIZE || size < 512 || (size & (size-1)))
+ if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
return -EINVAL;
/* Size cannot be smaller than the size supported by the device */