All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoann Padioleau <padator@wanadoo.fr>
To: vignesh.babu@wipro.com
Cc: neilb@suse.de,
	Kernel Janitors List <kernel-janitors@lists.osdl.org>,
	nfs@lists.sourceforge.net
Subject: Re: [KJ] [PATCH]is_power_of_2-nfs/internal.h
Date: Thu, 14 Jun 2007 15:59:47 +0000	[thread overview]
Message-ID: <871wger0gc.fsf@wanadoo.fr> (raw)
In-Reply-To: <1181808534.2474.7.camel@merlin.linuxcoe.com> (vignesh babu's message of "Thu, 14 Jun 2007 13:38:54 +0530")

vignesh babu <vignesh.babu@wipro.com> writes:

> 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/nfs/internal.h b/fs/nfs/internal.h
> index ad2b40d..5dca432 100644
> --- a/fs/nfs/internal.h
> +++ b/fs/nfs/internal.h
> @@ -3,6 +3,7 @@
>   */
>  
>  #include <linux/mount.h>
> +#include <linux/log2.h>
>  
>  struct nfs_string;
>  struct nfs_mount_data;
> @@ -167,7 +168,7 @@ static inline
>  unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
>  {
>  	/* make sure blocksize is a power of two */
> -	if ((bsize & (bsize - 1)) || nrbitsp) {
> +	if (is_power_of_2(bsize) || nrbitsp) {

Did I miss something but why in this case it's not 

+	if (!is_power_of_2(bsize) || nrbitsp) {

?


>  		unsigned char	nrbits;
>  
>  		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)
>
> -- 
> Vignesh Babu BM 
> _____________________________________________________________ 
> "Why is it that every time I'm with you, makes me believe in magic?"
>
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

WARNING: multiple messages have this Message-ID (diff)
From: Yoann Padioleau <padator@wanadoo.fr>
To: vignesh.babu@wipro.com
Cc: neilb@suse.de,
	Kernel Janitors List <kernel-janitors@lists.osdl.org>,
	nfs@lists.sourceforge.net
Subject: Re: [KJ] [PATCH]is_power_of_2-nfs/internal.h
Date: Thu, 14 Jun 2007 17:59:47 +0200	[thread overview]
Message-ID: <871wger0gc.fsf@wanadoo.fr> (raw)
In-Reply-To: <1181808534.2474.7.camel@merlin.linuxcoe.com> (vignesh babu's message of "Thu, 14 Jun 2007 13:38:54 +0530")

vignesh babu <vignesh.babu@wipro.com> writes:

> 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/nfs/internal.h b/fs/nfs/internal.h
> index ad2b40d..5dca432 100644
> --- a/fs/nfs/internal.h
> +++ b/fs/nfs/internal.h
> @@ -3,6 +3,7 @@
>   */
>  
>  #include <linux/mount.h>
> +#include <linux/log2.h>
>  
>  struct nfs_string;
>  struct nfs_mount_data;
> @@ -167,7 +168,7 @@ static inline
>  unsigned long nfs_block_bits(unsigned long bsize, unsigned char *nrbitsp)
>  {
>  	/* make sure blocksize is a power of two */
> -	if ((bsize & (bsize - 1)) || nrbitsp) {
> +	if (is_power_of_2(bsize) || nrbitsp) {

Did I miss something but why in this case it's not 

+	if (!is_power_of_2(bsize) || nrbitsp) {

?


>  		unsigned char	nrbits;
>  
>  		for (nrbits = 31; nrbits && !(bsize & (1 << nrbits)); nrbits--)
>
> -- 
> Vignesh Babu BM 
> _____________________________________________________________ 
> "Why is it that every time I'm with you, makes me believe in magic?"
>
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  parent reply	other threads:[~2007-06-14 15:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-14  8:08 [PATCH]is_power_of_2-nfs/internal.h vignesh babu
2007-06-14  8:20 ` [KJ] [PATCH]is_power_of_2-nfs/internal.h vignesh babu
2007-06-14 15:45 ` [KJ] Re: [NFS] [PATCH]is_power_of_2-nfs/internal.h Trond Myklebust
2007-06-14 15:45   ` [PATCH]is_power_of_2-nfs/internal.h Trond Myklebust
2007-06-15  6:50   ` NFS and Samba Winbindd Laurenz, Dirk
2007-06-15  9:44     ` Chris Osicki
2007-06-15  9:58       ` Laurenz, Dirk
2007-06-20  5:31         ` Laurenz, Dirk
2007-06-20 14:18           ` Trond Myklebust
2007-06-14 15:59 ` Yoann Padioleau [this message]
2007-06-14 15:59   ` [KJ] [PATCH]is_power_of_2-nfs/internal.h Yoann Padioleau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871wger0gc.fsf@wanadoo.fr \
    --to=padator@wanadoo.fr \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    --cc=vignesh.babu@wipro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.