diff options
author | Suresh Jayaraman <sjayaraman@suse.de> | 2010-07-05 18:13:11 +0530 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-08-02 12:40:37 +0000 |
commit | 9dc06558c223bbc08290917ac44c25963bc09e43 (patch) | |
tree | 7ffd7618faaa251c286637815db5f91d2d410467 /fs/cifs | |
parent | 85f2d6b44d7e83bdeab87df910127c6f296866cf (diff) | |
download | blackbird-op-linux-9dc06558c223bbc08290917ac44c25963bc09e43.tar.gz blackbird-op-linux-9dc06558c223bbc08290917ac44c25963bc09e43.zip |
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/cifs')
-rw-r--r-- | fs/cifs/file.c | 7 | ||||
-rw-r--r-- | fs/cifs/fscache.c | 11 | ||||
-rw-r--r-- | fs/cifs/fscache.h | 11 |
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, SetPageUptodate(page); unlock_page(page); data += PAGE_CACHE_SIZE; + + /* add page to FS-Cache */ + cifs_readpage_to_fscache(mapping->host, page); } return; } @@ -2113,6 +2116,10 @@ static int cifs_readpage_worker(struct file *file, struct page *page, flush_dcache_page(page); SetPageUptodate(page); + + /* send this page to the cache */ + cifs_readpage_to_fscache(file->f_path.dentry->d_inode, page); + rc = 0; io_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) 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) { 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 *); extern void __cifs_fscache_invalidate_page(struct page *, struct inode *); 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, struct inode *inode) { @@ -58,6 +60,13 @@ static inline void cifs_fscache_invalidate_page(struct page *page, __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 */ static inline int cifs_fscache_register(void) { return 0; } static inline void cifs_fscache_unregister(void) {} @@ -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, struct inode *) {} +static inline void cifs_readpage_to_fscache(struct inode *inode, + struct page *page) {} #endif /* CONFIG_CIFS_FSCACHE */ |