Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251809
b: refs/heads/master
c: e6b5859
h: refs/heads/master
i:
  251807: 036ffe8
v: v3
  • Loading branch information
Tristan Ye committed May 25, 2011
1 parent 2391abe commit 149a637
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99e4c750419e0bb24a1bbf094b1e6a5a4eedbc36
refs/heads/master: e6b5859cccfa0fec02f3c5b1069481efc7186f47
39 changes: 39 additions & 0 deletions trunk/fs/ocfs2/move_extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,42 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,

return ret;
}

static void ocfs2_probe_alloc_group(struct inode *inode, struct buffer_head *bh,
int *goal_bit, u32 move_len, u32 max_hop,
u32 *phys_cpos)
{
int i, used, last_free_bits = 0, base_bit = *goal_bit;
struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
u32 base_cpos = ocfs2_blocks_to_clusters(inode->i_sb,
le64_to_cpu(gd->bg_blkno));

for (i = base_bit; i < le16_to_cpu(gd->bg_bits); i++) {

used = ocfs2_test_bit(i, (unsigned long *)gd->bg_bitmap);
if (used) {
/*
* we even tried searching the free chunk by jumping
* a 'max_hop' distance, but still failed.
*/
if ((i - base_bit) > max_hop) {
*phys_cpos = 0;
break;
}

if (last_free_bits)
last_free_bits = 0;

continue;
} else
last_free_bits++;

if (last_free_bits == move_len) {
*goal_bit = i;
*phys_cpos = base_cpos + i;
break;
}
}

mlog(0, "found phys_cpos: %u to fit the wanted moving.\n", *phys_cpos);
}

0 comments on commit 149a637

Please sign in to comment.