lkml.org 
[lkml]   [2008]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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



\
 
 \ /
  Last update: 2008-03-30 05:29    [W:0.057 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site