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:
vignesh babu
2007-10-19 22:38:44 +01:00
committed by Alasdair G Kergon
parent ae9da83f6d
commit 6f3c3f0afa
3 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/log2.h>
#include "dm-snap.h"
#include "dm-bio-list.h"
@ -415,7 +416,7 @@ static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg,
chunk_size = round_up(chunk_size, PAGE_SIZE >> 9);
/* Check chunk_size is a power of 2 */
if (chunk_size & (chunk_size - 1)) {
if (!is_power_of_2(chunk_size)) {
*error = "Chunk size is not a power of 2";
return -EINVAL;
}