md/raid5: Use is_power_of_2() in raid5_reconfig()/raid6_reconfig().

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, June 18, 2009 - 3:01 pm

Gitweb:     http://git.kernel.org/linus/0ba459d26260d4d13346c76642f461b2bf607eef
Commit:     0ba459d26260d4d13346c76642f461b2bf607eef
Parent:     09c9e5fa1b93ad5b81c9dcf8ce3a5b9ae2ac31e4
Author:     Andre Noll <maan@systemlinux.org>
AuthorDate: Thu Jun 18 08:46:10 2009 +1000
Committer:  NeilBrown <neilb@suse.de>
CommitDate: Thu Jun 18 08:46:10 2009 +1000

    md/raid5: Use is_power_of_2() in raid5_reconfig()/raid6_reconfig().
    
    Signed-off-by: Andre Noll <maan@systemlinux.org>
    Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/md/raid5.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index eaa2d3e..72e8a32 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -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;
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
md/raid5: Use is_power_of_2() in raid5_reconfig()/raid6_re ..., Linux Kernel Mailing ..., (Thu Jun 18, 3:01 pm)