[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080330032710.GC18825@hash.localnet>
Date: Sat, 29 Mar 2008 23:27:10 -0400
From: Bob Copeland <me@...copeland.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 5/7] omfs: add bitmap routines
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists