提交 7e8b12c6 编写于 作者: D Dmitry Monakhov 提交者: Theodore Ts'o

ext4: defragmentation code cleanup

- grab_cache_page_write_begin() may not wait on page's writeback since
  (1d1d1a76). But it is still reasonable to wait on page's writeback
  here in order to be on the safe side.

- Fix miss typo: pass 'length' instead of 'end' to __block_write_begin()
  https://bugzilla.kernel.org/show_bug.cgi?id=56241

TESTCASE: git://oss.sgi.com/xfs/cmds/xfstests.git
MKFS_OPTIONS="-b1024" ; ./check ext4/304
Signed-off-by: NDmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Akira Fujita <a-fujita.rs.jp.nec.com>
上级 43e50f50
...@@ -739,6 +739,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, ...@@ -739,6 +739,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
donor_off += dext_alen; donor_off += dext_alen;
orig_off += dext_alen; orig_off += dext_alen;
BUG_ON(replaced_count > count);
/* Already moved the expected blocks */ /* Already moved the expected blocks */
if (replaced_count >= count) if (replaced_count >= count)
break; break;
...@@ -816,7 +817,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, ...@@ -816,7 +817,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2,
page_cache_release(page[0]); page_cache_release(page[0]);
return -ENOMEM; return -ENOMEM;
} }
/*
* grab_cache_page_write_begin() may not wait on page's writeback if
* BDI not demand that. But it is reasonable to be very conservative
* here and explicitly wait on page's writeback
*/
wait_on_page_writeback(page[0]);
wait_on_page_writeback(page[1]);
if (inode1 > inode2) { if (inode1 > inode2) {
struct page *tmp; struct page *tmp;
tmp = page[0]; tmp = page[0];
...@@ -1034,7 +1041,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode, ...@@ -1034,7 +1041,7 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
} }
/* Perform all necessary steps similar write_begin()/write_end() /* Perform all necessary steps similar write_begin()/write_end()
* but keeping in mind that i_size will not change */ * but keeping in mind that i_size will not change */
*err = __block_write_begin(pagep[0], from, from + replaced_size, *err = __block_write_begin(pagep[0], from, replaced_size,
ext4_get_block); ext4_get_block);
if (!*err) if (!*err)
*err = block_commit_write(pagep[0], from, from + replaced_size); *err = block_commit_write(pagep[0], from, from + replaced_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册