All of lore.kernel.org
 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 15/26] nfs: Convert to release_folio
Date: Mon,  2 May 2022 06:56:03 +0100	[thread overview]
Message-ID: <20220502055614.3473032-16-willy@infradead.org> (raw)
In-Reply-To: <20220502055614.3473032-1-willy@infradead.org>

Use folios throughout the release_folio paths.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/nfs/file.c    | 22 +++++++++++-----------
 fs/nfs/fscache.h | 14 +++++++-------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 4f6d1f90b87f..d764b3ce7905 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -415,19 +415,19 @@ static void nfs_invalidate_folio(struct folio *folio, size_t offset,
 }
 
 /*
- * Attempt to release the private state associated with a page
- * - Called if either PG_private or PG_fscache is set on the page
- * - Caller holds page lock
- * - Return true (may release page) or false (may not)
+ * Attempt to release the private state associated with a folio
+ * - Called if either private or fscache flags are set on the folio
+ * - Caller holds folio lock
+ * - Return true (may release folio) or false (may not)
  */
-static int nfs_release_page(struct page *page, gfp_t gfp)
+static bool nfs_release_folio(struct folio *folio, gfp_t gfp)
 {
-	dfprintk(PAGECACHE, "NFS: release_page(%p)\n", page);
+	dfprintk(PAGECACHE, "NFS: release_folio(%p)\n", folio);
 
-	/* If PagePrivate() is set, then the page is not freeable */
-	if (PagePrivate(page))
-		return 0;
-	return nfs_fscache_release_page(page, gfp);
+	/* If the private flag is set, then the folio is not freeable */
+	if (folio_test_private(folio))
+		return false;
+	return nfs_fscache_release_folio(folio, gfp);
 }
 
 static void nfs_check_dirty_writeback(struct folio *folio,
@@ -522,7 +522,7 @@ const struct address_space_operations nfs_file_aops = {
 	.write_begin = nfs_write_begin,
 	.write_end = nfs_write_end,
 	.invalidate_folio = nfs_invalidate_folio,
-	.releasepage = nfs_release_page,
+	.release_folio = nfs_release_folio,
 	.direct_IO = nfs_direct_IO,
 #ifdef CONFIG_MIGRATION
 	.migratepage = nfs_migrate_page,
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 4e980cc04779..2a37af880978 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -48,14 +48,14 @@ extern void nfs_fscache_release_file(struct inode *, struct file *);
 extern int __nfs_fscache_read_page(struct inode *, struct page *);
 extern void __nfs_fscache_write_page(struct inode *, struct page *);
 
-static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
+static inline bool nfs_fscache_release_folio(struct folio *folio, gfp_t gfp)
 {
-	if (PageFsCache(page)) {
+	if (folio_test_fscache(folio)) {
 		if (current_is_kswapd() || !(gfp & __GFP_FS))
 			return false;
-		wait_on_page_fscache(page);
-		fscache_note_page_release(nfs_i_fscache(page->mapping->host));
-		nfs_inc_fscache_stats(page->mapping->host,
+		folio_wait_fscache(folio);
+		fscache_note_page_release(nfs_i_fscache(folio->mapping->host));
+		nfs_inc_fscache_stats(folio->mapping->host,
 				      NFSIOS_FSCACHE_PAGES_UNCACHED);
 	}
 	return true;
@@ -129,9 +129,9 @@ static inline void nfs_fscache_open_file(struct inode *inode,
 					 struct file *filp) {}
 static inline void nfs_fscache_release_file(struct inode *inode, struct file *file) {}
 
-static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
+static inline bool nfs_fscache_release_folio(struct folio *folio, gfp_t gfp)
 {
-	return 1; /* True: may release page */
+	return true; /* may release folio */
 }
 static inline int nfs_fscache_read_page(struct inode *inode, struct page *page)
 {
-- 
2.34.1


  parent reply	other threads:[~2022-05-02  5:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02  5:55 [PATCH 00/26] Converting release_page to release_folio Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 01/26] fs: Add aops->release_folio Matthew Wilcox (Oracle)
2022-05-02 15:19   ` Jeff Layton
2022-05-02 18:06     ` Matthew Wilcox
2022-05-02  5:55 ` [PATCH 02/26] iomap: Convert to release_folio Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 03/26] 9p: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 04/26] afs: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 05/26] btrfs: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 06/26] ceph: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 07/26] cifs: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 08/26] erofs: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 09/26] ext4: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 10/26] f2fs: " Matthew Wilcox (Oracle)
2022-05-02  5:55 ` [PATCH 11/26] gfs2: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 12/26] hfs: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 13/26] hfsplus: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 14/26] jfs: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` Matthew Wilcox (Oracle) [this message]
2022-05-02  5:56 ` [PATCH 16/26] nilfs2: Remove comment about releasepage Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 17/26] ocfs2: Convert to release_folio Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 18/26] orangefs: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 19/26] reiserfs: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 20/26] ubifs: " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 21/26] fs: Remove last vestiges of releasepage Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 22/26] reiserfs: Convert release_buffer_page() to use a folio Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 23/26] jbd2: Convert jbd2_journal_try_to_free_buffers to take " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 24/26] jbd2: Convert release_buffer_page() to use " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 25/26] fs: Change try_to_free_buffers() to take " Matthew Wilcox (Oracle)
2022-05-02  5:56 ` [PATCH 26/26] fs: Convert drop_buffers() to use " Matthew Wilcox (Oracle)
2022-05-08 19:33 [GIT UPDATE] pagecache tree Matthew Wilcox
2022-05-08 20:32 ` [PATCH 00/26] Convert aops->releasepage to aops->release_folio Matthew Wilcox (Oracle)
2022-05-08 20:32   ` [PATCH 15/26] nfs: Convert to release_folio Matthew Wilcox (Oracle)

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=20220502055614.3473032-16-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.