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>
This commit is contained in:
@@ -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 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user