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>
This commit is contained in:
committed by
Alasdair G Kergon
parent
ae9da83f6d
commit
6f3c3f0afa
@@ -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;
|
||||
|
Reference in New Issue
Block a user