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 <lbassel@codeaurora.org>
diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index f56e12c..70d88ef 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -53,6 +53,7 @@
#include <linux/kthread.h>
#include <linux/delay.h>
#include <linux/freezer.h>
+#include <linux/cleancache.h>
#include <asm/div64.h>
@@ -1139,6 +1140,10 @@
(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 @@
if (ret >= 0)
ret = 0;
+cleancache_got:
if (ret) {
ClearPageUptodate(pg);
SetPageError(pg);
} else {
SetPageUptodate(pg);
+ SetPageMappedToDisk(pg);
ClearPageError(pg);
}
@@ -2364,6 +2371,7 @@
dev->is_checkpointed);
yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_super: done");
+ cleancache_init_fs(sb);
return sb;
}