aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ocfs2/move_extents.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 4c5488468c14..d184e0b4b95f 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -368,7 +368,7 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode,
368 int *vict_bit, 368 int *vict_bit,
369 struct buffer_head **ret_bh) 369 struct buffer_head **ret_bh)
370{ 370{
371 int ret, i, blocks_per_unit = 1; 371 int ret, i, bits_per_unit = 0;
372 u64 blkno; 372 u64 blkno;
373 char namebuf[40]; 373 char namebuf[40];
374 374
@@ -398,14 +398,14 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode,
398 rec = &(cl->cl_recs[0]); 398 rec = &(cl->cl_recs[0]);
399 399
400 if (type == GLOBAL_BITMAP_SYSTEM_INODE) 400 if (type == GLOBAL_BITMAP_SYSTEM_INODE)
401 blocks_per_unit <<= (osb->s_clustersize_bits - 401 bits_per_unit = osb->s_clustersize_bits -
402 inode->i_sb->s_blocksize_bits); 402 inode->i_sb->s_blocksize_bits;
403 /* 403 /*
404 * 'vict_blkno' was out of the valid range. 404 * 'vict_blkno' was out of the valid range.
405 */ 405 */
406 if ((vict_blkno < le64_to_cpu(rec->c_blkno)) || 406 if ((vict_blkno < le64_to_cpu(rec->c_blkno)) ||
407 (vict_blkno >= (le32_to_cpu(ac_dinode->id1.bitmap1.i_total) * 407 (vict_blkno >= (le32_to_cpu(ac_dinode->id1.bitmap1.i_total) <<
408 blocks_per_unit))) { 408 bits_per_unit))) {
409 ret = -EINVAL; 409 ret = -EINVAL;
410 goto out; 410 goto out;
411 } 411 }
@@ -441,8 +441,8 @@ static int ocfs2_find_victim_alloc_group(struct inode *inode,
441 le16_to_cpu(bg->bg_bits))) { 441 le16_to_cpu(bg->bg_bits))) {
442 442
443 *ret_bh = gd_bh; 443 *ret_bh = gd_bh;
444 *vict_bit = (vict_blkno - blkno) / 444 *vict_bit = (vict_blkno - blkno) >>
445 blocks_per_unit; 445 bits_per_unit;
446 mlog(0, "find the victim group: #%llu, " 446 mlog(0, "find the victim group: #%llu, "
447 "total_bits: %u, vict_bit: %u\n", 447 "total_bits: %u, vict_bit: %u\n",
448 blkno, le16_to_cpu(bg->bg_bits), 448 blkno, le16_to_cpu(bg->bg_bits),
@@ -493,9 +493,8 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
493 /* 493 /*
494 * make goal become cluster aligned. 494 * make goal become cluster aligned.
495 */ 495 */
496 if (range->me_goal % c_to_b) 496 range->me_goal = ocfs2_block_to_cluster_start(inode->i_sb,
497 range->me_goal = range->me_goal / c_to_b * c_to_b; 497 range->me_goal);
498
499 /* 498 /*
500 * moving goal is not allowd to start with a group desc blok(#0 blk) 499 * moving goal is not allowd to start with a group desc blok(#0 blk)
501 * let's compromise to the latter cluster. 500 * let's compromise to the latter cluster.