From: Andrew Morton <akpm@linux-foundation.org>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Joe Perches <joe@perches.com>
Subject: Re: [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by fls
Date: Mon, 19 May 2014 16:09:46 -0700 [thread overview]
Message-ID: <20140519160946.84e79c832dfc4db0fbae573b@linux-foundation.org> (raw)
In-Reply-To: <20140516223815.88ffae2289f969381f176fdc@skynet.be>
On Fri, 16 May 2014 22:38:15 +0200 Fabian Frederick <fabf@skynet.be> wrote:
> Replace while blocksize;shift by fls -1
>
> Suggested-By: Joe Perches <joe@perches.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> v2: rebased on top of mmots
> compiles without including bitops
>
> fs/hfsplus/wrapper.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
> index 284c90f..8e8cf50d 100644
> --- a/fs/hfsplus/wrapper.c
> +++ b/fs/hfsplus/wrapper.c
> @@ -231,9 +231,7 @@ reread:
> if (blocksize < HFSPLUS_SECTOR_SIZE || ((blocksize - 1) & blocksize))
> goto out_free_backup_vhdr;
> sbi->alloc_blksz = blocksize;
> - sbi->alloc_blksz_shift = 0;
> - while ((blocksize >>= 1) != 0)
> - sbi->alloc_blksz_shift++;
> + sbi->alloc_blksz_shift = fls(blocksize) - 1;
> blocksize = min_t(u32, sbi->alloc_blksz, PAGE_SIZE);
fls() always makes my brain hurt. ilog() is nicer?
next prev parent reply other threads:[~2014-05-19 23:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 20:38 [PATCH V2 mmots] fs/hfsplus/wrapper.c: replace shift loop by fls Fabian Frederick
2014-05-19 23:09 ` Andrew Morton [this message]
2014-05-19 23:22 ` Joe Perches
2014-05-19 23:40 ` Andrew Morton
2014-05-19 23:50 ` Joe Perches
2014-05-20 5:02 ` Fabian Frederick
2014-05-20 5:10 ` Joe Perches
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=20140519160946.84e79c832dfc4db0fbae573b@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=fabf@skynet.be \
--cc=joe@perches.com \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).