From: Ming Zhang <mingz@ele.uri.edu>
To: Neil Brown <neilb@suse.de>
Cc: linux-raid@vger.kernel.org
Subject: Re: how to understand this bitmap_zero
Date: Wed, 09 Nov 2005 18:11:15 -0500 [thread overview]
Message-ID: <1131577875.452.15.camel@localhost.localdomain> (raw)
In-Reply-To: <17266.30795.161044.844874@cse.unsw.edu.au>
ic. thx!
so it seems that we still have to use set_bit in a for loop to set
certain particular area, rite?
Ming
On Thu, 2005-11-10 at 09:29 +1100, Neil Brown wrote:
> On Wednesday November 9, mingz@ele.uri.edu wrote:
> > could anybody help me on this? thanks!
> >
> > see if we call bitmap_zero(dst, 2), it will do *dst = 0UL and thus clear
> > whole *dst, but what if we intent to clear 2 bits? not 32bits?
>
> bitmap_zero isn't intended for zeroing just a few bits in a bitmap.
> It is for zeroing an entire bitmap, and you tell it how big the bitmap
> is. So this function will always zero at least the whole bitmap, and
> maybe a bit more. as bitmaps are always allocated as an array of
> 'unsigned long', there it no risk it over-running the space allocated.
>
> Hope that helps.
> NeilBrown
>
> >
> > static inline void bitmap_zero(unsigned long *dst, int nbits)
> > {
> > if (nbits <= BITS_PER_LONG)
> > *dst = 0UL;
> > else {
> > int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
> > memset(dst, 0, len);
> > }
> > }
> >
> >
> > Ming
> >
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2005-11-09 23:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-09 17:28 how to understand this bitmap_zero Ming Zhang
2005-11-09 22:29 ` Neil Brown
2005-11-09 23:11 ` Ming Zhang [this message]
2005-11-10 2:20 ` Neil Brown
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=1131577875.452.15.camel@localhost.localdomain \
--to=mingz@ele.uri.edu \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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