|
@@ -17,6 +17,7 @@
|
|
#include <linux/module.h>
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/vmalloc.h>
|
|
#include <linux/vmalloc.h>
|
|
|
|
+#include <linux/log2.h>
|
|
|
|
|
|
#include "dm-snap.h"
|
|
#include "dm-snap.h"
|
|
#include "dm-bio-list.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);
|
|
chunk_size = round_up(chunk_size, PAGE_SIZE >> 9);
|
|
|
|
|
|
/* Check chunk_size is a power of 2 */
|
|
/* 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";
|
|
*error = "Chunk size is not a power of 2";
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
}
|
|
}
|