From eb93161d9746b2aa0ac534d1da88a33480d21905 Mon Sep 17 00:00:00 2001 From: Larry Bassel Date: Thu, 2 Feb 2012 10:24:58 -0800 Subject: [PATCH] yaffs: add interface to cleancache Cleancache requires a small amount of code to be added to a filesystem's implementation so that clean page cache pages from a filesystem of that type may be recognized and stored in/retrieved from cleancache. Change-Id: I94c3fc8817ab66e2c54f7b2c6c474dd2321d9806 Signed-off-by: Larry Bassel --- fs/yaffs2/yaffs_vfs.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c index f56e12ca344..70d88ef43fd 100644 --- a/fs/yaffs2/yaffs_vfs.c +++ b/fs/yaffs2/yaffs_vfs.c @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -1139,6 +1140,10 @@ static int yaffs_readpage_nolock(struct file *f, struct page *pg) (unsigned)(pg->index << PAGE_CACHE_SHIFT), (unsigned)PAGE_CACHE_SIZE); + ret = cleancache_get_page(pg); + if (!ret) + goto cleancache_got; + obj = yaffs_dentry_to_obj(f->f_dentry); dev = obj->my_dev; @@ -1158,11 +1163,13 @@ static int yaffs_readpage_nolock(struct file *f, struct page *pg) if (ret >= 0) ret = 0; +cleancache_got: if (ret) { ClearPageUptodate(pg); SetPageError(pg); } else { SetPageUptodate(pg); + SetPageMappedToDisk(pg); ClearPageError(pg); } @@ -2364,6 +2371,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, dev->is_checkpointed); yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_super: done"); + cleancache_init_fs(sb); return sb; }