diff options
author | vignesh babu <vignesh.babu@wipro.com> | 2007-10-19 22:38:44 +0100 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2007-10-20 02:01:06 +0100 |
commit | 6f3c3f0afa50782dc1742c968646c491657d255a (patch) | |
tree | cb1f69504094cec60564be51c405bba5eb66c322 /drivers/md/dm-stripe.c | |
parent | ae9da83f6d800fe1f3b23bfbc8f7222ad1c5bb74 (diff) | |
download | kernel_goldelico_gta04-6f3c3f0afa50782dc1742c968646c491657d255a.zip kernel_goldelico_gta04-6f3c3f0afa50782dc1742c968646c491657d255a.tar.gz kernel_goldelico_gta04-6f3c3f0afa50782dc1742c968646c491657d255a.tar.bz2 |
dm: use is_power_of_2
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-stripe.c')
-rw-r--r-- | drivers/md/dm-stripe.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 51f5e07..969944a 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c @@ -11,6 +11,7 @@ #include <linux/blkdev.h> #include <linux/bio.h> #include <linux/slab.h> +#include <linux/log2.h> #define DM_MSG_PREFIX "striped" @@ -99,7 +100,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) /* * chunk_size is a power of two */ - if (!chunk_size || (chunk_size & (chunk_size - 1)) || + if (!is_power_of_2(chunk_size) || (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { ti->error = "Invalid chunk size"; return -EINVAL; |