linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>, linux-fsdevel@vger.kernel.org
Subject: [PATCH v2 02/10] minixfs: use memweight()
Date: Sat,  2 Jun 2012 22:40:08 +0900	[thread overview]
Message-ID: <1338644416-11417-2-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1338644416-11417-1-git-send-email-akinobu.mita@gmail.com>

Use memweight() to count the total number of bits clear in memory area.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
---

No changes from v1

 fs/minix/bitmap.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 4bc50da..564f1a5 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -29,10 +29,8 @@ static __u32 count_free(struct buffer_head *map[], unsigned blocksize, __u32 num
 	unsigned blocks = DIV_ROUND_UP(numbits, blocksize * 8);
 
 	while (blocks--) {
-		unsigned words = blocksize / 2;
-		__u16 *p = (__u16 *)(*map++)->b_data;
-		while (words--)
-			sum += 16 - hweight16(*p++);
+		sum += blocksize * BITS_PER_BYTE -
+			memweight((*map++)->b_data, blocksize);
 	}
 
 	return sum;
-- 
1.7.7.6

  reply	other threads:[~2012-06-02 13:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-02 13:40 [PATCH v2 01/10] string: introduce memweight Akinobu Mita
2012-06-02 13:40 ` Akinobu Mita [this message]
2012-06-04 10:26   ` [PATCH v2 02/10] minixfs: use memweight() Jan Kara
2012-06-02 13:40 ` [PATCH v2 05/10] affs: " Akinobu Mita
2012-06-04 10:12 ` [PATCH v2 01/10] string: introduce memweight Jan Kara
2012-06-04 11:46   ` Akinobu Mita
2012-06-04 13:35     ` Jan Kara
2012-06-05  9:03       ` 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=1338644416-11417-2-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.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 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).