Use wait_for_stable_page() instead of wait_on_page_writeback()
Huawei engineer Jianfeng report that without this patch, the consequence
write may cause seconds to finish.
The patch helps because most of storage today doesn't require that the
page isn't changed while IO is in flight. That is required only for
data checksumming or copy-on-write semantics but ext4 does neither of
those. So we don't have to wait for IO completion in ext4_write_begin()
unless underlying storage requires it.
--Honza
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
(cherry picked from commit
7afe5aa59ed3da7b6161617e7f157c7c680dc41e)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
ext4_journal_stop(handle);
goto retry_grab;
}
ext4_journal_stop(handle);
goto retry_grab;
}
- wait_on_page_writeback(page);
+ /* In case writeback began while the page was unlocked */
+ wait_for_stable_page(page);
if (ext4_should_dioread_nolock(inode))
ret = __block_write_begin(page, pos, len, ext4_get_block_write);
if (ext4_should_dioread_nolock(inode))
ret = __block_write_begin(page, pos, len, ext4_get_block_write);
goto retry_grab;
}
/* In case writeback began while the page was unlocked */
goto retry_grab;
}
/* In case writeback began while the page was unlocked */
- wait_on_page_writeback(page);
+ wait_for_stable_page(page);
ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep);
if (ret < 0) {
ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep);
if (ret < 0) {