* [PATCH]is_power_of_2-ufs/super.c
@ 2007-06-14 8:09 vignesh babu
2007-06-14 17:50 ` [PATCH]is_power_of_2-ufs/super.c Evgeniy Dushistov
2007-06-25 12:13 ` [PATCH]is_power_of_2-ufs/super.c Johannes Weiner
0 siblings, 2 replies; 5+ messages in thread
From: vignesh babu @ 2007-06-14 8:09 UTC (permalink / raw)
To: daniel.pirkl, dushistov; +Cc: linux-kernel, Kernel Janitors List
Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
---
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 22ff6ed..2b30116 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -87,6 +87,7 @@
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include <linux/vfs.h>
+#include <linux/log2.h>
#include "swab.h"
#include "util.h"
@@ -854,7 +855,7 @@ magic_found:
uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
- if (uspi->s_fsize & (uspi->s_fsize - 1)) {
+ if (!is_power_of_2(uspi->s_fsize)) {
printk(KERN_ERR "ufs_read_super: fragment size %u is not a power of 2\n",
uspi->s_fsize);
goto failed;
@@ -869,7 +870,7 @@ magic_found:
uspi->s_fsize);
goto failed;
}
- if (uspi->s_bsize & (uspi->s_bsize - 1)) {
+ if (!is_power_of_2(uspi->s_bsize)) {
printk(KERN_ERR "ufs_read_super: block size %u is not a power of 2\n",
uspi->s_bsize);
goto failed;
--
Vignesh Babu BM
_____________________________________________________________
"Why is it that every time I'm with you, makes me believe in magic?"
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH]is_power_of_2-ufs/super.c
2007-06-14 8:09 [PATCH]is_power_of_2-ufs/super.c vignesh babu
@ 2007-06-14 17:50 ` Evgeniy Dushistov
2007-06-25 12:13 ` [PATCH]is_power_of_2-ufs/super.c Johannes Weiner
1 sibling, 0 replies; 5+ messages in thread
From: Evgeniy Dushistov @ 2007-06-14 17:50 UTC (permalink / raw)
To: vignesh babu, akpm; +Cc: daniel.pirkl, linux-kernel, Kernel Janitors List
On Thu, Jun 14, 2007 at 01:39:18PM +0530, vignesh babu wrote:
>
>
> Replacing (n & (n-1)) in the context of power of 2 checks
> with is_power_of_2
>
> Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Acked-by: Evgeniy Dushistov <dushistov@mail.ru>
> ---
> diff --git a/fs/ufs/super.c b/fs/ufs/super.c
> index 22ff6ed..2b30116 100644
> --- a/fs/ufs/super.c
> +++ b/fs/ufs/super.c
> @@ -87,6 +87,7 @@
> #include <linux/smp_lock.h>
> #include <linux/buffer_head.h>
> #include <linux/vfs.h>
> +#include <linux/log2.h>
>
> #include "swab.h"
> #include "util.h"
> @@ -854,7 +855,7 @@ magic_found:
> uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask);
> uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift);
>
> - if (uspi->s_fsize & (uspi->s_fsize - 1)) {
> + if (!is_power_of_2(uspi->s_fsize)) {
> printk(KERN_ERR "ufs_read_super: fragment size %u is not a power of 2\n",
> uspi->s_fsize);
> goto failed;
> @@ -869,7 +870,7 @@ magic_found:
> uspi->s_fsize);
> goto failed;
> }
> - if (uspi->s_bsize & (uspi->s_bsize - 1)) {
> + if (!is_power_of_2(uspi->s_bsize)) {
> printk(KERN_ERR "ufs_read_super: block size %u is not a power of 2\n",
> uspi->s_bsize);
> goto failed;
>
> --
> Vignesh Babu BM
> _____________________________________________________________
> "Why is it that every time I'm with you, makes me believe in magic?"
>
>
>
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>
> www.wipro.com
--
/Evgeniy
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH]is_power_of_2-ufs/super.c
2007-06-14 8:09 [PATCH]is_power_of_2-ufs/super.c vignesh babu
2007-06-14 17:50 ` [PATCH]is_power_of_2-ufs/super.c Evgeniy Dushistov
@ 2007-06-25 12:13 ` Johannes Weiner
2007-06-25 12:21 ` [PATCH]is_power_of_2-ufs/super.c vignesh babu
2007-06-25 12:27 ` [PATCH]is_power_of_2-ufs/super.c Robert P. J. Day
1 sibling, 2 replies; 5+ messages in thread
From: Johannes Weiner @ 2007-06-25 12:13 UTC (permalink / raw)
To: vignesh babu; +Cc: daniel.pirkl, dushistov, linux-kernel, Kernel Janitors List
Hi,
On Thu, Jun 14, 2007 at 01:39:18PM +0530, vignesh babu wrote:
> Replacing (n & (n-1)) in the context of power of 2 checks
> with is_power_of_2
You might want to run
egrep -R '([a-zA-Z0-9_.>]+) *& *\(\1 *- *1\)' /usr/src/linux
This does not match if the check is broken into multiple lines, though.
Still, 66 matches so far. Perhaps a big patch that removes most of these
occurrences would be more appropriate.
Hannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]is_power_of_2-ufs/super.c
2007-06-25 12:13 ` [PATCH]is_power_of_2-ufs/super.c Johannes Weiner
@ 2007-06-25 12:21 ` vignesh babu
2007-06-25 12:27 ` [PATCH]is_power_of_2-ufs/super.c Robert P. J. Day
1 sibling, 0 replies; 5+ messages in thread
From: vignesh babu @ 2007-06-25 12:21 UTC (permalink / raw)
To: Johannes Weiner
Cc: daniel.pirkl, dushistov, linux-kernel, Kernel Janitors List
Thanks Hannes, Im on it...
On Mon, 2007-06-25 at 14:13 +0200, Johannes Weiner wrote:
> egrep -R '([a-zA-Z0-9_.>]+) *& *\(\1 *- *1\)' /usr/src/linux
--
Vignesh Babu BM
_____________________________________________________________
"Why is it that every time I'm with you, makes me believe in magic?"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]is_power_of_2-ufs/super.c
2007-06-25 12:13 ` [PATCH]is_power_of_2-ufs/super.c Johannes Weiner
2007-06-25 12:21 ` [PATCH]is_power_of_2-ufs/super.c vignesh babu
@ 2007-06-25 12:27 ` Robert P. J. Day
1 sibling, 0 replies; 5+ messages in thread
From: Robert P. J. Day @ 2007-06-25 12:27 UTC (permalink / raw)
To: Johannes Weiner
Cc: vignesh babu, daniel.pirkl, dushistov, linux-kernel,
Kernel Janitors List
On Mon, 25 Jun 2007, Johannes Weiner wrote:
> Hi,
>
> On Thu, Jun 14, 2007 at 01:39:18PM +0530, vignesh babu wrote:
> > Replacing (n & (n-1)) in the context of power of 2 checks
> > with is_power_of_2
>
> You might want to run
>
> egrep -R '([a-zA-Z0-9_.>]+) *& *\(\1 *- *1\)' /usr/src/linux
>
> This does not match if the check is broken into multiple lines,
> though. Still, 66 matches so far. Perhaps a big patch that removes
> most of these occurrences would be more appropriate.
this cleanup project is already well documented here:
http://fsdev.net/wiki/index.php?title=Power_of_2_stuff
and it's unlikely that you'd get a big patch in that tries to do all
of that at once. it's much easier to do it a subsystem at a time.
rday
p.s. that wiki page could probably use some updating.
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-25 12:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14 8:09 [PATCH]is_power_of_2-ufs/super.c vignesh babu
2007-06-14 17:50 ` [PATCH]is_power_of_2-ufs/super.c Evgeniy Dushistov
2007-06-25 12:13 ` [PATCH]is_power_of_2-ufs/super.c Johannes Weiner
2007-06-25 12:21 ` [PATCH]is_power_of_2-ufs/super.c vignesh babu
2007-06-25 12:27 ` [PATCH]is_power_of_2-ufs/super.c Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox