linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Bob Copeland <me@bobcopeland.com>
Cc: akpm@linux-foundation.org, hch@infradead.org,
	alan@lxorguk.ukuu.org.uk, miklos@szeredi.hu,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 6/8] omfs: add bitmap routines
Date: Sun, 20 Apr 2008 00:03:12 +0200	[thread overview]
Message-ID: <20080419220307.GB7888@joi> (raw)
In-Reply-To: <1208637457-24969-7-git-send-email-me@bobcopeland.com>

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

  reply	other threads:[~2008-04-19 22:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-19 20:37 [PATCH 6/8] omfs: add bitmap routines Bob Copeland
2008-04-19 22:03 ` Marcin Slusarz [this message]
2008-04-21  1:11   ` Bob Copeland
  -- strict thread matches above, loose matches on Subject: below --
2008-04-26 21:26 Bob Copeland

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=20080419220307.GB7888@joi \
    --to=marcin.slusarz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@bobcopeland.com \
    --cc=miklos@szeredi.hu \
    /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).