Skip to content

Commit

Permalink
md/raid5: Use is_power_of_2() in raid5_reconfig()/raid6_reconfig().
Browse files Browse the repository at this point in the history
Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
Andre Noll authored and NeilBrown committed Jun 17, 2009
1 parent 09c9e5f commit 0ba459d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -5167,8 +5167,7 @@ static int raid5_reconfig(mddev_t *mddev, int new_layout, int new_chunk)
if (new_layout >= 0 && !algorithm_valid_raid5(new_layout))
return -EINVAL;
if (new_chunk > 0) {
if (new_chunk & (new_chunk-1))
/* not a power of 2 */
if (!is_power_of_2(new_chunk))
return -EINVAL;
if (new_chunk < PAGE_SIZE)
return -EINVAL;
Expand Down Expand Up @@ -5206,8 +5205,7 @@ static int raid6_reconfig(mddev_t *mddev, int new_layout, int new_chunk)
if (new_layout >= 0 && !algorithm_valid_raid6(new_layout))
return -EINVAL;
if (new_chunk > 0) {
if (new_chunk & (new_chunk-1))
/* not a power of 2 */
if (!is_power_of_2(new_chunk))
return -EINVAL;
if (new_chunk < PAGE_SIZE)
return -EINVAL;
Expand Down

0 comments on commit 0ba459d

Please sign in to comment.