[PATCH 07/11] filemap: Convert filemap_fdatawait_range() to errseq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This removes the unwelcome behaviour of clearing the
errors in the address space, which is the same behaviour as
filemap_fdatawait_range_keep_errors(), so unify the two functions.
We can also get rid of filemap_fdatawait_keep_errors() as it is now the
same as filemap_fdatawait()

Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
 include/linux/pagemap.h |  7 +++---
 mm/filemap.c            | 51 +----------------------------------------
 2 files changed, 5 insertions(+), 53 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 29e1f9e76eb6..985fd47739f4 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -33,16 +33,17 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
 int write_inode_now(struct inode *, int sync);
 int filemap_fdatawrite(struct address_space *);
 int filemap_flush(struct address_space *);
-int filemap_fdatawait_keep_errors(struct address_space *mapping);
 int filemap_fdatawait_range(struct address_space *, loff_t lstart, loff_t lend);
-int filemap_fdatawait_range_keep_errors(struct address_space *mapping,
-		loff_t start_byte, loff_t end_byte);
 
 static inline int filemap_fdatawait(struct address_space *mapping)
 {
 	return filemap_fdatawait_range(mapping, 0, LLONG_MAX);
 }
 
+#define filemap_fdatawait_range_keep_errors(mapping, start, end)	\
+	filemap_fdatawait_range(mapping, start, end)
+#define filemap_fdatawait_keep_errors(mapping)	filemap_fdatawait(mapping)
+
 bool filemap_range_has_page(struct address_space *, loff_t lstart, loff_t lend);
 int filemap_write_and_wait_range(struct address_space *mapping,
 		loff_t lstart, loff_t lend);
diff --git a/mm/filemap.c b/mm/filemap.c
index c72b2e1140d7..887520db115a 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -526,43 +526,17 @@ static void __filemap_fdatawait_range(struct address_space *mapping,
  * in the given range and wait for all of them.  Check error status of
  * the address space and return it.
  *
- * Since the error status of the address space is cleared by this function,
- * callers are responsible for checking the return value and handling and/or
- * reporting the error.
- *
  * Return: error status of the address space.
  */
 int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
 			    loff_t end_byte)
-{
-	__filemap_fdatawait_range(mapping, start_byte, end_byte);
-	return filemap_check_errors(mapping);
-}
-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)
 {
 	errseq_t since = filemap_sample_wb_err(mapping);
 
 	__filemap_fdatawait_range(mapping, start_byte, end_byte);
 	return filemap_check_wb_err(mapping, since);
 }
-EXPORT_SYMBOL(filemap_fdatawait_range_keep_errors);
+EXPORT_SYMBOL(filemap_fdatawait_range);
 
 /**
  * file_fdatawait_range - wait for writeback to complete
@@ -589,29 +563,6 @@ int file_fdatawait_range(struct file *file, loff_t start_byte, loff_t end_byte)
 }
 EXPORT_SYMBOL(file_fdatawait_range);
 
-/**
- * filemap_fdatawait_keep_errors - wait for writeback without clearing errors
- * @mapping: address space structure to wait for
- *
- * Walk the list of under-writeback pages of the given address space
- * and wait for all of them.  Unlike filemap_fdatawait(), 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)
- *
- * Return: error status of the address space.
- */
-int filemap_fdatawait_keep_errors(struct address_space *mapping)
-{
-	errseq_t since = filemap_sample_wb_err(mapping);
-
-	__filemap_fdatawait_range(mapping, 0, LLONG_MAX);
-	return filemap_check_wb_err(mapping, since);
-}
-EXPORT_SYMBOL(filemap_fdatawait_keep_errors);
-
 /* Returns true if writeback might be needed or already in progress. */
 static bool mapping_needs_writeback(struct address_space *mapping)
 {
-- 
2.35.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux