linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: remove filemap_fdatawait_keep_errors
@ 2022-11-01  9:34 changfengnan
  2022-11-01 12:44 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: changfengnan @ 2022-11-01  9:34 UTC (permalink / raw)
  To: willy, linux-fsdevel, linux-mm, viro, djwong, dchinner,
	chandan.babu, linux-xfs
  Cc: changfengnan

use filemap_fdatawait_range_keep_errors to instead of
filemap_fdatawait_keep_errors, no functional change.

Signed-off-by: changfengnan <changfengnan@bytedance.com>
---
 block/bdev.c            |  5 +++--
 fs/fs-writeback.c       |  5 +++--
 fs/xfs/scrub/bmap.c     |  3 ++-
 include/linux/pagemap.h |  1 -
 mm/filemap.c            | 21 ---------------------
 5 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/block/bdev.c b/block/bdev.c
index ce05175e71ce..f600b10017cd 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -1055,10 +1055,11 @@ void sync_bdevs(bool wait)
 			/*
 			 * We keep the error status of individual mapping so
 			 * that applications can catch the writeback error using
-			 * fsync(2). See filemap_fdatawait_keep_errors() for
+			 * fsync(2). See filemap_fdatawait_range_keep_errors for
 			 * details.
 			 */
-			filemap_fdatawait_keep_errors(inode->i_mapping);
+			filemap_fdatawait_range_keep_errors(inode->i_mapping,
+								0, LLONG_MAX);
 		} else {
 			filemap_fdatawrite(inode->i_mapping);
 		}
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 443f83382b9b..d417cdb4505a 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -2582,9 +2582,10 @@ static void wait_sb_inodes(struct super_block *sb)
 		/*
 		 * We keep the error status of individual mapping so that
 		 * applications can catch the writeback error using fsync(2).
-		 * See filemap_fdatawait_keep_errors() for details.
+		 * See filemap_fdatawait_range_keep_errors for details.
 		 */
-		filemap_fdatawait_keep_errors(mapping);
+		filemap_fdatawait_range_keep_errors(inode->i_mapping,
+							0, LLONG_MAX);
 
 		cond_resched();
 
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index f0b9cb6506fd..6be0433eaa51 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -64,7 +64,8 @@ xchk_setup_inode_bmap(
 		 */
 		error = filemap_fdatawrite(mapping);
 		if (!error)
-			error = filemap_fdatawait_keep_errors(mapping);
+			error = filemap_fdatawait_range_keep_errors(mapping,
+								0, LLONG_MAX);
 		if (error && (error != -ENOSPC && error != -EIO))
 			goto out;
 	}
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 0178b2040ea3..75536967f57b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -33,7 +33,6 @@ 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);
diff --git a/mm/filemap.c b/mm/filemap.c
index 15800334147b..b4932493175b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -600,27 +600,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)
-{
-	__filemap_fdatawait_range(mapping, 0, LLONG_MAX);
-	return filemap_check_and_keep_errors(mapping);
-}
-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.37.0 (Apple Git-136)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: remove filemap_fdatawait_keep_errors
  2022-11-01  9:34 [PATCH] mm: remove filemap_fdatawait_keep_errors changfengnan
@ 2022-11-01 12:44 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2022-11-01 12:44 UTC (permalink / raw)
  To: changfengnan
  Cc: linux-fsdevel, linux-mm, viro, djwong, dchinner, chandan.babu,
	linux-xfs

On Tue, Nov 01, 2022 at 05:34:13PM +0800, changfengnan wrote:
> use filemap_fdatawait_range_keep_errors to instead of
> filemap_fdatawait_keep_errors, no functional change.

I'd rather see a patch which turned filemap_fdatawait_keep_errors()
into

static int filemap_fdatawait_keep_errors(struct address_space *mapping)
{
	return filemap_fdatawait_range_keep_errors(mapping, 0, LLONG_MAX);
}

then the callers get the nice interface they want.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-01 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-01  9:34 [PATCH] mm: remove filemap_fdatawait_keep_errors changfengnan
2022-11-01 12:44 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).