From 1d46dc08d33138c29c63d717807c08ab704fc773 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 19 Feb 2009 13:17:05 -0800 Subject: ocfs2: fix leaf start calculation in ocfs2_dx_dir_rebalance() ocfs2_dx_dir_rebalance() is passed the block offset of a dx leaf which needs rebalancing. Since we rebalance an entire cluster at a time however, this function needs to calculate the beginning of that cluster, in blocks. The calculation was wrong, which would result in a read of non-leaf blocks. Fix the calculation by adding ocfs2_block_to_cluster_start() which is a more straight-forward way of determining this. Reported-by: Tristan Ye Signed-off-by: Mark Fasheh --- fs/ocfs2/dir.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/ocfs2/dir.c') diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 5e6aeb00cb4..e71160cda11 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c @@ -3941,8 +3941,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, goto out_commit; } - orig_leaves_start = leaf_blkno & ~(osb->s_clustersize_bits - - osb->sb->s_blocksize_bits); + orig_leaves_start = ocfs2_block_to_cluster_start(dir->i_sb, leaf_blkno); ret = ocfs2_read_dx_leaves(dir, orig_leaves_start, num_dx_leaves, orig_dx_leaves); if (ret) { -- cgit v1.2.3