GFS2: Fix bug in block allocation
authorSteven Whitehouse <swhiteho@redhat.com>
Thu, 23 Apr 2009 07:54:02 +0000 (08:54 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 23 Apr 2009 09:07:16 +0000 (10:07 +0100)
The new bitfit algorithm was counting from the wrong end of
64 bit words in the bitfield. This fixes it by using __ffs64
instead of fls64

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/rgrp.c

index f03d024038ea2974ffc43ba50daead1fd922bd82..c9786a46cdfce5b834a059a9388d91f66394ef81 100644 (file)
@@ -212,8 +212,7 @@ static u32 gfs2_bitfit(const u8 *buf, const unsigned int len,
        if (tmp == 0)
                return BFITNOENT;
        ptr--;
-       bit = fls64(tmp);
-       bit--;          /* fls64 always adds one to the bit count */
+       bit = __ffs64(tmp);
        bit /= 2;       /* two bits per entry in the bitmap */
        return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
 }