From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jeff Layton <jlayton@redhat.com>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 05/11] page-writeback: Convert folio_write_one() to use an errseq
Date: Mon, 9 Jan 2023 05:18:17 +0000 [thread overview]
Message-ID: <20230109051823.480289-6-willy@infradead.org> (raw)
In-Reply-To: <20230109051823.480289-1-willy@infradead.org>
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@infradead.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
next prev parent reply other threads:[~2023-01-09 5:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 5:18 [PATCH 00/11] Remove AS_EIO and AS_ENOSPC Matthew Wilcox (Oracle)
2023-01-09 5:18 ` [PATCH 01/11] memory-failure: Remove comment referencing AS_EIO Matthew Wilcox (Oracle)
2023-01-12 8:31 ` Christoph Hellwig
2023-01-09 5:18 ` [PATCH 02/11] filemap: Remove filemap_check_and_keep_errors() Matthew Wilcox (Oracle)
2023-01-09 13:48 ` Jeff Layton
2023-01-09 14:02 ` Matthew Wilcox
2023-01-09 14:31 ` Jeff Layton
2023-01-09 15:02 ` Matthew Wilcox
2023-01-09 5:18 ` [PATCH 03/11] f2fs: Convert f2fs_wait_on_node_pages_writeback() to errseq Matthew Wilcox (Oracle)
2023-01-09 5:18 ` [PATCH 04/11] fuse: Convert fuse_flush() to use file_check_and_advance_wb_err() Matthew Wilcox (Oracle)
2023-01-09 15:25 ` Jeff Layton
2023-01-09 5:18 ` Matthew Wilcox (Oracle) [this message]
2023-01-09 5:18 ` [PATCH 06/11] filemap: Convert filemap_write_and_wait_range() to use errseq Matthew Wilcox (Oracle)
2023-01-17 2:55 ` kernel test robot
2023-01-09 5:18 ` [PATCH 07/11] filemap: Convert filemap_fdatawait_range() to errseq Matthew Wilcox (Oracle)
2023-01-09 5:18 ` [PATCH 08/11] cifs: Remove call to filemap_check_wb_err() Matthew Wilcox (Oracle)
2023-01-09 14:42 ` Jeff Layton
2023-01-09 15:07 ` Matthew Wilcox
2023-01-09 15:14 ` Jeff Layton
2023-01-09 15:30 ` Matthew Wilcox
2023-01-09 15:43 ` Jeff Layton
2023-01-09 5:18 ` [PATCH 09/11] mm: Remove AS_EIO and AS_ENOSPC Matthew Wilcox (Oracle)
2023-01-09 5:18 ` [PATCH 10/11] mm: Remove filemap_fdatawait_range_keep_errors() Matthew Wilcox (Oracle)
2023-01-09 5:18 ` [PATCH 11/11] mm: Remove filemap_fdatawait_keep_errors() Matthew Wilcox (Oracle)
2023-01-09 15:31 ` [PATCH 00/11] Remove AS_EIO and AS_ENOSPC Jeff Layton
2023-01-12 8:30 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230109051823.480289-6-willy@infradead.org \
--to=willy@infradead.org \
--cc=hch@lst.de \
--cc=jlayton@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox