Re: [PATCH 1/3] bitops: Add __ffs64 bitop

From: Valdis . Kletnieks
Date: Mon Apr 27 2009 - 12:31:42 EST


On Mon, 27 Apr 2009 16:41:06 BST, Steven Whitehouse said:
> The intent was that it would operate on native endian u64 words so that
> it shouldn't be affected by the endianess.

Hmm.. it's passing a 64-bit by value, not by a pointer ref - a subtle
distinction - if that code had done *(u32)word instead it would break
on some archs. That will teach me to read code when not caffeinated enough.

(I also admit that often I post comments on the basis of "If I can misread
this, so can some other poor decaffienated Joe Programmer on a Monday morning" ;)

> In the GFS2 code where it is
> used, the byte ordering is converted to native order before this
> function is applied,

Is that a reasonable expectation when other parts of the kernel start
using it? We've seen bugs before when 32-bit code tries to deal with
a 64-bit or bigger bitfield as a pair or series of 32-bit fields...

- * @word: The 64 bit word
+ * @word: The 64 bit word - must be in native byte order

probably is enough for those who bother finding the function def/doc. And
the ones who don't bother, we can't help anyhow. ;)

Attachment: pgp00000.pgp
Description: PGP signature