Re: [PATCH] Replace XFS bit functions with Linux functions

Andi Kleen
2007-10-02T13:35:45Z

> One thing that is notable here is that the XFS code returns
> -1 if no bits are set. fls/fls64 return 0 in the same case, so
> the magic "- 1" will make them behave the same. however, it
> appears that find_first_bit() will return the number of bits
> searched. That might leave us with som nasty, non-obvious error
> cases....

See the changelog:

The semantics of the Linux functions differ a little, but i checked
all call sites that they can deal with that.

>
> Also, I don't really like the fact it requires sprinkling magic "-
> 1" adjustments to the return value of the replacement functions. If
> that is the way the functions work and relate to the XFS bitmaps,

Not all callers use them as bitmap indexes, some also use them as true log2s.
I also eliminated some + 1s.

Whatever you do it's not the same for all.

-Andi