[Cluster-devel] GFS2: Block alloc fixes
These three patches fix a couple of bugs in the block allocation code that was updated at the merge window. Thanks are due to Benny Halevy, Christoph Lameter and Willy Tarreau for looking at the __ffs64 patch. I've updated the comment in that patch in the light of Willy Tarreau's suggestion, Steve.
[Cluster-devel] [PATCH 1/3] bitops: Add __ffs64 bitop
Finds the first set bit in a 64 bit word. This is required in order to fix a bug in GFS2, but I think it should be a generic function in case of future users. Signed-off-by: Steven Whitehouse swhit...@redhat.com Reviewed-by: Christoph Lameter c...@linux.com Reviewed-by: Willy Tarreau w...@1wt.eu diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 6182913..c05a29c 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -112,6 +112,25 @@ static inline unsigned fls_long(unsigned long l) return fls64(l); } +/** + * __ffs64 - find first set bit in a 64 bit word + * @word: The 64 bit word + * + * On 64 bit arches this is a synomyn for __ffs + * The result is not defined if no bits are set, so check that @word + * is non-zero before calling this. + */ +static inline unsigned long __ffs64(u64 word) +{ +#if BITS_PER_LONG == 32 + if (((u32)word) == 0UL) + return __ffs((u32)(word 32)) + 32; +#elif BITS_PER_LONG != 64 +#error BITS_PER_LONG not 32 or 64 +#endif + return __ffs((unsigned long)word); +} + #ifdef __KERNEL__ #ifdef CONFIG_GENERIC_FIND_FIRST_BIT -- 1.6.0.6
[Cluster-devel] [PATCH 2/3] 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 swhit...@redhat.com 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
[Cluster-devel] [PATCH 3/3] GFS2: Ensure that the inode goal block settings are updated
GFS2 has a goal block associated with each inode indicating the search start position for future block allocations (in fact there are two, but thats for backward compatibility with GFS1 as they are set to identical locations in GFS2). In some circumstances, depending on the ordering of updates to the inode it was possible for the goal block settings to not be updated on disk. This patch ensures that the goal block will always get updated, thus reducing the potential for searching the same (already allocated) blocks again when looking for free space during block allocation. Signed-off-by: Steven Whitehouse swhit...@redhat.com diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index c9786a4..5650382 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -1444,10 +1444,12 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart, u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) { struct gfs2_sbd *sdp = GFS2_SB(ip-i_inode); + struct buffer_head *dibh; struct gfs2_alloc *al = ip-i_alloc; struct gfs2_rgrpd *rgd = al-al_rgd; u32 goal, blk; u64 block; + int error; if (rgrp_contains_block(rgd, ip-i_goal)) goal = ip-i_goal - rgd-rd_data0; @@ -1460,7 +1462,13 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n) rgd-rd_last_alloc = blk; block = rgd-rd_data0 + blk; ip-i_goal = block; - + error = gfs2_meta_inode_buffer(ip, dibh); + if (error == 0) { + struct gfs2_dinode *di = (struct gfs2_dinode *)dibh-b_data; + gfs2_trans_add_bh(ip-i_gl, dibh, 1); + di-di_goal_meta = di-di_goal_data = cpu_to_be64(ip-i_goal); + brelse(dibh); + } gfs2_assert_withdraw(sdp, rgd-rd_free = *n); rgd-rd_free -= *n; -- 1.6.0.6
[Cluster-devel] GFS2: Pull request (fixes)
Hi, Please consider pulling the following GFS2 fixes, Steve. The following changes since commit 091069740304c979f957ceacec39c461d0192158: Linus Torvalds (1): Linux 2.6.30-rc3 are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes.git master Steven Whitehouse (3): bitops: Add __ffs64 bitop GFS2: Fix bug in block allocation GFS2: Ensure that the inode goal block settings are updated fs/gfs2/rgrp.c | 13 ++--- include/linux/bitops.h | 19 +++ 2 files changed, 29 insertions(+), 3 deletions(-)
[Cluster-devel] conga/luci cluster/fence-macros cluster/valida ...
CVSROOT:/cvs/cluster Module name:conga Branch: RHEL5 Changes by: rmcc...@sourceware.org 2009-04-23 20:38:52 Modified files: luci/cluster : fence-macros validate_fence.js luci/site/luci/Extensions: FenceHandler.py Log message: fix bz492392 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/fence-macros.diff?cvsroot=clusteronly_with_tag=RHEL5r1=1.2.2.10r2=1.2.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/validate_fence.js.diff?cvsroot=clusteronly_with_tag=RHEL5r1=1.1.2.10r2=1.1.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/FenceHandler.py.diff?cvsroot=clusteronly_with_tag=RHEL5r1=1.4.2.16r2=1.4.2.17 --- conga/luci/cluster/fence-macros 2009/02/18 19:13:30 1.2.2.10 +++ conga/luci/cluster/fence-macros 2009/04/23 20:38:51 1.2.2.11 @@ -633,19 +633,6 @@ value cur_fencedev/passwd_script | nothing / /td /tr - tr tal:condition=exists:clusterinfo/has_fence_ssh - td - span title=Enable SSH operationUse SSH/span - /td - td - input tal:condition=exists:cur_fencedev - type=checkbox name=secure - tal:attributes= - checked python:(cur_fencedev and cur_fencedev.has_key('secure') and (cur_fencedev['secure'] == '1' or cur_fencedev['secure'].lower() == 'true')) and 'checked' or '' / - input tal:condition=not:exists:cur_fencedev - type=checkbox name=secure / - /td - /tr /table tal:block tal:condition=exists: cur_fencedev --- conga/luci/cluster/validate_fence.js2009/02/18 19:13:30 1.1.2.10 +++ conga/luci/cluster/validate_fence.js2009/04/23 20:38:51 1.1.2.11 @@ -78,7 +78,6 @@ set_form_err(form_elem); errors.push(form_elem.name + ' values must not be empty.'); } - return (errors); } if (errors errors.length 0 @@ -87,7 +86,7 @@ clr_form_err(form_elem); return (null); } - return errors; + return (errors); } /* Very loose checking for now -- just make sure it's not blank */ --- conga/luci/site/luci/Extensions/FenceHandler.py 2009/02/18 19:13:30 1.4.2.16 +++ conga/luci/site/luci/Extensions/FenceHandler.py 2009/04/23 20:38:52 1.4.2.17 @@ -967,12 +967,6 @@ if not has_passwd: errors.append(FD_PROVIDE_PASSWD) - use_ssh = form.has_key('secure') and (form['secure'] == '1' or form['secure'].lower() == 'true') - if use_ssh: - fencedev.addAttribute('secure', '1') - else: - fencedev.removeAttribute('secure') - return errors FD_VALIDATE = {