diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-04-23 03:54:02 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-04-23 05:07:16 -0400 |
commit | d8bd504ab800c8e9aadb983914a33e7166320bec (patch) | |
tree | 72b45fe08363441d53c5e464daa6886a6e11a8b8 | |
parent | 952043ac12a117d8e94bddd9088338d7ad20ca7d (diff) |
GFS2: Fix bug in block allocation
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>
-rw-r--r-- | fs/gfs2/rgrp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index f03d024038ea..c9786a46cdfc 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -212,8 +212,7 @@ static u32 gfs2_bitfit(const u8 *buf, const unsigned int len, | |||
212 | if (tmp == 0) | 212 | if (tmp == 0) |
213 | return BFITNOENT; | 213 | return BFITNOENT; |
214 | ptr--; | 214 | ptr--; |
215 | bit = fls64(tmp); | 215 | bit = __ffs64(tmp); |
216 | bit--; /* fls64 always adds one to the bit count */ | ||
217 | bit /= 2; /* two bits per entry in the bitmap */ | 216 | bit /= 2; /* two bits per entry in the bitmap */ |
218 | return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit; | 217 | return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit; |
219 | } | 218 | } |