diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:44 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:44 -0400 |
commit | 9a9fc1c03315f1606596e55b4096d39e2079a041 (patch) | |
tree | 0eb9a2d9844a821e515baeb59e6d5e38384d5915 /fs/nfs/fscache.h | |
parent | f42b293d6d5259043a8944b556eeab427c695d57 (diff) |
NFS: Read pages from FS-Cache into an NFS inode
Read pages from an FS-Cache data storage object representing an inode into an
NFS 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>
Diffstat (limited to 'fs/nfs/fscache.h')
-rw-r--r-- | fs/nfs/fscache.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h index e29613a8cbd..099349c171c 100644 --- a/fs/nfs/fscache.h +++ b/fs/nfs/fscache.h | |||
@@ -86,6 +86,12 @@ extern void nfs_fscache_reset_inode_cookie(struct inode *); | |||
86 | extern void __nfs_fscache_invalidate_page(struct page *, struct inode *); | 86 | extern void __nfs_fscache_invalidate_page(struct page *, struct inode *); |
87 | extern int nfs_fscache_release_page(struct page *, gfp_t); | 87 | extern int nfs_fscache_release_page(struct page *, gfp_t); |
88 | 88 | ||
89 | extern int __nfs_readpage_from_fscache(struct nfs_open_context *, | ||
90 | struct inode *, struct page *); | ||
91 | extern int __nfs_readpages_from_fscache(struct nfs_open_context *, | ||
92 | struct inode *, struct address_space *, | ||
93 | struct list_head *, unsigned *); | ||
94 | |||
89 | /* | 95 | /* |
90 | * wait for a page to complete writing to the cache | 96 | * wait for a page to complete writing to the cache |
91 | */ | 97 | */ |
@@ -107,6 +113,32 @@ static inline void nfs_fscache_invalidate_page(struct page *page, | |||
107 | __nfs_fscache_invalidate_page(page, inode); | 113 | __nfs_fscache_invalidate_page(page, inode); |
108 | } | 114 | } |
109 | 115 | ||
116 | /* | ||
117 | * Retrieve a page from an inode data storage object. | ||
118 | */ | ||
119 | static inline int nfs_readpage_from_fscache(struct nfs_open_context *ctx, | ||
120 | struct inode *inode, | ||
121 | struct page *page) | ||
122 | { | ||
123 | if (NFS_I(inode)->fscache) | ||
124 | return __nfs_readpage_from_fscache(ctx, inode, page); | ||
125 | return -ENOBUFS; | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * Retrieve a set of pages from an inode data storage object. | ||
130 | */ | ||
131 | static inline int nfs_readpages_from_fscache(struct nfs_open_context *ctx, | ||
132 | struct inode *inode, | ||
133 | struct address_space *mapping, | ||
134 | struct list_head *pages, | ||
135 | unsigned *nr_pages) | ||
136 | { | ||
137 | if (NFS_I(inode)->fscache) | ||
138 | return __nfs_readpages_from_fscache(ctx, inode, mapping, pages, | ||
139 | nr_pages); | ||
140 | return -ENOBUFS; | ||
141 | } | ||
110 | 142 | ||
111 | #else /* CONFIG_NFS_FSCACHE */ | 143 | #else /* CONFIG_NFS_FSCACHE */ |
112 | static inline int nfs_fscache_register(void) { return 0; } | 144 | static inline int nfs_fscache_register(void) { return 0; } |
@@ -138,5 +170,20 @@ static inline void nfs_fscache_invalidate_page(struct page *page, | |||
138 | static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi, | 170 | static inline void nfs_fscache_wait_on_page_write(struct nfs_inode *nfsi, |
139 | struct page *page) {} | 171 | struct page *page) {} |
140 | 172 | ||
173 | static inline int nfs_readpage_from_fscache(struct nfs_open_context *ctx, | ||
174 | struct inode *inode, | ||
175 | struct page *page) | ||
176 | { | ||
177 | return -ENOBUFS; | ||
178 | } | ||
179 | static inline int nfs_readpages_from_fscache(struct nfs_open_context *ctx, | ||
180 | struct inode *inode, | ||
181 | struct address_space *mapping, | ||
182 | struct list_head *pages, | ||
183 | unsigned *nr_pages) | ||
184 | { | ||
185 | return -ENOBUFS; | ||
186 | } | ||
187 | |||
141 | #endif /* CONFIG_NFS_FSCACHE */ | 188 | #endif /* CONFIG_NFS_FSCACHE */ |
142 | #endif /* _NFS_FSCACHE_H */ | 189 | #endif /* _NFS_FSCACHE_H */ |