Re: [PATCH 6/8] omfs: add bitmap routines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 19, 2008 at 04:37:35PM -0400, Bob Copeland wrote:
> +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;
> +}
I think inner loop can be replaced with something like:
sum += sb->s_blocksize * 8 - bitmap_weight(map, sb->s_blocksize * 8);

Marcin
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux