login
Header Space

 
 

[PATCH 28/30] nfs: disable data cache revalidation for swapfiles

Previous thread: [PATCH 06/30] mm: kmem_alloc_estimate() by Peter Zijlstra on Thursday, March 20, 2008 - 4:10 pm. (1 message)

Next thread: [PATCH 29/30] nfs: enable swap on NFS by Peter Zijlstra on Thursday, March 20, 2008 - 4:11 pm. (1 message)
To: Linus Torvalds <torvalds@...>, Andrew Morton <akpm@...>, <linux-kernel@...>, <linux-mm@...>, <netdev@...>, <trond.myklebust@...>, <neilb@...>, <miklos@...>, <penberg@...>, <a.p.zijlstra@...>
Date: Thursday, March 20, 2008 - 4:11 pm

Do as Trond suggested:
  http://lkml.org/lkml/2006/8/25/348

Disable NFS data cache revalidation on swap files since it doesn't really 
make sense to have other clients change the file while you are using it.

Thereby we can stop setting PG_private on swap pages, since there ought to
be no further races with invalidate_inode_pages2() to deal with.

And since we cannot set PG_private we cannot use page-&gt;private (which is
already used by PG_swapcache pages anyway) to store the nfs_page. Thus
augment the new nfs_page_find_request logic.

Signed-off-by: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
---
 fs/nfs/inode.c |    6 ++++
 fs/nfs/write.c |   73 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 65 insertions(+), 14 deletions(-)

Index: linux-2.6/fs/nfs/inode.c
===================================================================
--- linux-2.6.orig/fs/nfs/inode.c
+++ linux-2.6/fs/nfs/inode.c
@@ -764,6 +764,12 @@ int nfs_revalidate_mapping_nolock(struct
 	struct nfs_inode *nfsi = NFS_I(inode);
 	int ret = 0;
 
+	/*
+	 * swapfiles are not supposed to be shared.
+	 */
+	if (IS_SWAPFILE(inode))
+		goto out;
+
 	if ((nfsi-&gt;cache_validity &amp; NFS_INO_REVAL_PAGECACHE)
 			|| nfs_attribute_timeout(inode) || NFS_STALE(inode)) {
 		ret = __nfs_revalidate_inode(NFS_SERVER(inode), inode);
Index: linux-2.6/fs/nfs/write.c
===================================================================
--- linux-2.6.orig/fs/nfs/write.c
+++ linux-2.6/fs/nfs/write.c
@@ -112,25 +112,62 @@ static void nfs_context_set_write_error(
 	set_bit(NFS_CONTEXT_ERROR_WRITE, &amp;ctx-&gt;flags);
 }
 
-static struct nfs_page *nfs_page_find_request_locked(struct page *page)
+static struct nfs_page *
+__nfs_page_find_request_locked(struct nfs_inode *nfsi, struct page *page, int get)
 {
 	struct nfs_page *req = NULL;
 
-	if (PagePrivate(page)) {
+	if (PagePrivate(page))
 		req = (struct nfs_page *)page_private(page);
-		if (req != NULL)
-			kref_get(&amp;req-&gt;wb_kref);
...
Previous thread: [PATCH 06/30] mm: kmem_alloc_estimate() by Peter Zijlstra on Thursday, March 20, 2008 - 4:10 pm. (1 message)

Next thread: [PATCH 29/30] nfs: enable swap on NFS by Peter Zijlstra on Thursday, March 20, 2008 - 4:11 pm. (1 message)
speck-geostationary