From: Dave Wysochanski <dwysocha@redhat.com>
To: Trond Myklebust <trondmy@hammerspace.com>,
Anna Schumaker <anna.schumaker@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 10/10] NFS: update various invalidation code paths for new IO API
Date: Thu, 28 Jan 2021 09:55:08 -0500 [thread overview]
Message-ID: <1611845708-6752-11-git-send-email-dwysocha@redhat.com> (raw)
In-Reply-To: <1611845708-6752-1-git-send-email-dwysocha@redhat.com>
The new fscache IO API removes the following invalidation related
older APIs: fscache_uncache_all_inode_pages, fscache_uncache_page,
and fscache_wait_on_page_write. Update various code paths to the
new API which only requires we wait for PG_fscache which indicates
fscache IO in progress on the page.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
---
fs/nfs/file.c | 9 +++++----
fs/nfs/fscache.c | 23 +----------------------
fs/nfs/fscache.h | 28 +---------------------------
3 files changed, 7 insertions(+), 53 deletions(-)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 9e41745c3faf..e81e11603b9a 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -416,7 +416,7 @@ static void nfs_invalidate_page(struct page *page, unsigned int offset,
/* Cancel any unstarted writes on this page */
nfs_wb_page_cancel(page_file_mapping(page)->host, page);
- nfs_fscache_invalidate_page(page, page->mapping->host);
+ wait_on_page_fscache(page);
}
/*
@@ -482,12 +482,11 @@ static void nfs_check_dirty_writeback(struct page *page,
static int nfs_launder_page(struct page *page)
{
struct inode *inode = page_file_mapping(page)->host;
- struct nfs_inode *nfsi = NFS_I(inode);
dfprintk(PAGECACHE, "NFS: launder_page(%ld, %llu)\n",
inode->i_ino, (long long)page_offset(page));
- nfs_fscache_wait_on_page_write(nfsi, page);
+ wait_on_page_fscache(page);
return nfs_wb_page(inode, page);
}
@@ -562,7 +561,9 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf)
sb_start_pagefault(inode->i_sb);
/* make sure the cache has finished storing the page */
- nfs_fscache_wait_on_page_write(NFS_I(inode), page);
+ if (PageFsCache(vmf->page) &&
+ wait_on_page_bit_killable(vmf->page, PG_fscache) < 0)
+ return VM_FAULT_RETRY;
wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
nfs_wait_bit_killable, TASK_KILLABLE);
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c
index dd8cf3cfed0a..d18eeea9c1b5 100644
--- a/fs/nfs/fscache.c
+++ b/fs/nfs/fscache.c
@@ -16,6 +16,7 @@
#include <linux/slab.h>
#include <linux/iversion.h>
#include <linux/xarray.h>
+#define FSCACHE_USE_NEW_IO_API
#include <linux/fscache.h>
#include <linux/netfs.h>
@@ -320,7 +321,6 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
dfprintk(FSCACHE, "NFS: nfsi 0x%p disabling cache\n", nfsi);
clear_bit(NFS_INO_FSCACHE, &nfsi->flags);
fscache_disable_cookie(cookie, &auxdata, true);
- fscache_uncache_all_inode_pages(cookie, inode);
} else {
dfprintk(FSCACHE, "NFS: nfsi 0x%p enabling cache\n", nfsi);
fscache_enable_cookie(cookie, &auxdata, nfsi->vfs_inode.i_size,
@@ -331,27 +331,6 @@ void nfs_fscache_open_file(struct inode *inode, struct file *filp)
}
EXPORT_SYMBOL_GPL(nfs_fscache_open_file);
-/*
- * Release the caching state associated with a page if undergoing complete page
- * invalidation.
- */
-void __nfs_fscache_invalidate_page(struct page *page, struct inode *inode)
-{
- struct fscache_cookie *cookie = nfs_i_fscache(inode);
-
- BUG_ON(!cookie);
-
- dfprintk(FSCACHE, "NFS: fscache invalidatepage (0x%p/0x%p/0x%p)\n",
- cookie, page, NFS_I(inode));
-
- fscache_wait_on_page_write(cookie, page);
-
- BUG_ON(!PageLocked(page));
- fscache_uncache_page(cookie, page);
- nfs_inc_fscache_stats(page->mapping->host,
- NFSIOS_FSCACHE_PAGES_UNCACHED);
-}
-
static void nfs_issue_op(struct netfs_read_subrequest *subreq)
{
struct inode *inode = subreq->rreq->inode;
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 9f8b1f8e69f3..f9d0464188af 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -11,6 +11,7 @@
#include <linux/nfs_fs.h>
#include <linux/nfs_mount.h>
#include <linux/nfs4_mount.h>
+#define FSCACHE_USE_NEW_IO_API
#include <linux/fscache.h>
#ifdef CONFIG_NFS_FSCACHE
@@ -93,7 +94,6 @@ struct nfs_fscache_inode_auxdata {
extern void nfs_fscache_clear_inode(struct inode *);
extern void nfs_fscache_open_file(struct inode *, struct file *);
-extern void __nfs_fscache_invalidate_page(struct page *, struct inode *);
extern int nfs_readpage_from_fscache(struct file *file,
struct page *page,
struct nfs_readdesc *desc);
@@ -102,27 +102,6 @@ extern int nfs_readahead_from_fscache(struct nfs_readdesc *desc,
extern void nfs_read_completion_to_fscache(struct nfs_pgio_header *hdr,
unsigned long bytes);
/*
- * wait for a page to complete writing to the cache
- */
-static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi,
- struct page *page)
-{
- if (PageFsCache(page))
- fscache_wait_on_page_write(nfsi->fscache, page);
-}
-
-/*
- * release the caching state associated with a page if undergoing complete page
- * invalidation
- */
-static inline void nfs_fscache_invalidate_page(struct page *page,
- struct inode *inode)
-{
- if (PageFsCache(page))
- __nfs_fscache_invalidate_page(page, inode);
-}
-
-/*
* Invalidate the contents of fscache for this inode. This will not sleep.
*/
static inline void nfs_fscache_invalidate(struct inode *inode)
@@ -162,11 +141,6 @@ static inline void nfs_fscache_clear_inode(struct inode *inode) {}
static inline void nfs_fscache_open_file(struct inode *inode,
struct file *filp) {}
-static inline void nfs_fscache_invalidate_page(struct page *page,
- struct inode *inode) {}
-static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi,
- struct page *page) {}
-
static inline int nfs_readpage_from_fscache(struct file *file,
struct page *page,
struct nfs_readdesc *desc)
--
1.8.3.1
next prev parent reply other threads:[~2021-01-28 14:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 14:54 [PATCH 00/10] Convert NFS fscache read paths to netfs API Dave Wysochanski
2021-01-28 14:54 ` [PATCH 01/10] NFS: Clean up nfs_readpage() and nfs_readpages() Dave Wysochanski
2021-01-28 14:55 ` [PATCH 02/10] NFS: In nfs_readpage() only increment NFSIOS_READPAGES when read succeeds Dave Wysochanski
2021-01-28 14:55 ` [PATCH 03/10] NFS: Refactor nfs_readpage() and nfs_readpage_async() to use nfs_readdesc Dave Wysochanski
2021-01-28 14:55 ` [PATCH 04/10] NFS: Call readpage_async_filler() from nfs_readpage_async() Dave Wysochanski
2021-01-28 14:55 ` [PATCH 05/10] NFS: Add nfs_pageio_complete_read() and remove nfs_readpage_async() Dave Wysochanski
2021-01-28 14:55 ` [PATCH 06/10] NFS: Allow internal use of read structs and functions Dave Wysochanski
2021-02-05 13:47 ` David Wysochanski
2021-02-05 16:24 ` Anna Schumaker
2021-01-28 14:55 ` [PATCH 07/10] NFS: Convert to the netfs API and nfs_readpage to use netfs_readpage Dave Wysochanski
2021-01-28 14:55 ` [PATCH 08/10] NFS: Convert readpages to readahead and use netfs_readahead for fscache Dave Wysochanski
2021-01-28 14:55 ` [PATCH 09/10] NFS: Update releasepage to handle new fscache kiocb IO API Dave Wysochanski
2021-01-28 14:55 ` Dave Wysochanski [this message]
2021-02-01 2:15 ` [PATCH 00/10] Convert NFS fscache read paths to netfs API David Wysochanski
2021-02-01 14:30 ` Anna Schumaker
2021-02-02 12:19 ` David Wysochanski
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=1611845708-6752-11-git-send-email-dwysocha@redhat.com \
--to=dwysocha@redhat.com \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@hammerspace.com \
/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