aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/move_extents.c
diff options
context:
space:
mode:
authorTristan Ye <tristan.ye@oracle.com>2011-05-27 03:24:14 -0400
committerTristan Ye <tristan.ye@oracle.com>2011-05-27 02:52:57 -0400
commitea5e1675ac832b42889ac8d254ea8fbfbdfaa8b2 (patch)
tree04b1e47be93c982a392e4eededda41dc67191422 /fs/ocfs2/move_extents.c
parent6aea6f5068cb86e89a6ac243c3fc131045b6563a (diff)
Ocfs2/move_extents: Validate moving goal after the adjustment.
though the goal_to_be_moved will be validated again in following moving, it's still a good idea to validate it after adjustment at the very beginning, instead of validating it before adjustment. Signed-off-by: Tristan Ye <tristan.ye@oracle.com>
Diffstat (limited to 'fs/ocfs2/move_extents.c')
-rw-r--r--fs/ocfs2/move_extents.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index d184e0b4b95f..cd9427023d2e 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -472,12 +472,24 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
472 int ret, goal_bit = 0; 472 int ret, goal_bit = 0;
473 473
474 struct buffer_head *gd_bh = NULL; 474 struct buffer_head *gd_bh = NULL;
475 struct ocfs2_group_desc *bg; 475 struct ocfs2_group_desc *bg = NULL;
476 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 476 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
477 int c_to_b = 1 << (osb->s_clustersize_bits - 477 int c_to_b = 1 << (osb->s_clustersize_bits -
478 inode->i_sb->s_blocksize_bits); 478 inode->i_sb->s_blocksize_bits);
479 479
480 /* 480 /*
481 * make goal become cluster aligned.
482 */
483 range->me_goal = ocfs2_block_to_cluster_start(inode->i_sb,
484 range->me_goal);
485 /*
486 * moving goal is not allowd to start with a group desc blok(#0 blk)
487 * let's compromise to the latter cluster.
488 */
489 if (range->me_goal == le64_to_cpu(bg->bg_blkno))
490 range->me_goal += c_to_b;
491
492 /*
481 * validate goal sits within global_bitmap, and return the victim 493 * validate goal sits within global_bitmap, and return the victim
482 * group desc 494 * group desc
483 */ 495 */
@@ -491,18 +503,6 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
491 bg = (struct ocfs2_group_desc *)gd_bh->b_data; 503 bg = (struct ocfs2_group_desc *)gd_bh->b_data;
492 504
493 /* 505 /*
494 * make goal become cluster aligned.
495 */
496 range->me_goal = ocfs2_block_to_cluster_start(inode->i_sb,
497 range->me_goal);
498 /*
499 * moving goal is not allowd to start with a group desc blok(#0 blk)
500 * let's compromise to the latter cluster.
501 */
502 if (range->me_goal == le64_to_cpu(bg->bg_blkno))
503 range->me_goal += c_to_b;
504
505 /*
506 * movement is not gonna cross two groups. 506 * movement is not gonna cross two groups.
507 */ 507 */
508 if ((le16_to_cpu(bg->bg_bits) - goal_bit) * osb->s_clustersize < 508 if ((le16_to_cpu(bg->bg_bits) - goal_bit) * osb->s_clustersize <