+ nfs-use-local-caching-12.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     NFS: Use local caching [try #12]

has been added to the -mm tree.  Its filename is

     nfs-use-local-caching-12.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: NFS: Use local caching [try #12]
From: David Howells <dhowells@xxxxxxxxxx>

Make it possible for the NFS filesystem to make use of the network
filesystem local caching service (FS-Cache).

To be able to use this, an updated mount program is required.  This can be
obtained from:

	http://people.redhat.com/steved/cachefs/util-linux/

To mount an NFS filesystem to use caching, add an "fsc" option to the mount:

	mount warthog:/ /a -o fsc

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/nfs/file.c    |   29 +++++++++++++++++++----------
 fs/nfs/fscache.c |    2 ++
 fs/nfs/fscache.h |   26 ++++++++++++++++++--------
 3 files changed, 39 insertions(+), 18 deletions(-)

diff -puN fs/nfs/file.c~nfs-use-local-caching-12 fs/nfs/file.c
--- a/fs/nfs/file.c~nfs-use-local-caching-12
+++ a/fs/nfs/file.c
@@ -311,6 +311,12 @@ static int nfs_commit_write(struct file 
 	return status;
 }
 
+/*
+ * partially or wholly invalidate a page
+ * - release the private state associated with a page if undergoing complete
+ *   page invalidation
+ * - caller holds page lock
+ */
 static void nfs_invalidate_page(struct page *page, unsigned long offset)
 {
 	struct inode *inode = page->mapping->host;
@@ -327,10 +333,13 @@ static void nfs_invalidate_page(struct p
 		ClearPagePrivate(page);
 }
 
+/*
+ * release the private state associated with a page, if the page isn't busy
+ * - caller holds page lock
+ * - return true (may release) or false (may not)
+ */
 static int nfs_release_page(struct page *page, gfp_t gfp)
 {
-	int error;
-
 	if ((gfp & __GFP_FS) == 0) {
 		/*
 		 * Avoid deadlock on nfs_wait_on_request().
@@ -338,17 +347,17 @@ static int nfs_release_page(struct page 
 		return 0;
 	}
 
-	error = nfs_wb_page(page->mapping->host, page);
+	if (nfs_wb_page(page->mapping->host, page) < 0)
+		return 0;
 
-	if (error == 0) {
-		nfs_fscache_release_page(page);
+	if (nfs_fscache_release_page(page) < 0)
+		return 0;
 
-		/* may have been set due to either caching or writing */
-		ClearPagePrivate(page);
-	}
+	/* PG_private may have been set due to either caching or writing */
+	BUG_ON(page->private != 0);
+	ClearPagePrivate(page);
 
-	/* releasepage() returns true/false */
-	return (error == 0) ? 1 : 0;
+	return 1;
 }
 
 /*
diff -puN fs/nfs/fscache.c~nfs-use-local-caching-12 fs/nfs/fscache.c
--- a/fs/nfs/fscache.c~nfs-use-local-caching-12
+++ a/fs/nfs/fscache.c
@@ -140,6 +140,8 @@ static void nfs_fh_mark_pages_cached(voi
 	dprintk("NFS: nfs_fh_mark_pages_cached: nfs_inode 0x%p pages %ld\n",
 		nfsi, cached_pvec->nr);
 
+	BUG_ON(!nfsi->fscache);
+
 	for (loop = 0; loop < cached_pvec->nr; loop++)
 		SetPageNfsCached(cached_pvec->pages[loop]);
 }
diff -puN fs/nfs/fscache.h~nfs-use-local-caching-12 fs/nfs/fscache.h
--- a/fs/nfs/fscache.h~nfs-use-local-caching-12
+++ a/fs/nfs/fscache.h
@@ -203,23 +203,28 @@ static inline void nfs_fscache_install_v
 }
 
 /*
- * release the caching state associated with a page
+ * release the caching state associated with a page, if the page isn't busy
+ * interacting with the cache
  */
-static void nfs_fscache_release_page(struct page *page)
+static inline int nfs_fscache_release_page(struct page *page)
 {
+	if (PageFsMisc(page))
+		return -EBUSY;
+
 	if (PageNfsCached(page)) {
 		struct nfs_inode *nfsi = NFS_I(page->mapping->host);
 
-		BUG_ON(nfsi->fscache == NULL);
+		BUG_ON(!nfsi->fscache);
 
 		dfprintk(FSCACHE, "NFS: fscache releasepage (0x%p/0x%p/0x%p)\n",
 			 nfsi->fscache, page, nfsi);
 
-		wait_on_page_fs_misc(page);
 		fscache_uncache_page(nfsi->fscache, page);
 		atomic_inc(&nfs_fscache_uncache_page);
 		ClearPageNfsCached(page);
 	}
+
+	return 0;
 }
 
 /*
@@ -230,19 +235,24 @@ static inline void nfs_fscache_invalidat
 					       struct inode *inode,
 					       unsigned long offset)
 {
-	if (PageNfsCached(page)) {
-		struct nfs_inode *nfsi = NFS_I(page->mapping->host);
+	struct nfs_inode *nfsi = NFS_I(page->mapping->host);
 
+	if (PageNfsCached(page)) {
 		BUG_ON(!nfsi->fscache);
 
 		dfprintk(FSCACHE,
 			 "NFS: fscache invalidatepage (0x%p/0x%p/0x%p)\n",
 			 nfsi->fscache, page, nfsi);
 
+		wait_on_page_fs_misc(page);
+
 		if (offset == 0) {
 			BUG_ON(!PageLocked(page));
-			if (!PageWriteback(page))
-				nfs_fscache_release_page(page);
+			if (!PageWriteback(page)) {
+				fscache_uncache_page(nfsi->fscache, page);
+				atomic_inc(&nfs_fscache_uncache_page);
+				ClearPageNfsCached(page);
+			}
 		}
 	}
 }
_

Patches currently in -mm which might be from dhowells@xxxxxxxxxx are

git-gfs2.patch
git-nfs.patch
nfs-replace-null-dentries-that-appear-in-readdirs-list-2.patch
binfmt_elf-consistently-use-loff_t.patch
afs-add-lock-annotations-to-afs_proc_cell_servers_startstop.patch
elf_fdpic_core_dump-dont-take-tasklist_lock.patch
reiserfs-make-sure-all-dentries-refs-are-released-before-calling-kill_block_super-try-2.patch
fs-cache-provide-a-filesystem-specific-syncable-page-bit.patch
fs-cache-generic-filesystem-caching-facility.patch
fs-cache-release-page-private-in-failed-readahead.patch
fs-cache-release-page-private-after-failed-readahead-12.patch
fs-cache-make-kafs-use-fs-cache.patch
fs-cache-make-kafs-use-fs-cache-fix.patch
fs-cache-make-kafs-use-fs-cache-12.patch
fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch
nfs-use-local-caching.patch
nfs-use-local-caching-12.patch
fs-cache-cachefiles-ia64-missing-copy_page-export.patch
fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem.patch
fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-printk-format-warning.patch
autofs-make-sure-all-dentries-refs-are-released-before-calling-kill_anon_super.patch
vfs-destroy-the-dentries-contributed-by-a-superblock-on-unmounting.patch
vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers.patch
nfs-represent-64-bit-fileids-as-64-bit-inode-numbers-on-32-bit-systems.patch
ecryptfs-get_sb_dev-fix.patch
reiser4-get_sb_dev-fix.patch
mutex-subsystem-synchro-test-module.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux