From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Theodore Ts'o <tytso@mit.edu>,
"Robert P. J. Day" <rpjday@crashcourse.ca>
Subject: [PATCH] ext4: Use is_power_of_2() for clarity
Date: Sat, 25 Apr 2009 00:00:23 -0400 [thread overview]
Message-ID: <1240632023-29556-1-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <20090424173450.GJ7949@mit.edu>
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/super.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index f19d8b8..e20ff9c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1482,7 +1482,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;
@@ -2100,8 +2100,7 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
if (parse_strtoul(buf, 0x40000000, &t))
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;
--
1.5.6.3
prev parent reply other threads:[~2009-04-25 4:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-24 13:06 [PATCH] EXT4: Use is_power_of_2() routine for clarity Robert P. J. Day
2009-04-24 15:03 ` Eric Sandeen
2009-04-24 17:34 ` Theodore Tso
2009-04-25 4:00 ` Theodore Ts'o [this message]
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=1240632023-29556-1-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=akpm@osdl.org \
--cc=linux-ext4@vger.kernel.org \
--cc=rpjday@crashcourse.ca \
/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;
as well as URLs for NNTP newsgroup(s).