linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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 09/11] mm: Remove AS_EIO and AS_ENOSPC
Date: Mon,  9 Jan 2023 05:18:21 +0000	[thread overview]
Message-ID: <20230109051823.480289-10-willy@infradead.org> (raw)
In-Reply-To: <20230109051823.480289-1-willy@infradead.org>

All users are now converted to use wb_err, so convert the
remaining comments, drop the unused filemap_check_errors()
and remove the compatibility code in mapping_set_error() and
file_check_and_advance_wb_err().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/btrfs/extent_io.c    |  6 +++---
 fs/f2fs/data.c          |  2 +-
 include/linux/pagemap.h | 20 +++++---------------
 mm/filemap.c            | 21 ---------------------
 4 files changed, 9 insertions(+), 40 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 9bd32daa9b9a..f1c3572b6a90 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2386,7 +2386,7 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb)
 	 * or the content of some node/leaf from a past generation that got
 	 * cowed or deleted and is no longer valid.
 	 *
-	 * Note: setting AS_EIO/AS_ENOSPC in the btree inode's i_mapping would
+	 * Note: setting wb_err in the btree inode's i_mapping would
 	 * not be enough - we need to distinguish between log tree extents vs
 	 * non-log tree extents, and the next filemap_fdatawait_range() call
 	 * will catch and clear such errors in the mapping - and that call might
@@ -2397,10 +2397,10 @@ static void set_btree_ioerr(struct page *page, struct extent_buffer *eb)
 	 * set (since it's a runtime flag, not persisted on disk).
 	 *
 	 * Using the flags below in the btree inode also makes us achieve the
-	 * goal of AS_EIO/AS_ENOSPC when writepages() returns success, started
+	 * goal of wb_err when writepages() returns success, started
 	 * writeback for all dirty pages and before filemap_fdatawait_range()
 	 * is called, the writeback for all dirty pages had already finished
-	 * with errors - because we were not using AS_EIO/AS_ENOSPC,
+	 * with errors - because we were not using wb_err,
 	 * filemap_fdatawait_range() would return success, as it could not know
 	 * that writeback errors happened (the pages were no longer tagged for
 	 * writeback).
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 97e816590cd9..566fe19ca57d 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -2913,7 +2913,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
 	redirty_page_for_writepage(wbc, page);
 	/*
 	 * pageout() in MM traslates EAGAIN, so calls handle_write_error()
-	 * -> mapping_set_error() -> set_bit(AS_EIO, ...).
+	 * -> mapping_set_error().
 	 * file_write_and_wait_range() will see EIO error, which is critical
 	 * to return value of fsync() followed by atomic_write failure to user.
 	 */
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 985fd47739f4..573b8cce3a85 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -51,7 +51,6 @@ int __filemap_fdatawrite_range(struct address_space *mapping,
 		loff_t start, loff_t end, int sync_mode);
 int filemap_fdatawrite_range(struct address_space *mapping,
 		loff_t start, loff_t end);
-int filemap_check_errors(struct address_space *mapping);
 void __filemap_set_wb_err(struct address_space *mapping, int err);
 int filemap_fdatawrite_wbc(struct address_space *mapping,
 			   struct writeback_control *wbc);
@@ -192,14 +191,11 @@ static inline bool mapping_shrinkable(struct address_space *mapping)
  * Bits in mapping->flags.
  */
 enum mapping_flags {
-	AS_EIO		= 0,	/* IO error on async write */
-	AS_ENOSPC	= 1,	/* ENOSPC on async write */
-	AS_MM_ALL_LOCKS	= 2,	/* under mm_take_all_locks() */
-	AS_UNEVICTABLE	= 3,	/* e.g., ramdisk, SHM_LOCK */
-	AS_EXITING	= 4, 	/* final truncate in progress */
-	/* writeback related tags are not used */
-	AS_NO_WRITEBACK_TAGS = 5,
-	AS_LARGE_FOLIO_SUPPORT = 6,
+	AS_MM_ALL_LOCKS	= 0,	/* under mm_take_all_locks() */
+	AS_UNEVICTABLE,		/* e.g., ramdisk, SHM_LOCK */
+	AS_EXITING, 		/* final truncate in progress */
+	AS_NO_WRITEBACK_TAGS,	/* writeback related tags are not used */
+	AS_LARGE_FOLIO_SUPPORT,
 };
 
 /**
@@ -227,12 +223,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
 	/* Record it in superblock */
 	if (mapping->host)
 		errseq_set(&mapping->host->i_sb->s_wb_err, error);
-
-	/* Record it in flags for now, for legacy callers */
-	if (error == -ENOSPC)
-		set_bit(AS_ENOSPC, &mapping->flags);
-	else
-		set_bit(AS_EIO, &mapping->flags);
 }
 
 static inline void mapping_set_unevictable(struct address_space *mapping)
diff --git a/mm/filemap.c b/mm/filemap.c
index 887520db115a..7bf8442bcfaa 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -341,20 +341,6 @@ void delete_from_page_cache_batch(struct address_space *mapping,
 		filemap_free_folio(mapping, fbatch->folios[i]);
 }
 
-int filemap_check_errors(struct address_space *mapping)
-{
-	int ret = 0;
-	/* Check for outstanding write errors */
-	if (test_bit(AS_ENOSPC, &mapping->flags) &&
-	    test_and_clear_bit(AS_ENOSPC, &mapping->flags))
-		ret = -ENOSPC;
-	if (test_bit(AS_EIO, &mapping->flags) &&
-	    test_and_clear_bit(AS_EIO, &mapping->flags))
-		ret = -EIO;
-	return ret;
-}
-EXPORT_SYMBOL(filemap_check_errors);
-
 /**
  * filemap_fdatawrite_wbc - start writeback on mapping dirty pages in range
  * @mapping:	address space structure to write
@@ -684,13 +670,6 @@ int file_check_and_advance_wb_err(struct file *file)
 		spin_unlock(&file->f_lock);
 	}
 
-	/*
-	 * We're mostly using this function as a drop in replacement for
-	 * filemap_check_errors. Clear AS_EIO/AS_ENOSPC to emulate the effect
-	 * that the legacy code would have had on these flags.
-	 */
-	clear_bit(AS_EIO, &mapping->flags);
-	clear_bit(AS_ENOSPC, &mapping->flags);
 	return err;
 }
 EXPORT_SYMBOL(file_check_and_advance_wb_err);
-- 
2.35.1



  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] " 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 ` [PATCH 05/11] page-writeback: Convert folio_write_one() to use an errseq Matthew Wilcox (Oracle)
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 ` Matthew Wilcox (Oracle) [this message]
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-10-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