NFS: Store pages from an NFS inode into a local cache
Store pages from an NFS inode into the cache data storage object associated with that inode. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Steve Dickson <steved@redhat.com> Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
This commit is contained in:
@@ -493,3 +493,31 @@ int __nfs_readpages_from_fscache(struct nfs_open_context *ctx,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Store a newly fetched page in fscache
|
||||
* - PG_fscache must be set on the page
|
||||
*/
|
||||
void __nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dfprintk(FSCACHE,
|
||||
"NFS: readpage_to_fscache(fsc:%p/p:%p(i:%lx f:%lx)/%d)\n",
|
||||
NFS_I(inode)->fscache, page, page->index, page->flags, sync);
|
||||
|
||||
ret = fscache_write_page(NFS_I(inode)->fscache, page, GFP_KERNEL);
|
||||
dfprintk(FSCACHE,
|
||||
"NFS: readpage_to_fscache: p:%p(i:%lu f:%lx) ret %d\n",
|
||||
page, page->index, page->flags, ret);
|
||||
|
||||
if (ret != 0) {
|
||||
fscache_uncache_page(NFS_I(inode)->fscache, page);
|
||||
nfs_add_fscache_stats(inode,
|
||||
NFSIOS_FSCACHE_PAGES_WRITTEN_FAIL, 1);
|
||||
nfs_add_fscache_stats(inode, NFSIOS_FSCACHE_PAGES_UNCACHED, 1);
|
||||
} else {
|
||||
nfs_add_fscache_stats(inode,
|
||||
NFSIOS_FSCACHE_PAGES_WRITTEN_OK, 1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user