diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:43 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:43 -0400 |
commit | d599064a1bca7bcbaabe54b94fa73ea86952cae3 (patch) | |
tree | f2b6d6b79053ea8a8b8178219203f30cc9c1c0b4 /fs | |
parent | ef79c097bbe9724e13937271b3457df560e00370 (diff) |
NFS: Invalidate FsCache page flags when cache removed
Invalidate the FsCache page flags on the pages belonging to an inode when the
cache backing that NFS inode is removed.
This allows a live cache to be withdrawn.
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')
-rw-r--r-- | fs/nfs/fscache-index.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/fs/nfs/fscache-index.c b/fs/nfs/fscache-index.c index 7bc54acb7b00..a119b5691e7c 100644 --- a/fs/nfs/fscache-index.c +++ b/fs/nfs/fscache-index.c | |||
@@ -253,6 +253,45 @@ enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data, | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Indication from FS-Cache that the cookie is no longer cached | ||
257 | * - This function is called when the backing store currently caching a cookie | ||
258 | * is removed | ||
259 | * - The netfs should use this to clean up any markers indicating cached pages | ||
260 | * - This is mandatory for any object that may have data | ||
261 | */ | ||
262 | static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) | ||
263 | { | ||
264 | struct nfs_inode *nfsi = cookie_netfs_data; | ||
265 | struct pagevec pvec; | ||
266 | pgoff_t first; | ||
267 | int loop, nr_pages; | ||
268 | |||
269 | pagevec_init(&pvec, 0); | ||
270 | first = 0; | ||
271 | |||
272 | dprintk("NFS: nfs_inode_now_uncached: nfs_inode 0x%p\n", nfsi); | ||
273 | |||
274 | for (;;) { | ||
275 | /* grab a bunch of pages to unmark */ | ||
276 | nr_pages = pagevec_lookup(&pvec, | ||
277 | nfsi->vfs_inode.i_mapping, | ||
278 | first, | ||
279 | PAGEVEC_SIZE - pagevec_count(&pvec)); | ||
280 | if (!nr_pages) | ||
281 | break; | ||
282 | |||
283 | for (loop = 0; loop < nr_pages; loop++) | ||
284 | ClearPageFsCache(pvec.pages[loop]); | ||
285 | |||
286 | first = pvec.pages[nr_pages - 1]->index + 1; | ||
287 | |||
288 | pvec.nr = nr_pages; | ||
289 | pagevec_release(&pvec); | ||
290 | cond_resched(); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | /* | ||
256 | * Define the inode object for FS-Cache. This is used to describe an inode | 295 | * Define the inode object for FS-Cache. This is used to describe an inode |
257 | * object to fscache_acquire_cookie(). It is keyed by the NFS file handle for | 296 | * object to fscache_acquire_cookie(). It is keyed by the NFS file handle for |
258 | * an inode. | 297 | * an inode. |
@@ -268,4 +307,5 @@ const struct fscache_cookie_def nfs_fscache_inode_object_def = { | |||
268 | .get_attr = nfs_fscache_inode_get_attr, | 307 | .get_attr = nfs_fscache_inode_get_attr, |
269 | .get_aux = nfs_fscache_inode_get_aux, | 308 | .get_aux = nfs_fscache_inode_get_aux, |
270 | .check_aux = nfs_fscache_inode_check_aux, | 309 | .check_aux = nfs_fscache_inode_check_aux, |
310 | .now_uncached = nfs_fscache_inode_now_uncached, | ||
271 | }; | 311 | }; |