changeset 400:fb6ffedcfa89

Add one-shot feature for yaffs auto checkpointing. This feature is enabling by ORing in 0x04 to the yaffs_auto_checkpoint module parameter. This will do a one-shot checkpoint on the next sync and the bit will then be reset. This is a nice way to force a checkpoint on the next sync. eg. echo 6 > /sys/modules/yaffs/parameters/yaffs_auto_checkpoint sync yaffs_auto_checkpoint will now be 2 Signed-off-by: Charles Manning <cdhmanning@gmail.com>
author Charles Manning <cdhmanning@gmail.com>
date Mon, 12 Apr 2010 16:55:22 +1200
parents ab2e0a72840f
children 7d524c984100
files yaffs_fs.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_fs.c
+++ b/yaffs_fs.c
@@ -1937,17 +1937,23 @@ static int yaffs_do_sync_fs(struct super
 {
 
 	yaffs_Device *dev = yaffs_SuperToDevice(sb);
+	unsigned int oneshot_checkpoint = (yaffs_auto_checkpoint & 4);
+
 	T(YAFFS_TRACE_OS | YAFFS_TRACE_SYNC, 
-		("yaffs_do_sync_fs: %s %s\n", 
+		("yaffs_do_sync_fs: %s %s%s\n",
 		sb->s_dirt ? "dirty" : "clean",
-		do_checkpoint ? "with checkpoint" : "no checkpoint"));
-
-	if (sb->s_dirt) {
+		do_checkpoint ? "with checkpoint" : "no checkpoint",
+		oneshot_checkpoint ? " one-shot" : "" ));
+
+	if (sb->s_dirt || oneshot_checkpoint) {
 		yaffs_GrossLock(dev);
 		yaffs_FlushSuperBlock(sb,do_checkpoint);
 		yaffs_GrossUnlock(dev);
 
 		sb->s_dirt = 0;
+
+		if(oneshot_checkpoint)
+			yaffs_auto_checkpoint &= ~4;
 	}
 	return 0;
 }