Commit 9dc06558 authored by Suresh Jayaraman's avatar Suresh Jayaraman Committed by Steve French

cifs: store pages into local cache

Store pages from an CIFS inode into the data storage object associated with
that inode.
Signed-off-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 85f2d6b4
...@@ -1944,6 +1944,9 @@ static void cifs_copy_cache_pages(struct address_space *mapping, ...@@ -1944,6 +1944,9 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); unlock_page(page);
data += PAGE_CACHE_SIZE; data += PAGE_CACHE_SIZE;
/* add page to FS-Cache */
cifs_readpage_to_fscache(mapping->host, page);
} }
return; return;
} }
...@@ -2113,6 +2116,10 @@ static int cifs_readpage_worker(struct file *file, struct page *page, ...@@ -2113,6 +2116,10 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
flush_dcache_page(page); flush_dcache_page(page);
SetPageUptodate(page); SetPageUptodate(page);
/* send this page to the cache */
cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page);
rc = 0; rc = 0;
io_error: io_error:
......
...@@ -140,6 +140,17 @@ int cifs_fscache_release_page(struct page *page, gfp_t gfp) ...@@ -140,6 +140,17 @@ int cifs_fscache_release_page(struct page *page, gfp_t gfp)
return 1; return 1;
} }
void __cifs_readpage_to_fscache(struct inode *inode, struct page *page)
{
int ret;
cFYI(1, "CIFS: readpage_to_fscache(fsc: %p, p: %p, i: %p",
CIFS_I(inode)->fscache, page, inode);
ret = fscache_write_page(CIFS_I(inode)->fscache, page, GFP_KERNEL);
if (ret != 0)
fscache_uncache_page(CIFS_I(inode)->fscache, page);
}
void __cifs_fscache_invalidate_page(struct page *page, struct inode *inode) void __cifs_fscache_invalidate_page(struct page *page, struct inode *inode)
{ {
struct cifsInodeInfo *cifsi = CIFS_I(inode); struct cifsInodeInfo *cifsi = CIFS_I(inode);
......
...@@ -51,6 +51,8 @@ extern void cifs_fscache_reset_inode_cookie(struct inode *); ...@@ -51,6 +51,8 @@ extern void cifs_fscache_reset_inode_cookie(struct inode *);
extern void __cifs_fscache_invalidate_page(struct page *, struct inode *); extern void __cifs_fscache_invalidate_page(struct page *, struct inode *);
extern int cifs_fscache_release_page(struct page *page, gfp_t gfp); extern int cifs_fscache_release_page(struct page *page, gfp_t gfp);
extern void __cifs_readpage_to_fscache(struct inode *, struct page *);
static inline void cifs_fscache_invalidate_page(struct page *page, static inline void cifs_fscache_invalidate_page(struct page *page,
struct inode *inode) struct inode *inode)
{ {
...@@ -58,6 +60,13 @@ static inline void cifs_fscache_invalidate_page(struct page *page, ...@@ -58,6 +60,13 @@ static inline void cifs_fscache_invalidate_page(struct page *page,
__cifs_fscache_invalidate_page(page, inode); __cifs_fscache_invalidate_page(page, inode);
} }
static inline void cifs_readpage_to_fscache(struct inode *inode,
struct page *page)
{
if (PageFsCache(page))
__cifs_readpage_to_fscache(inode, page);
}
#else /* CONFIG_CIFS_FSCACHE */ #else /* CONFIG_CIFS_FSCACHE */
static inline int cifs_fscache_register(void) { return 0; } static inline int cifs_fscache_register(void) { return 0; }
static inline void cifs_fscache_unregister(void) {} static inline void cifs_fscache_unregister(void) {}
...@@ -81,6 +90,8 @@ static inline void cifs_fscache_release_page(struct page *page, gfp_t gfp) ...@@ -81,6 +90,8 @@ static inline void cifs_fscache_release_page(struct page *page, gfp_t gfp)
static inline int cifs_fscache_invalidate_page(struct page *page, static inline int cifs_fscache_invalidate_page(struct page *page,
struct inode *) {} struct inode *) {}
static inline void cifs_readpage_to_fscache(struct inode *inode,
struct page *page) {}
#endif /* CONFIG_CIFS_FSCACHE */ #endif /* CONFIG_CIFS_FSCACHE */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment