[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230109051823.480289-6-willy@infradead.org>
Date: Mon, 9 Jan 2023 05:18:17 +0000
From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
To: unlisted-recipients:; (no To-header on input)
Cc: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
Jeff Layton <jlayton@...hat.com>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Christoph Hellwig <hch@....de>
Subject: [PATCH 05/11] page-writeback: Convert folio_write_one() to use an errseq
Use the errseq infrastructure to detect an error due to writing
back this folio instead of the old error checking code.
Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
mm/page-writeback.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index ad608ef2a243..491b70dad994 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2610,15 +2610,12 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
*
* The folio must be locked by the caller and will be unlocked upon return.
*
- * Note that the mapping's AS_EIO/AS_ENOSPC flags will be cleared when this
- * function returns.
- *
* Return: %0 on success, negative error code otherwise
*/
int folio_write_one(struct folio *folio)
{
struct address_space *mapping = folio->mapping;
- int ret = 0;
+ int err = 0;
struct writeback_control wbc = {
.sync_mode = WB_SYNC_ALL,
.nr_to_write = folio_nr_pages(folio),
@@ -2629,18 +2626,20 @@ int folio_write_one(struct folio *folio)
folio_wait_writeback(folio);
if (folio_clear_dirty_for_io(folio)) {
+ errseq_t since = filemap_sample_wb_err(mapping);
+
folio_get(folio);
- ret = mapping->a_ops->writepage(&folio->page, &wbc);
- if (ret == 0)
+ err = mapping->a_ops->writepage(&folio->page, &wbc);
+ if (!err) {
folio_wait_writeback(folio);
+ err = filemap_check_wb_err(mapping, since);
+ }
folio_put(folio);
} else {
folio_unlock(folio);
}
- if (!ret)
- ret = filemap_check_errors(mapping);
- return ret;
+ return err;
}
EXPORT_SYMBOL(folio_write_one);
--
2.35.1
Powered by blists - more mailing lists