diff options
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r-- | fs/ext4/move_extent.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 661f4ce688ec..309ca899a731 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -739,6 +739,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, | |||
739 | donor_off += dext_alen; | 739 | donor_off += dext_alen; |
740 | orig_off += dext_alen; | 740 | orig_off += dext_alen; |
741 | 741 | ||
742 | BUG_ON(replaced_count > count); | ||
742 | /* Already moved the expected blocks */ | 743 | /* Already moved the expected blocks */ |
743 | if (replaced_count >= count) | 744 | if (replaced_count >= count) |
744 | break; | 745 | break; |
@@ -816,7 +817,13 @@ mext_page_double_lock(struct inode *inode1, struct inode *inode2, | |||
816 | page_cache_release(page[0]); | 817 | page_cache_release(page[0]); |
817 | return -ENOMEM; | 818 | return -ENOMEM; |
818 | } | 819 | } |
819 | 820 | /* | |
821 | * grab_cache_page_write_begin() may not wait on page's writeback if | ||
822 | * BDI not demand that. But it is reasonable to be very conservative | ||
823 | * here and explicitly wait on page's writeback | ||
824 | */ | ||
825 | wait_on_page_writeback(page[0]); | ||
826 | wait_on_page_writeback(page[1]); | ||
820 | if (inode1 > inode2) { | 827 | if (inode1 > inode2) { |
821 | struct page *tmp; | 828 | struct page *tmp; |
822 | tmp = page[0]; | 829 | tmp = page[0]; |
@@ -1034,7 +1041,7 @@ data_copy: | |||
1034 | } | 1041 | } |
1035 | /* Perform all necessary steps similar write_begin()/write_end() | 1042 | /* Perform all necessary steps similar write_begin()/write_end() |
1036 | * but keeping in mind that i_size will not change */ | 1043 | * but keeping in mind that i_size will not change */ |
1037 | *err = __block_write_begin(pagep[0], from, from + replaced_size, | 1044 | *err = __block_write_begin(pagep[0], from, replaced_size, |
1038 | ext4_get_block); | 1045 | ext4_get_block); |
1039 | if (!*err) | 1046 | if (!*err) |
1040 | *err = block_commit_write(pagep[0], from, from + replaced_size); | 1047 | *err = block_commit_write(pagep[0], from, from + replaced_size); |