diff options
author | Ross Zwisler <zwisler@chromium.org> | 2019-06-21 00:05:37 +0300 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-06-21 00:05:37 +0300 |
commit | aa0bfcd939c30617385ffa28682c062d78050eba (patch) | |
tree | eab7b4e883e4045c94a24d7a1bdf13b579dc0759 /mm/filemap.c | |
parent | c708b1c6de7f996b073bb3296af17f37881a09de (diff) | |
download | linux-aa0bfcd939c30617385ffa28682c062d78050eba.tar.xz |
mm: add filemap_fdatawait_range_keep_errors()
In the spirit of filemap_fdatawait_range() and
filemap_fdatawait_keep_errors(), introduce
filemap_fdatawait_range_keep_errors() which both takes a range upon
which to wait and does not clear errors from the address space.
Signed-off-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@vger.kernel.org
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index df2006ba0cfa..e87252ca0835 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -554,6 +554,28 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, EXPORT_SYMBOL(filemap_fdatawait_range); /** + * filemap_fdatawait_range_keep_errors - wait for writeback to complete + * @mapping: address space structure to wait for + * @start_byte: offset in bytes where the range starts + * @end_byte: offset in bytes where the range ends (inclusive) + * + * Walk the list of under-writeback pages of the given address space in the + * given range and wait for all of them. Unlike filemap_fdatawait_range(), + * this function does not clear error status of the address space. + * + * Use this function if callers don't handle errors themselves. Expected + * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2), + * fsfreeze(8) + */ +int filemap_fdatawait_range_keep_errors(struct address_space *mapping, + loff_t start_byte, loff_t end_byte) +{ + __filemap_fdatawait_range(mapping, start_byte, end_byte); + return filemap_check_and_keep_errors(mapping); +} +EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors); + +/** * file_fdatawait_range - wait for writeback to complete * @file: file pointing to address space structure to wait for * @start_byte: offset in bytes where the range starts |