From: Anders Larsen <al@alarsen.net>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 03/10] qnx4fs: use memweight()
Date: Sun, 20 May 2012 17:34:20 +0200 [thread overview]
Message-ID: <1337528060.4396.0@oscar> (raw)
In-Reply-To: <1337520203-29147-3-git-send-email-akinobu.mita@gmail.com> (from akinobu.mita@gmail.com on Sun May 20 15:23:16 2012)
On 2012-05-20 15:23:16, Akinobu Mita wrote:
> Use memweight() to count the total number of bits clear in memory
> area.
>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Cc: Anders Larsen <al@alarsen.net>
> ---
> fs/qnx4/bitmap.c | 24 +++++-------------------
> 1 files changed, 5 insertions(+), 19 deletions(-)
>
> diff --git a/fs/qnx4/bitmap.c b/fs/qnx4/bitmap.c
> index 22e0d60..fc04ef1 100644
> --- a/fs/qnx4/bitmap.c
> +++ b/fs/qnx4/bitmap.c
> @@ -17,23 +17,6 @@
> #include <linux/bitops.h>
> #include "qnx4.h"
>
> -static void count_bits(register const char *bmPart, register int
> size,
> - int *const tf)
> -{
> - char b;
> - int tot = *tf;
> -
> - if (size > QNX4_BLOCK_SIZE) {
> - size = QNX4_BLOCK_SIZE;
> - }
> - do {
> - b = *bmPart++;
> - tot += 8 - hweight8(b);
> - size--;
> - } while (size != 0);
> - *tf = tot;
> -}
> -
> unsigned long qnx4_count_free_blocks(struct super_block *sb)
> {
> int start =
> le32_to_cpu(qnx4_sb(sb)->BitMap->di_first_xtnt.xtnt_blk) - 1;
> @@ -44,13 +27,16 @@ unsigned long qnx4_count_free_blocks(struct
> super_block *sb)
> struct buffer_head *bh;
>
> while (total < size) {
> + int bytes = min(size - total, QNX4_BLOCK_SIZE);
> +
> if ((bh = sb_bread(sb, start + offset)) == NULL) {
> printk(KERN_ERR "qnx4: I/O error in counting
> free blocks\n");
> break;
> }
> - count_bits(bh->b_data, size - total, &total_free);
> + total_free += bytes * BITS_PER_BYTE-
due to the missing whitespace after the macro I had to read that
statement
three times to comprehend it (which was probably good, since that's the
beef ;)
> + memweight(bh->b_data, bytes);
> brelse(bh);
> - total += QNX4_BLOCK_SIZE;
> + total += bytes;
> offset++;
> }
Other than that,
Acked-by: Anders Larsen <al@alarsen.net>
Cheers
Anders
next prev parent reply other threads:[~2012-05-20 15:58 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-20 13:23 [PATCH 01/10] string: introduce memweight Akinobu Mita
2012-05-20 13:24 ` [Ocfs2-devel] " Akinobu Mita
2012-05-20 13:23 ` [PATCH 02/10] minixfs: use memweight() Akinobu Mita
2012-05-20 13:23 ` [PATCH 03/10] qnx4fs: " Akinobu Mita
2012-05-20 15:34 ` Anders Larsen [this message]
2012-05-21 11:59 ` Akinobu Mita
2012-05-20 13:23 ` [PATCH 04/10] dm-log: " Akinobu Mita
2012-05-20 13:23 ` Akinobu Mita
2012-05-20 13:23 ` [PATCH 05/10] affs: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 06/10] video/uvc: " Akinobu Mita
2012-05-20 20:46 ` Laurent Pinchart
2012-05-21 12:03 ` Akinobu Mita
2012-05-21 12:18 ` Laurent Pinchart
2012-05-20 13:23 ` [PATCH 07/10] ocfs2: " Akinobu Mita
2012-05-20 13:24 ` [Ocfs2-devel] " Akinobu Mita
2012-05-20 13:23 ` [PATCH 08/10] ext2: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 09/10] ext3: " Akinobu Mita
2012-05-20 13:23 ` [PATCH 10/10] ext4: " Akinobu Mita
2012-05-23 9:21 ` [PATCH 01/10] string: introduce memweight Jan Kara
2012-05-23 12:12 ` Akinobu Mita
2012-05-23 12:12 ` [Ocfs2-devel] " Akinobu Mita
2012-05-23 12:12 ` Akinobu Mita
2012-05-23 12:29 ` Jan Kara
2012-05-23 12:29 ` Jan Kara
2012-05-23 13:16 ` Matthew Wilcox
2012-05-24 11:54 ` Akinobu Mita
2012-05-24 11:54 ` [Ocfs2-devel] " Akinobu Mita
2012-05-24 11:54 ` Akinobu Mita
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=1337528060.4396.0@oscar \
--to=al@alarsen.net \
--cc=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--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 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.