From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Thu, 23 Apr 2009 10:16:55 +0100 Subject: [Cluster-devel] [PATCH 2/3] GFS2: Fix bug in block allocation In-Reply-To: <1240478216-2594-2-git-send-email-swhiteho@redhat.com> References: <1240478216-2594-1-git-send-email-swhiteho@redhat.com> <1240478216-2594-2-git-send-email-swhiteho@redhat.com> Message-ID: <1240478216-2594-3-git-send-email-swhiteho@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index f03d024..c9786a4 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, 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; } -- 1.6.0.6