public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: linux-ext4@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] EXT4:  Use is_power_of_2() routine for clarity.
Date: Fri, 24 Apr 2009 09:06:14 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0904240905050.12966@localhost.localdomain> (raw)


Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2958f4e..479d5ef 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1479,7 +1479,7 @@ set_qf_format:
 				return 0;
 			if (option < 0 || option > (1 << 30))
 				return 0;
-			if (option & (option - 1)) {
+			if (!is_power_of_2(option)) {
 				printk(KERN_ERR "EXT4-fs: inode_readahead_blks"
 				       " must be a power of 2\n");
 				return 0;
@@ -2092,7 +2092,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
 		return -EINVAL;

 	/* inode_readahead_blks must be a power of 2 */
-	if (t & (t-1))
+	if (!is_power_of_2(t))
 		return -EINVAL;

 	sbi->s_inode_readahead_blks = t;

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

             reply	other threads:[~2009-04-24 13:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 13:06 Robert P. J. Day [this message]
2009-04-24 15:03 ` [PATCH] EXT4: Use is_power_of_2() routine for clarity Eric Sandeen
2009-04-24 17:34   ` Theodore Tso
2009-04-25  4:00     ` [PATCH] ext4: Use is_power_of_2() " Theodore Ts'o

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=alpine.LFD.2.00.0904240905050.12966@localhost.localdomain \
    --to=rpjday@crashcourse.ca \
    --cc=akpm@osdl.org \
    --cc=linux-ext4@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox