linux-kernel.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>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
	ocfs2-devel@oss.oracle.com
Subject: [PATCH v2 07/10] ocfs2: use memweight()
Date: Sat,  2 Jun 2012 22:40:13 +0900	[thread overview]
Message-ID: <1338644416-11417-7-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 set in memory area.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: ocfs2-devel@oss.oracle.com
---

No changes from v1

 fs/ocfs2/localalloc.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 210c352..a9f78c7 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -784,14 +784,10 @@ bail:
 
 static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc)
 {
-	int i;
-	u8 *buffer;
-	u32 count = 0;
+	u32 count;
 	struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc);
 
-	buffer = la->la_bitmap;
-	for (i = 0; i < le16_to_cpu(la->la_size); i++)
-		count += hweight8(buffer[i]);
+	count = memweight(la->la_bitmap, le16_to_cpu(la->la_size));
 
 	trace_ocfs2_local_alloc_count_bits(count);
 	return count;
-- 
1.7.7.6


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

Thread overview: 18+ 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 ` [PATCH v2 02/10] minixfs: use memweight() Akinobu Mita
2012-06-04 10:26   ` Jan Kara
2012-06-02 13:40 ` [PATCH v2 03/10] qnx4fs: " Akinobu Mita
2012-06-02 13:40 ` [PATCH v2 04/10] dm: " Akinobu Mita
2012-06-02 13:40 ` [PATCH v2 05/10] affs: " Akinobu Mita
2012-06-02 13:40 ` [PATCH v2 06/10] video/uvc: " Akinobu Mita
2012-06-02 13:40 ` Akinobu Mita [this message]
2012-06-02 13:40 ` [PATCH v2 08/10] ext2: " Akinobu Mita
2012-06-04 10:10   ` Jan Kara
2012-06-02 13:40 ` [PATCH v2 09/10] ext3: " Akinobu Mita
2012-06-02 13:40 ` [PATCH v2 10/10] ext4: " Akinobu Mita
2012-06-02 14:35   ` Andreas Dilger
2012-06-03 12:57     ` 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-7-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.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;
as well as URLs for NNTP newsgroup(s).