[PATCH] xfs: improve xfs_bitmap_empty()
Jeff Liu
jeff.liu at oracle.com
Fri Jan 31 09:28:03 CST 2014
On 01/31 2014 23:07 PM, Eric Sandeen wrote:
> On 1/31/14, 8:13 AM, Jeff Liu wrote:
>> From: Jie Liu <jeff.liu at oracle.com>
>>
>> There is no need to travel through the whole bitmap items to verify
>> if the bitmap array is empty or not, instead, just return 0 directly
>> if an item is detected in bitmap array.
>>
>> Signed-off-by: Jie Liu <jeff.liu at oracle.com>
>
> Makes sense (and the long loop was my fault, I guess, but it's
> better than it was, see commit 24ad33f!)
Ah, you have killed a lots code there! :)
> Reviewed-by: Eric Sandeen <sandeen at redhat.com>
>
> I wonder if something like:
>
> return (find_first_set(map, size) == size);
>
> would be faster (or if it'd be worth it)...?
> Probably not. :)
>
Well, when I looking through our bitmap source, I once thought if
we can replace the current code with the generic bitmap library.
However, our map is uint rather than unsigned long...
Otherwise, maybe some like find_first_bit(map, size) would be
more convenient.
Thanks,
-Jeff
More information about the xfs
mailing list