diff options
author | Jeff Layton <jlayton@redhat.com> | 2017-07-28 07:24:43 -0400 |
---|---|---|
committer | Jeff Layton <jlayton@redhat.com> | 2017-07-31 19:12:26 -0400 |
commit | a823e4589e68996436d16db4ede9a43b646332f9 (patch) | |
tree | 2961b2c0bd94da25551564b52ff5501918b96fb5 /mm/filemap.c | |
parent | 7e51fe1dd180e525c9cb9dc613c524c83c130867 (diff) |
mm: add file_fdatawait_range and file_write_and_wait
Necessary now for gfs2_fsync and sync_file_range, but there will
eventually be other callers.
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 72e46e6f0d9a..394bb5e96f87 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -476,6 +476,29 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, | |||
476 | EXPORT_SYMBOL(filemap_fdatawait_range); | 476 | EXPORT_SYMBOL(filemap_fdatawait_range); |
477 | 477 | ||
478 | /** | 478 | /** |
479 | * file_fdatawait_range - wait for writeback to complete | ||
480 | * @file: file pointing to address space structure to wait for | ||
481 | * @start_byte: offset in bytes where the range starts | ||
482 | * @end_byte: offset in bytes where the range ends (inclusive) | ||
483 | * | ||
484 | * Walk the list of under-writeback pages of the address space that file | ||
485 | * refers to, in the given range and wait for all of them. Check error | ||
486 | * status of the address space vs. the file->f_wb_err cursor and return it. | ||
487 | * | ||
488 | * Since the error status of the file is advanced by this function, | ||
489 | * callers are responsible for checking the return value and handling and/or | ||
490 | * reporting the error. | ||
491 | */ | ||
492 | int file_fdatawait_range(struct file *file, loff_t start_byte, loff_t end_byte) | ||
493 | { | ||
494 | struct address_space *mapping = file->f_mapping; | ||
495 | |||
496 | __filemap_fdatawait_range(mapping, start_byte, end_byte); | ||
497 | return file_check_and_advance_wb_err(file); | ||
498 | } | ||
499 | EXPORT_SYMBOL(file_fdatawait_range); | ||
500 | |||
501 | /** | ||
479 | * filemap_fdatawait_keep_errors - wait for writeback without clearing errors | 502 | * filemap_fdatawait_keep_errors - wait for writeback without clearing errors |
480 | * @mapping: address space structure to wait for | 503 | * @mapping: address space structure to wait for |
481 | * | 504 | * |