History

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.

Ross Zwisler committed 7 years ago

Commit aa0bfcd1 parent c708b1c2 files · +24 −0Browse files

Unified · Split

2 files
  1. include/linux/fs.h +2 −0
  2. mm/filemap.c +22 −0
include/linux/fs.h+2−0
@@ -2712,6 +2712,8 @@ extern int filemap_flush(struct address_space *); · 2711 unmodified lines
2712extern int filemap_fdatawait_keep_errors(struct address_space *mapping);2712extern int filemap_fdatawait_keep_errors(struct address_space *mapping);
2713extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,2713extern int filemap_fdatawait_range(struct address_space *, loff_t lstart,
2714 loff_t lend);2714 loff_t lend);
2715extern int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
2716 loff_t start_byte, loff_t end_byte);
2715 2717
2716static inline int filemap_fdatawait(struct address_space *mapping)2718static inline int filemap_fdatawait(struct address_space *mapping)
2717{2719{
mm/filemap.c+22−0
@@ -553,6 +553,28 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte, · 552 unmodified lines
553}553}
554EXPORT_SYMBOL(filemap_fdatawait_range);554EXPORT_SYMBOL(filemap_fdatawait_range);
555 555
556/**
557 * filemap_fdatawait_range_keep_errors - wait for writeback to complete
558 * @mapping: address space structure to wait for
559 * @start_byte: offset in bytes where the range starts
560 * @end_byte: offset in bytes where the range ends (inclusive)
561 *
562 * Walk the list of under-writeback pages of the given address space in the
563 * given range and wait for all of them. Unlike filemap_fdatawait_range(),
564 * this function does not clear error status of the address space.
565 *
566 * Use this function if callers don't handle errors themselves. Expected
567 * call sites are system-wide / filesystem-wide data flushers: e.g. sync(2),
568 * fsfreeze(8)
569 */
570int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
571 loff_t start_byte, loff_t end_byte)
572{
573 __filemap_fdatawait_range(mapping, start_byte, end_byte);
574 return filemap_check_and_keep_errors(mapping);
575}
576EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors);
577
556/**578/**
557 * file_fdatawait_range - wait for writeback to complete579 * file_fdatawait_range - wait for writeback to complete
558 * @file: file pointing to address space structure to wait for580 * @file: file pointing to address space structure to wait for

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t