cifs: store pages into local cache
Subsystems (3)
RFC PATCH 8/10 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 <[email protected]>
--- fs/cifs/file.c | 6 ++++++ fs/cifs/fscache.c | 13 +++++++++++++ fs/cifs/fscache.h | 11 +++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-)
fs/cifs/file.c +6 -0
@@ -2060,6 +2060,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,we will hit it on next read */ /* break; */ +/* send this page to FS-Cache */ +cifs_readpage_to_fscache (mapping->host, page); } }else { cFYI(1, "No bytes read (%d) at offset %lld . "
@@ -2117,6 +2119,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:
fs/cifs/fscache.c +13 -0
@@ -145,6 +145,19 @@ 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\n" , +CIFS_I (inode)->fscache, page, inode); + ret =fscache_write_page (CIFS_I (inode)->fscache, page,GFP_KERNEL ); +cFYI (1 ,"CIFS: fscache_write_page returned %d\n" , ret); + +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);
fs/cifs/fscache.h +11 -0
@@ -50,6 +50,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) {
@@ -57,6 +59,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 ) {}
@@ -80,6 +89,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 */
Signature · 1 line
1.6.4.2
A message that is not in the archive (sent off-list or not yet received): 1277220240-3674-1-git-send-email-sjayaraman-l3A5Bk7waGM@public.gmane.org
David Howells
Acked-byQuoted 4 lines · Suresh Jayaraman
Store pages from an CIFS inode into the data storage object associated with that inode.
Signed-off-by Suresh Jayaraman <[email protected]>
Acked-by David Howells <[email protected]>