linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: [PATCH 33/56] fs: Add aops->launder_folio
Date: Wed,  9 Feb 2022 20:21:52 +0000	[thread overview]
Message-ID: <20220209202215.2055748-34-willy@infradead.org> (raw)
In-Reply-To: <20220209202215.2055748-1-willy@infradead.org>

Since the only difference between ->launder_page and ->launder_folio
is the type of the pointer, these can safely use a union without
affecting bisectability.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 Documentation/filesystems/locking.rst | 10 +++++-----
 Documentation/filesystems/vfs.rst     |  8 ++++----
 include/linux/fs.h                    |  5 ++++-
 mm/truncate.c                         |  8 ++++----
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index 8e9cbc0fb70f..dee512efb458 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -257,7 +257,7 @@ prototypes::
 	bool (*isolate_page) (struct page *, isolate_mode_t);
 	int (*migratepage)(struct address_space *, struct page *, struct page *);
 	void (*putback_page) (struct page *);
-	int (*launder_page)(struct page *);
+	int (*launder_folio)(struct folio *);
 	bool (*is_partially_uptodate)(struct folio *, size_t from, size_t count);
 	int (*error_remove_page)(struct address_space *, struct page *);
 	int (*swap_activate)(struct file *);
@@ -285,7 +285,7 @@ direct_IO:
 isolate_page:		yes
 migratepage:		yes (both)
 putback_page:		yes
-launder_page:		yes
+launder_folio:		yes
 is_partially_uptodate:	yes
 error_remove_page:	yes
 swap_activate:		no
@@ -385,9 +385,9 @@ the kernel assumes that the fs has no private interest in the buffers.
 ->freepage() is called when the kernel is done dropping the page
 from the page cache.
 
-->launder_page() may be called prior to releasing a page if
-it is still found to be dirty. It returns zero if the page was successfully
-cleaned, or an error value if not. Note that in order to prevent the page
+->launder_folio() may be called prior to releasing a folio if
+it is still found to be dirty. It returns zero if the folio was successfully
+cleaned, or an error value if not. Note that in order to prevent the folio
 getting mapped back in and redirtied, it needs to be kept locked
 across the entire operation.
 
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index 28704831652c..c54ca4d88ed6 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -745,7 +745,7 @@ cache in your filesystem.  The following members are defined:
 		int (*migratepage) (struct page *, struct page *);
 		/* put migration-failed page back to right list */
 		void (*putback_page) (struct page *);
-		int (*launder_page) (struct page *);
+		int (*launder_folio) (struct folio *);
 
 		bool (*is_partially_uptodate) (struct folio *, size_t from,
 					       size_t count);
@@ -930,9 +930,9 @@ cache in your filesystem.  The following members are defined:
 ``putback_page``
 	Called by the VM when isolated page's migration fails.
 
-``launder_page``
-	Called before freeing a page - it writes back the dirty page.
-	To prevent redirtying the page, it is kept locked during the
+``launder_folio``
+	Called before freeing a folio - it writes back the dirty folio.
+	To prevent redirtying the folio, it is kept locked during the
 	whole operation.
 
 ``is_partially_uptodate``
diff --git a/include/linux/fs.h b/include/linux/fs.h
index af9ae091bd82..0af3075cdff2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -399,7 +399,10 @@ struct address_space_operations {
 			struct page *, struct page *, enum migrate_mode);
 	bool (*isolate_page)(struct page *, isolate_mode_t);
 	void (*putback_page)(struct page *);
-	int (*launder_page) (struct page *);
+	union {
+		int (*launder_page) (struct page *);
+		int (*launder_folio) (struct folio *);
+	};
 	bool (*is_partially_uptodate) (struct folio *, size_t from,
 			size_t count);
 	void (*is_dirty_writeback) (struct page *, bool *, bool *);
diff --git a/mm/truncate.c b/mm/truncate.c
index 8010461a59bd..6ad44b546dff 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -614,13 +614,13 @@ static int invalidate_complete_folio2(struct address_space *mapping,
 	return 0;
 }
 
