aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSuresh Jayaraman <sjayaraman@suse.de>2010-07-05 08:43:11 -0400
committerSteve French <sfrench@us.ibm.com>2010-08-02 08:40:37 -0400
commit9dc06558c223bbc08290917ac44c25963bc09e43 (patch)
tree7ffd7618faaa251c286637815db5f91d2d410467 /fs
parent85f2d6b44d7e83bdeab87df910127c6f296866cf (diff)
cifs: store pages into local cache
Store pages from an CIFS inode into the data storage object associated with that inode. Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c7
-rw-r--r--fs/cifs/fscache.c11
-rw-r--r--fs/cifs/fscache.h11
3 files changed, 29 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index f677ede766d1..ff726c86b290 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1944,6 +1944,9 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
1944 SetPageUptodate(page); 1944 SetPageUptodate(page);
1945 unlock_page(page); 1945 unlock_page(page);
1946 data += PAGE_CACHE_SIZE; 1946 data += PAGE_CACHE_SIZE;
1947
1948 /* add page to FS-Cache */
1949 cifs_readpage_to_fscache(mapping->host, page);
1947 } 1950 }
1948 return; 1951 return;
1949} 1952}
@@ -2113,6 +2116,10 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
2113 2116
2114 flush_dcache_page(page); 2117 flush_dcache_page(page);
2115 SetPageUptodate(page); 2118 SetPageUptodate(page);
2119
2120 /* send this page to the cache */
2121 cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
2122
2116 rc = 0; 2123 rc = 0;
2117 2124
2118io_error: 2125io_error:
diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c
index 5dd935280049..3b1636704c85 100644
--- a/fs/cifs/fscache.c
+++ b/fs/cifs/fscache.c
@@ -140,6 +140,17 @@ int cifs_fscache_release_page(struct page *page, gfp_t gfp)
140 return 1; 140 return 1;
141} 141}
142 142
143void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)
144{
145 int ret;
146
147 cFYI(1, "CIFS: readpage_to_fscache(fsc: %p, p: %p, i: %p",
148 CIFS_I(inode)->fscache, page, inode);
149 ret = fscache_write_page(CIFS_I(inode)->fscache, page, GFP_KERNEL);
150 if (ret != 0)
151 fscache_uncache_page(CIFS_I(inode)->fscache, page);
152}
153
143void __cifs_fscache_invalidate_page(struct page *page, struct inode *inode) 154void __cifs_fscache_invalidate_page(struct page *page, struct inode *inode)
144{ 155{
145 struct cifsInodeInfo *cifsi = CIFS_I(inode); 156 struct cifsInodeInfo *cifsi = CIFS_I(inode);
diff --git a/fs/cifs/fscache.h b/fs/cifs/fscache.h
index 5e18a21eee9d..1a00d70bca97 100644
--- a/fs/cifs/fscache.h
+++ b/fs/cifs/fscache.h
@@ -51,6 +51,8 @@ extern void cifs_fscache_reset_inode_cookie(struct inode *);
51extern void __cifs_fscache_invalidate_page(struct page *, struct inode *); 51extern void __cifs_fscache_invalidate_page(struct page *, struct inode *);
52extern int cifs_fscache_release_page(struct page *page, gfp_t gfp); 52extern int cifs_fscache_release_page(struct page *page, gfp_t gfp);
53 53
54extern void __cifs_readpage_to_fscache(struct inode *, struct page *);
55
54static inline void cifs_fscache_invalidate_page(struct page *page, 56static inline void cifs_fscache_invalidate_page(struct page *page,
55 struct inode *inode) 57 struct inode *inode)
56{ 58{
@@ -58,6 +60,13 @@ static inline void cifs_fscache_invalidate_page(struct page *page,
58 __cifs_fscache_invalidate_page(page, inode); 60 __cifs_fscache_invalidate_page(page, inode);
59} 61}
60 62
63static inline void cifs_readpage_to_fscache(struct inode *inode,
64 struct page *page)
65{
66 if (PageFsCache(page))
67 __cifs_readpage_to_fscache(inode, page);
68}
69
61#else /* CONFIG_CIFS_FSCACHE */ 70#else /* CONFIG_CIFS_FSCACHE */
62static inline int cifs_fscache_register(void) { return 0; } 71static inline int cifs_fscache_register(void) { return 0; }
63static inline void cifs_fscache_unregister(void) {} 72static inline void cifs_fscache_unregister(void) {}
@@ -81,6 +90,8 @@ static inline void cifs_fscache_release_page(struct page *page, gfp_t gfp)
81 90
82static inline int cifs_fscache_invalidate_page(struct page *page, 91static inline int cifs_fscache_invalidate_page(struct page *page,
83 struct inode *) {} 92 struct inode *) {}
93static inline void cifs_readpage_to_fscache(struct inode *inode,
94 struct page *page) {}
84 95
85#endif /* CONFIG_CIFS_FSCACHE */ 96#endif /* CONFIG_CIFS_FSCACHE */
86 97