aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/fscache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-04-03 11:42:44 -0400
committerDavid Howells <dhowells@redhat.com>2009-04-03 11:42:44 -0400
commit545db45f0fc0d4203b045047798ce156972a3056 (patch)
tree783db1091f5d6f21dafece81f6c94caf0aec98b8 /fs/nfs/fscache.h
parent6a51091d0775cdc4a923f2172c61925ad416aa32 (diff)
NFS: FS-Cache page management
FS-Cache page management for NFS. This includes hooking the releasing and invalidation of pages marked with PG_fscache (aka PG_private_2) and waiting for completion of the write-to-cache flag (PG_fscache_write aka PG_owner_priv_2). 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>
Diffstat (limited to 'fs/nfs/fscache.h')
-rw-r--r--fs/nfs/fscache.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
index 8b4299a0ad61..e29613a8cbd2 100644
--- a/fs/nfs/fscache.h
+++ b/fs/nfs/fscache.h
@@ -83,6 +83,31 @@ extern void nfs_fscache_zap_inode_cookie(struct inode *);
83extern void nfs_fscache_set_inode_cookie(struct inode *, struct file *); 83extern void nfs_fscache_set_inode_cookie(struct inode *, struct file *);
84extern void nfs_fscache_reset_inode_cookie(struct inode *); 84extern void nfs_fscache_reset_inode_cookie(struct inode *);
85 85
86extern void __nfs_fscache_invalidate_page(struct page *, struct inode *);
87extern int nfs_fscache_release_page(struct page *, gfp_t);
88
89/*
90 * wait for a page to complete writing to the cache
91 */
92static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi,
93 struct page *page)
94{
95 if (PageFsCache(page))
96 fscache_wait_on_page_write(nfsi->fscache, page);
97}
98
99/*
100 * release the caching state associated with a page if undergoing complete page
101 * invalidation
102 */
103static inline void nfs_fscache_invalidate_page(struct page *page,
104 struct inode *inode)
105{
106 if (PageFsCache(page))
107 __nfs_fscache_invalidate_page(page, inode);
108}
109
110
86#else /* CONFIG_NFS_FSCACHE */ 111#else /* CONFIG_NFS_FSCACHE */
87static inline int nfs_fscache_register(void) { return 0; } 112static inline int nfs_fscache_register(void) { return 0; }
88static inline void nfs_fscache_unregister(void) {} 113static inline void nfs_fscache_unregister(void) {}
@@ -104,5 +129,14 @@ static inline void nfs_fscache_set_inode_cookie(struct inode *inode,
104 struct file *filp) {} 129 struct file *filp) {}
105static inline void nfs_fscache_reset_inode_cookie(struct inode *inode) {} 130static inline void nfs_fscache_reset_inode_cookie(struct inode *inode) {}
106 131
132static inline int nfs_fscache_release_page(struct page *page, gfp_t gfp)
133{
134 return 1; /* True: may release page */
135}
136static inline void nfs_fscache_invalidate_page(struct page *page,
137 struct inode *inode) {}
138static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi,
139 struct page *page) {}
140
107#endif /* CONFIG_NFS_FSCACHE */ 141#endif /* CONFIG_NFS_FSCACHE */
108#endif /* _NFS_FSCACHE_H */ 142#endif /* _NFS_FSCACHE_H */