public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 5/7] omfs: add bitmap routines
Date: Sat, 29 Mar 2008 23:27:10 -0400	[thread overview]
Message-ID: <20080330032710.GC18825@hash.localnet> (raw)
In-Reply-To: <200803280451.11216.arnd@arndb.de>

On Fri, Mar 28, 2008 at 04:51:10AM +0100, Arnd Bergmann wrote:
> On Thursday 27 March 2008, Bob Copeland wrote:
> 
> > +unsigned long omfs_count_free(struct super_block *sb)
> 
> I think it would be helpful to express this using hweight64.

Here's a version with hweight64:

+unsigned long omfs_count_free(struct super_block *sb)
+{
+	unsigned int i, j;
+	u64 *map;
+	unsigned long sum = 0;
+	struct omfs_sb_info *sbi = OMFS_SB(sb);
+
+	for (i = 0; i < sbi->s_imap_size; i++) {
+		map = (u64 *) sbi->s_imap[i];
+		for (j = 0; j < sb->s_blocksize / 8; j++)
+			sum += hweight64(~map[j]);
+	}
+	return sum;
+}

-- 
Bob Copeland %% www.bobcopeland.com 


  parent reply	other threads:[~2008-03-30  3:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-27  0:45 [PATCH 5/7] omfs: add bitmap routines Bob Copeland
2008-03-28  3:51 ` Arnd Bergmann
2008-03-28 13:26   ` Bob Copeland
2008-03-30  3:27   ` Bob Copeland [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-04-12 22:58 Bob Copeland
2008-04-13  8:09 ` Christoph Hellwig

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=20080330032710.GC18825@hash.localnet \
    --to=me@bobcopeland.com \
    --cc=arnd@arndb.de \
    --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