From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Vignesh Babu BM <vignesh.babu@wipro.com>
Cc: Kernel Janitors List <kernel-janitors@lists.osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [KJ][PATCH] is_power_of_2 in fat
Date: Tue, 20 Feb 2007 22:12:45 +0900 [thread overview]
Message-ID: <873b51j7le.fsf@duaron.myhome.or.jp> (raw)
In-Reply-To: <1171957794.6127.65.camel@wriver-t81fb058.linuxcoe> (Vignesh Babu's message of "Tue\, 20 Feb 2007 13\:19\:54 +0530")
Vignesh Babu BM <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>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thanks.
> ---
> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
> index a9e4688..8437190 100644
> --- a/fs/fat/inode.c
> +++ b/fs/fat/inode.c
> @@ -25,6 +25,7 @@
> #include <linux/parser.h>
> #include <linux/uio.h>
> #include <linux/writeback.h>
> +#include <linux/log2.h>
> #include <asm/unaligned.h>
>
> #ifndef CONFIG_FAT_DEFAULT_IOCHARSET
> @@ -1216,8 +1217,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
> }
> logical_sector_size =
> le16_to_cpu(get_unaligned((__le16 *)&b->sector_size));
> - if (!logical_sector_size
> - || (logical_sector_size & (logical_sector_size - 1))
> + if (!is_power_of_2(logical_sector_size)
> || (logical_sector_size < 512)
> || (PAGE_CACHE_SIZE < logical_sector_size)) {
> if (!silent)
> @@ -1227,8 +1227,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
> goto out_invalid;
> }
> sbi->sec_per_clus = b->sec_per_clus;
> - if (!sbi->sec_per_clus
> - || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) {
> + if (!is_power_of_2(sbi->sec_per_clus)) {
> if (!silent)
> printk(KERN_ERR "FAT: bogus sectors per cluster %u\n",
> sbi->sec_per_clus);
>
> --
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
prev parent reply other threads:[~2007-02-20 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 7:49 Vignesh Babu BM
2007-02-20 13:12 ` OGAWA Hirofumi [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=873b51j7le.fsf@duaron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=kernel-janitors@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®