Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71715
b: refs/heads/master
c: 6f3c3f0
h: refs/heads/master
i:
  71713: f787523
  71711: b2d47d3
v: v3
  • Loading branch information
vignesh babu authored and Alasdair G Kergon committed Oct 20, 2007
1 parent f71b169 commit bf4cd3b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae9da83f6d800fe1f3b23bfbc8f7222ad1c5bb74
refs/heads/master: 6f3c3f0afa50782dc1742c968646c491657d255a
3 changes: 2 additions & 1 deletion trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/time.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/log2.h>

#define DM_MSG_PREFIX "raid1"
#define DM_IO_PAGES 64
Expand Down Expand Up @@ -995,7 +996,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti,

static inline int _check_region_size(struct dm_target *ti, uint32_t size)
{
return !(size % (PAGE_SIZE >> 9) || (size & (size - 1)) ||
return !(size % (PAGE_SIZE >> 9) || !is_power_of_2(size) ||
size > ti->len);
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/md/dm-stripe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit bf4cd3b

Please sign in to comment.