xfs
[Top] [All Lists]

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

To: David Chinner <dgc@xxxxxxx>
Subject: Re: [PATCH] Replace XFS bit functions with Linux functions
From: Andi Kleen <ak@xxxxxxx>
Date: Tue, 2 Oct 2007 15:35:14 +0200
Cc: xfs@xxxxxxxxxxx, cattelan@xxxxxxxxxxx
In-reply-to: <20071002125923.GH995458@xxxxxxx>
Organization: SUSE Linux Products GmbH, Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
References: <200710021010.58284.ak@xxxxxxx> <20071002125923.GH995458@xxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: KMail/1.9.6
> 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




<Prev in Thread] Current Thread [Next in Thread>