[PATCH] MD: use is_power_of_2 macro
am 08.06.2011 20:01:10 von Jonathan Brassow
Make use of is_power_of_2 macro.
Signed-off-by: Jonathan Brassow
Index: linux-2.6/drivers/md/bitmap.c
============================================================ =======
--- linux-2.6.orig/drivers/md/bitmap.c
+++ linux-2.6/drivers/md/bitmap.c
@@ -651,7 +651,7 @@ static int bitmap_read_sb(struct bitmap
reason = "unrecognized superblock version";
else if (chunksize < 512)
reason = "bitmap chunksize too small";
- else if ((1 << ffz(~chunksize)) != chunksize)
+ else if (!is_power_of_2(chunksize))
reason = "bitmap chunksize not a power of 2";
else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT)
reason = "daemon sleep period out of range";
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] MD: use is_power_of_2 macro
am 09.06.2011 03:44:27 von NeilBrown
On Wed, 08 Jun 2011 13:01:10 -0500 Jonathan Brassow
wrote:
> Make use of is_power_of_2 macro.
>
> Signed-off-by: Jonathan Brassow
>
> Index: linux-2.6/drivers/md/bitmap.c
> ============================================================ =======
> --- linux-2.6.orig/drivers/md/bitmap.c
> +++ linux-2.6/drivers/md/bitmap.c
> @@ -651,7 +651,7 @@ static int bitmap_read_sb(struct bitmap
> reason = "unrecognized superblock version";
> else if (chunksize < 512)
> reason = "bitmap chunksize too small";
> - else if ((1 << ffz(~chunksize)) != chunksize)
> + else if (!is_power_of_2(chunksize))
> reason = "bitmap chunksize not a power of 2";
> else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT)
> reason = "daemon sleep period out of range";
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jon,
thanks for this and the others.
I'll push them into my 'for-next' branch today so they should appear in -next
soon. I expect to send a pull request to Linus on Tuesday - after the long
weekend.
Thanks,
NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html