diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/fscache.c | 1 | ||||
-rw-r--r-- | fs/fscache/page.c | 44 | ||||
-rw-r--r-- | fs/nfs/fscache.c | 8 |
3 files changed, 48 insertions, 5 deletions
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index 816696621ec9..42e5363b4102 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c | |||
@@ -92,6 +92,7 @@ static void cifs_fscache_disable_inode_cookie(struct inode *inode) | |||
92 | 92 | ||
93 | if (cifsi->fscache) { | 93 | if (cifsi->fscache) { |
94 | cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache); | 94 | cFYI(1, "%s: (0x%p)", __func__, cifsi->fscache); |
95 | fscache_uncache_all_inode_pages(cifsi->fscache, inode); | ||
95 | fscache_relinquish_cookie(cifsi->fscache, 1); | 96 | fscache_relinquish_cookie(cifsi->fscache, 1); |
96 | cifsi->fscache = NULL; | 97 | cifsi->fscache = NULL; |
97 | } | 98 | } |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index a2a5d19ece6a..2f343b4d7a7d 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -954,3 +954,47 @@ void fscache_mark_pages_cached(struct fscache_retrieval *op, | |||
954 | pagevec_reinit(pagevec); | 954 | pagevec_reinit(pagevec); |
955 | } | 955 | } |
956 | EXPORT_SYMBOL(fscache_mark_pages_cached); | 956 | EXPORT_SYMBOL(fscache_mark_pages_cached); |
957 | |||
958 | /* | ||
959 | * Uncache all the pages in an inode that are marked PG_fscache, assuming them | ||
960 | * to be associated with the given cookie. | ||
961 | */ | ||
962 | void __fscache_uncache_all_inode_pages(struct fscache_cookie *cookie, | ||
963 | struct inode *inode) | ||
964 | { | ||
965 | struct address_space *mapping = inode->i_mapping; | ||
966 | struct pagevec pvec; | ||
967 | pgoff_t next; | ||
968 | int i; | ||
969 | |||
970 | _enter("%p,%p", cookie, inode); | ||
971 | |||
972 | if (!mapping || mapping->nrpages == 0) { | ||
973 | _leave(" [no pages]"); | ||
974 | return; | ||
975 | } | ||
976 | |||
977 | pagevec_init(&pvec, 0); | ||
978 | next = 0; | ||
979 | while (next <= (loff_t)-1 && | ||
980 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE) | ||
981 | ) { | ||
982 | for (i = 0; i < pagevec_count(&pvec); i++) { | ||
983 | struct page *page = pvec.pages[i]; | ||
984 | pgoff_t page_index = page->index; | ||
985 | |||
986 | ASSERTCMP(page_index, >=, next); | ||
987 | next = page_index + 1; | ||
988 | |||
989 | if (PageFsCache(page)) { | ||
990 | __fscache_wait_on_page_write(cookie, page); | ||
991 | __fscache_uncache_page(cookie, page); | ||
992 | } | ||
993 | } | ||
994 | pagevec_release(&pvec); | ||
995 | cond_resched(); | ||
996 | } | ||
997 | |||
998 | _leave(""); | ||
999 | } | ||
1000 | EXPORT_SYMBOL(__fscache_uncache_all_inode_pages); | ||
diff --git a/fs/nfs/fscache.c b/fs/nfs/fscache.c index ce153a6b3aec..419119c371bf 100644 --- a/fs/nfs/fscache.c +++ b/fs/nfs/fscache.c | |||
@@ -259,12 +259,10 @@ static void nfs_fscache_disable_inode_cookie(struct inode *inode) | |||
259 | dfprintk(FSCACHE, | 259 | dfprintk(FSCACHE, |
260 | "NFS: nfsi 0x%p turning cache off\n", NFS_I(inode)); | 260 | "NFS: nfsi 0x%p turning cache off\n", NFS_I(inode)); |
261 | 261 | ||
262 | /* Need to invalidate any mapped pages that were read in before | 262 | /* Need to uncache any pages attached to this inode that |
263 | * turning off the cache. | 263 | * fscache knows about before turning off the cache. |
264 | */ | 264 | */ |
265 | if (inode->i_mapping && inode->i_mapping->nrpages) | 265 | fscache_uncache_all_inode_pages(NFS_I(inode)->fscache, inode); |
266 | invalidate_inode_pages2(inode->i_mapping); | ||
267 | |||
268 | nfs_fscache_zap_inode_cookie(inode); | 266 | nfs_fscache_zap_inode_cookie(inode); |
269 | } | 267 | } |
270 | } | 268 | } |