From: Michael Tokarev <mjt@tls.msk.ru>
To: Paul Clements <paul.clements@steeleye.com>
Cc: Neil Brown <neilb@suse.de>, linux-raid@vger.kernel.org
Subject: Re: [BUG/PATCH] md bitmap broken on big endian machines
Date: Fri, 29 Sep 2006 11:03:11 +0400 [thread overview]
Message-ID: <451CC52F.9080400@tls.msk.ru> (raw)
In-Reply-To: <451C6D64.5050807@steeleye.com>
Paul Clements wrote:
> Michael Tokarev wrote:
>> Neil Brown wrote:
>
>>> ffs is closer, but takes an 'int' and we have a 'unsigned long'.
>>> So use ffz(~X) to convert a chunksize into a chunkshift.
>>
>> So we don't use ffs(int) for an unsigned value because of int vs
>> unsigned int, but we use ffz() with negated UNSIGNED. Looks even
>> more broken to me, even if it happens to work correctly... ;)
>
> No, it doesn't matter about the signedness, these are just bit
> operations. The problem is the size (int vs. long), even though in
> practice it's very unlikely you'd ever have a bitmap chunk size that
> exceeded 32 bits. But it's better to be correct and not have to worry
> about it.
I understand the point, in the first place (I didn't mentioned long
vs int above, however). The thing is: when reading the code, it looks
just plain wrong. Esp. since function prototypes aren't here, but for
those ffs(), ffz() etc they're hidden somewhere in include/asm/* (as
they're architecture-dependent), and it's not at all obvious which is
signed and which is unsigned, which is long or int etc.
At the very least, return -ENOCOMMENT :)
/mjt
prev parent reply other threads:[~2006-09-29 7:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-21 20:26 [BUG/PATCH] md bitmap broken on big endian machines Paul Clements
2006-09-22 15:29 ` [PATCH] md SET_BITMAP_FILE compat ioctl Paul Clements
2006-09-28 7:31 ` Neil Brown
2006-09-28 6:34 ` [BUG/PATCH] md bitmap broken on big endian machines Neil Brown
2006-09-28 22:09 ` Michael Tokarev
2006-09-29 0:48 ` Paul Clements
2006-09-29 7:03 ` Michael Tokarev [this message]
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=451CC52F.9080400@tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
--cc=paul.clements@steeleye.com \
/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).