Linux NFS development
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Subject: [PATCH 13/17] NFS: Fix up nfs_vm_page_mkwrite() for folios
Date: Sat,  7 Jan 2023 12:36:31 -0500	[thread overview]
Message-ID: <20230107173635.2025233-14-trondmy@kernel.org> (raw)
In-Reply-To: <20230107173635.2025233-13-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/file.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 39ee7fb3f79f..563c5e0c55e8 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -556,23 +556,22 @@ const struct address_space_operations nfs_file_aops = {
  */
 static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
 {
-	struct page *page = vmf->page;
 	struct file *filp = vmf->vma->vm_file;
 	struct inode *inode = file_inode(filp);
 	unsigned pagelen;
 	vm_fault_t ret = VM_FAULT_NOPAGE;
 	struct address_space *mapping;
-	struct folio *folio = page_folio(page);
+	struct folio *folio = page_folio(vmf->page);
 
 	dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%lu), offset %lld)\n",
-		filp, filp->f_mapping->host->i_ino,
-		(long long)page_offset(page));
+		 filp, filp->f_mapping->host->i_ino,
+		 (long long)folio_file_pos(folio));
 
 	sb_start_pagefault(inode->i_sb);
 
 	/* make sure the cache has finished storing the page */
-	if (PageFsCache(page) &&
-	    wait_on_page_fscache_killable(vmf->page) < 0) {
+	if (folio_test_fscache(folio) &&
+	    folio_wait_fscache_killable(folio) < 0) {
 		ret = VM_FAULT_RETRY;
 		goto out;
 	}
@@ -581,14 +580,14 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
 			   nfs_wait_bit_killable,
 			   TASK_KILLABLE|TASK_FREEZABLE_UNSAFE);
 
-	lock_page(page);
-	mapping = page_file_mapping(page);
+	folio_lock(folio);
+	mapping = folio_file_mapping(folio);
 	if (mapping != inode->i_mapping)
 		goto out_unlock;
 
-	wait_on_page_writeback(page);
+	folio_wait_writeback(folio);
 
-	pagelen = nfs_page_length(page);
+	pagelen = nfs_folio_length(folio);
 	if (pagelen == 0)
 		goto out_unlock;
 
@@ -599,7 +598,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
 
 	ret = VM_FAULT_SIGBUS;
 out_unlock:
-	unlock_page(page);
+	folio_unlock(folio);
 out:
 	sb_end_pagefault(inode->i_sb);
 	return ret;
-- 
2.39.0


  reply	other threads:[~2023-01-07 17:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 17:36 [PATCH 00/17] Initial conversion of NFS basic I/O to use folios trondmy
2023-01-07 17:36 ` [PATCH 01/17] NFS: Fix for xfstests generic/208 trondmy
2023-01-07 17:36   ` [PATCH 02/17] NFS: Add basic functionality for tracking folios in struct nfs_page trondmy
2023-01-07 17:36     ` [PATCH 03/17] NFS: Support folios in nfs_generic_pgio() trondmy
2023-01-07 17:36       ` [PATCH 04/17] NFS: Fix nfs_coalesce_size() to work with folios trondmy
2023-01-07 17:36         ` [PATCH 05/17] NFS: Add a helper to convert a struct nfs_page into an inode trondmy
2023-01-07 17:36           ` [PATCH 06/17] NFS: Convert the remaining pagelist helper functions to support folios trondmy
2023-01-07 17:36             ` [PATCH 07/17] NFS: Add a helper nfs_wb_folio() trondmy
2023-01-07 17:36               ` [PATCH 08/17] NFS: Convert buffered reads to use folios trondmy
2023-01-07 17:36                 ` [PATCH 09/17] NFS: Convert the function nfs_wb_page() " trondmy
2023-01-07 17:36                   ` [PATCH 10/17] NFS: Convert buffered writes " trondmy
2023-01-07 17:36                     ` [PATCH 11/17] NFS: Remove unused function nfs_wb_page() trondmy
2023-01-07 17:36                       ` [PATCH 12/17] NFS: Convert nfs_write_begin/end to use folios trondmy
2023-01-07 17:36                         ` trondmy [this message]
2023-01-07 17:36                           ` [PATCH 14/17] NFS: Clean up O_DIRECT request allocation trondmy
2023-01-07 17:36                             ` [PATCH 15/17] NFS: fix up nfs_release_folio() to try to release the page trondmy
2023-01-07 17:36                               ` [PATCH 16/17] NFS: Enable tracing of nfs_invalidate_folio() and nfs_launder_folio() trondmy
2023-01-07 17:36                                 ` [PATCH 17/17] NFS: Improve tracing of nfs_wb_folio() trondmy
2023-01-11 16:18                   ` [PATCH 09/17] NFS: Convert the function nfs_wb_page() to use folios Anna Schumaker

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=20230107173635.2025233-14-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=linux-nfs@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