[Yaffs] Checkpointing in YAFFS2

Top Page
Attachments:
Message as email
+ (text/plain)
+ yaffs2-checkpoint_option.patch (text/plain)
+ (application/pgp-signature)
Delete this message
Reply to this message
Author: Phil Sutter
Date:  
To: yaffs
Subject: [Yaffs] Checkpointing in YAFFS2
Hi!

FreeWRT is working on support for Mikrotik's RouterBoard532, which
has a large page NAND flash chip. To improve bootup time, Mikrotik
developers decided to partition the flash into two parts, the first one
just holding the kernel, and therefore only being 4MB of size.
Unfortunately, this makes problems with checkpointing, as the default of
10 Blocks already covers half of the free space in the filesystem.

To solve this in a clean way, I exported the reserved blocks count into
the kernel configuration. But see yourself, patch is appended.

I would be very happy if this patch makes it into upstream. I could also
imagine having another option to totally disable checkpoints. If there
is anything I can do to satisfy your expectations on the configuration
possibilities for checkpointing, just tell me and I will send you an
adjusted version of the patch.

Thanks in advance, Phil
diff -NaurB yaffs2/Kconfig yaffs2.hacked/Kconfig
--- yaffs2/Kconfig    2006-09-21 10:13:59.000000000 +0200
+++ yaffs2.hacked/Kconfig    2006-12-11 16:28:11.000000000 +0100
@@ -90,6 +90,24 @@


       If unsure, say N.


+config YAFFS_CHECKPOINT_RESERVED_BLOCKS
+    int "Reserved blocks for checkpointing"
+    depends on YAFFS_YAFFS2
+    default 10
+    help
+      Give the number of Blocks to reserve for checkpointing. These Blocks
+      are reserved per partition, so if you have very small partitions the
+      default (10) may be a mess for you. 
+      You can set this value to 0, but that does not mean checkpointing is
+      disabled at all. There only won't be any specially reserved blocks for
+      checkpointing, so if there is enough free space on the filesystem,
+      it will be used for checkpointing.
+
+      If unsure, leave at default (10), but don't wonder if there are always
+      2MB used on your large page device partition (10 x 2k pagesize). When
+      using small partitions or when being very small on space, you probably
+      want to set this to zero.
+
 config YAFFS_DISABLE_WIDE_TNODES
     bool "Turn off wide tnodes"
     depends on YAFFS_FS
diff -NaurB yaffs2/moduleconfig.h yaffs2.hacked/moduleconfig.h
--- yaffs2/moduleconfig.h    2005-09-21 17:16:59.000000000 +0200
+++ yaffs2.hacked/moduleconfig.h    2006-12-11 16:28:28.000000000 +0100
@@ -27,6 +27,10 @@
 /* Meaning: Cache short names, taking more RAM, but faster look-ups */
 #define CONFIG_YAFFS_SHORT_NAMES_IN_RAM


+/* Default: 10 */
+/* Meaning: set the count of blocks to reserve for checkpointing */
+#define YAFFS_CHECKPOINT_RESERVED_BLOCKS 10
+
#endif /* YAFFS_OUT_OF_TREE */

 #endif /* __YAFFS_CONFIG_H__ */
diff -NaurB yaffs2/yaffs_fs.c yaffs2.hacked/yaffs_fs.c
--- yaffs2/yaffs_fs.c    2006-10-24 20:09:15.000000000 +0200
+++ yaffs2.hacked/yaffs_fs.c    2006-12-11 16:27:49.000000000 +0100
@@ -1662,7 +1662,7 @@
 #endif
         nBlocks = mtd->size / mtd->erasesize;


-        dev->nCheckpointReservedBlocks = 10;
+        dev->nCheckpointReservedBlocks = CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS;
         dev->startBlock = 0;
         dev->endBlock = nBlocks - 1;
     } else {