Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174391
b: refs/heads/master
c: ac48b0a
h: refs/heads/master
i:
  174389: fd51c23
  174387: c4e9d54
  174383: aabdc8e
v: v3
  • Loading branch information
Akira Fujita authored and Theodore Ts'o committed Nov 24, 2009
1 parent c64553f commit 923a62c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 446aaa6e7e993b38a6f21c6acfa68f3f1af3dbe3
refs/heads/master: ac48b0a1d068887141581bea8285de5fcab182b0
30 changes: 9 additions & 21 deletions trunk/fs/ext4/move_extent.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
int replaced_count = 0;
int dext_alen;

/* Protect extent trees against block allocations via delalloc */
double_down_write_data_sem(orig_inode, donor_inode);

/* Get the original extent for the block "orig_off" */
*err = get_ext_path(orig_inode, orig_off, &orig_path);
if (*err)
Expand Down Expand Up @@ -755,6 +758,11 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
kfree(donor_path);
}

ext4_ext_invalidate_cache(orig_inode);
ext4_ext_invalidate_cache(donor_inode);

double_up_write_data_sem(orig_inode, donor_inode);

return replaced_count;
}

Expand Down Expand Up @@ -820,19 +828,9 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
* Just swap data blocks between orig and donor.
*/
if (uninit) {
/*
* Protect extent trees against block allocations
* via delalloc
*/
double_down_write_data_sem(orig_inode, donor_inode);
replaced_count = mext_replace_branches(handle, orig_inode,
donor_inode, orig_blk_offset,
block_len_in_page, err);

/* Clear the inode cache not to refer to the old data */
ext4_ext_invalidate_cache(orig_inode);
ext4_ext_invalidate_cache(donor_inode);
double_up_write_data_sem(orig_inode, donor_inode);
goto out2;
}

Expand Down Expand Up @@ -880,8 +878,6 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
/* Release old bh and drop refs */
try_to_release_page(page, 0);

/* Protect extent trees against block allocations via delalloc */
double_down_write_data_sem(orig_inode, donor_inode);
replaced_count = mext_replace_branches(handle, orig_inode, donor_inode,
orig_blk_offset, block_len_in_page,
&err2);
Expand All @@ -890,18 +886,10 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
block_len_in_page = replaced_count;
replaced_size =
block_len_in_page << orig_inode->i_blkbits;
} else {
double_up_write_data_sem(orig_inode, donor_inode);
} else
goto out;
}
}

/* Clear the inode cache not to refer to the old data */
ext4_ext_invalidate_cache(orig_inode);
ext4_ext_invalidate_cache(donor_inode);

double_up_write_data_sem(orig_inode, donor_inode);

if (!page_has_buffers(page))
create_empty_buffers(page, 1 << orig_inode->i_blkbits, 0);

Expand Down

0 comments on commit 923a62c

Please sign in to comment.