-static int do_launder_folio(struct address_space *mapping, struct folio *folio)
+static int folio_launder(struct address_space *mapping, struct folio *folio)
 {
 	if (!folio_test_dirty(folio))
 		return 0;
-	if (folio->mapping != mapping || mapping->a_ops->launder_page == NULL)
+	if (folio->mapping != mapping || mapping->a_ops->launder_folio == NULL)
 		return 0;
-	return mapping->a_ops->launder_page(&folio->page);
+	return mapping->a_ops->launder_folio(folio);
 }
 
 /**
@@ -686,7 +686,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping,
 				unmap_mapping_folio(folio);
 			BUG_ON(folio_mapped(folio));
 
-			ret2 = do_launder_folio(mapping, folio);
+			ret2 = folio_launder(mapping, folio);
 			if (ret2 == 0) {
 				if (!invalidate_complete_folio2(mapping, folio))
 					ret2 = -EBUSY;
-- 
2.34.1


  parent reply	other threads:[~2022-02-09 20:23 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 20:21 [PATCH 00/56] Filesystem folio conversions for 5.18 Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 01/56] Convert NFS from readpages to readahead Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 02/56] readahead: Remove read_cache_pages() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 03/56] iomap: Fix iomap_invalidatepage tracepoint Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 04/56] fs: read_mapping_page() should take a struct file argument Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 05/56] fs/remap_range: Pass the file pointer to read_mapping_folio() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 06/56] scsicam: Fix use of page cache Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 07/56] buffer: Add folio_buffers() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 08/56] fs: Convert is_partially_uptodate to folios Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 09/56] fs: Turn do_invalidatepage() into folio_invalidate() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 10/56] btrfs: Use folio_invalidate() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 11/56] ceph: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 12/56] ext4: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 13/56] fs: Add invalidate_folio() aops method Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 14/56] iomap: Remove iomap_invalidatepage() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 15/56] fs: Turn block_invalidatepage into block_invalidate_folio Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 16/56] fs: Remove noop_invalidatepage() Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 17/56] 9p: Convert to invalidate_folio Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 18/56] afs: Convert directory aops " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 19/56] afs: Convert invalidatepage " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 20/56] btrfs: Convert from " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 21/56] ceph: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 22/56] cifs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 23/56] erofs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 24/56] ext4: Convert " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 25/56] f2fs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 26/56] gfs2: " Matthew Wilcox (Oracle)
2022-02-10 12:42   ` Bob Peterson
2022-02-09 20:21 ` [PATCH 27/56] jfs: Convert from " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 28/56] nfs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 29/56] orangefs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 30/56] reiserfs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 31/56] ubifs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 32/56] fs: Remove aops->invalidatepage Matthew Wilcox (Oracle)
2022-02-09 20:21 ` Matthew Wilcox (Oracle) [this message]
2022-02-09 20:21 ` [PATCH 34/56] 9p: Convert from launder_page to launder_folio Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 35/56] afs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 36/56] cifs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 37/56] fuse: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 38/56] nfs: " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 39/56] orangefs: Convert " Matthew Wilcox (Oracle)
2022-02-09 20:21 ` [PATCH 40/56] fs: Remove aops->launder_page Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 41/56] fs: Add aops->dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 42/56] fscache: Convert fscache_set_page_dirty() to fscache_dirty_folio() Matthew Wilcox (Oracle)
2022-02-14  7:02   ` John Hubbard
2022-02-14 14:12     ` Matthew Wilcox
2022-02-09 20:22 ` [PATCH 43/56] btrfs: Convert from set_page_dirty to dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 44/56] fs: Convert trivial uses of __set_page_dirty_nobuffers to filemap_dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 45/56] btrfs: Convert extent_range_redirty_for_io() to use folios Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 46/56] afs: Convert afs_dir_set_page_dirty() to afs_dir_dirty_folio() Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 47/56] f2fs: Convert f2fs_set_meta_page_dirty to f2fs_dirty_meta_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 48/56] f2fs: Convert f2fs_set_data_page_dirty to f2fs_dirty_data_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 49/56] f2fs: Convert f2fs_set_node_page_dirty to f2fs_dirty_node_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 50/56] ubifs: Convert ubifs_set_page_dirty to ubifs_dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 51/56] mm: Convert swap_set_page_dirty() to swap_dirty_folio() Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 52/56] nilfs: Convert nilfs_set_page_dirty() to nilfs_dirty_folio() Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 53/56] fs: Convert __set_page_dirty_buffers to block_dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 54/56] fs: Convert __set_page_dirty_no_writeback to noop_dirty_folio Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 55/56] fb_defio: Use noop_dirty_folio() Matthew Wilcox (Oracle)
2022-02-09 20:22 ` [PATCH 56/56] fs: Remove aops ->set_page_dirty Matthew Wilcox (Oracle)
2022-02-10  4:31 ` [PATCH 00/56] Filesystem folio conversions for 5.18 Damien Le Moal
2022-02-14 14:19 ` Matthew Wilcox
2022-02-25 14:52   ` Mike Marshall

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=20220209202215.2055748-34-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).