Add conditional compilation for background processing
authorcharles <charles>
Wed, 10 Mar 2010 01:22:19 +0000 (01:22 +0000)
committercharles <charles>
Wed, 10 Mar 2010 01:22:19 +0000 (01:22 +0000)
Kconfig
moduleconfig.h
yaffs_fs.c

diff --git a/Kconfig b/Kconfig
index 6d3790e1f8dd7e732021bf64178aa22961a10cfa..8c218e3767ffaa1c080ce4e40116cb9a359f7214 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -175,6 +175,8 @@ config YAFFS_EMPTY_LOST_AND_FOUND
          If this is enabled then the contents of lost and found is
          automatically dumped at mount.
 
          If this is enabled then the contents of lost and found is
          automatically dumped at mount.
 
+         If unsure, say N.
+
 config YAFFS_DISABLE_BLOCK_REFRESHING
        bool "Disable yaffs2 block refreshing"
        depends on YAFFS_FS
 config YAFFS_DISABLE_BLOCK_REFRESHING
        bool "Disable yaffs2 block refreshing"
        depends on YAFFS_FS
@@ -184,3 +186,15 @@ config YAFFS_DISABLE_BLOCK_REFRESHING
         Block refreshing infrequently refreshes the oldest block in
         a yaffs2 file system. This mechanism helps to refresh flash to
         mitigate against data loss. This is particularly useful for MLC.
         Block refreshing infrequently refreshes the oldest block in
         a yaffs2 file system. This mechanism helps to refresh flash to
         mitigate against data loss. This is particularly useful for MLC.
+
+         If unsure, say N.
+
+config YAFFS_DISABLE_BACKGROUND
+       bool "Disable yaffs2 background processing"
+       depends on YAFFS_FS
+       default n
+       help
+        If this is set, then background processing is disabled.
+        Background processing makes many foreground activities faster.
+
+         If unsure, say N.
index f58b8e25b4558d367e5cf4d72c5869db85443ca2..398e8518a031ee2f730390a15b2191b0a6050453 100644 (file)
 /* Block Refreshing periodically rewrites the oldest block. */
 /* #define CONFIG_DISABLE_BLOCK_REFRESHING */
 
 /* Block Refreshing periodically rewrites the oldest block. */
 /* #define CONFIG_DISABLE_BLOCK_REFRESHING */
 
+/* Default: Unselected */
+/* Meaning: Select to disable background processing */
+/* #define CONFIG_DISABLE_BACKGROUND */
+
 
 /*
 Older-style on-NAND data format has a "pageStatus" byte to record
 
 /*
 Older-style on-NAND data format has a "pageStatus" byte to record
index 99de632bbbc3cccccf8007eb9b6b524e77bd52db..63d31645cfa89e55cb1c3a3fcd622d251356b461 100644 (file)
  */
 
 const char *yaffs_fs_c_version =
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.97 2010-03-09 04:12:00 charles Exp $";
+    "$Id: yaffs_fs.c,v 1.98 2010-03-10 01:22:19 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10))
+#define YAFFS_COMPILE_BACKGROUND
+#endif
+
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 #include <linux/config.h>
 #endif
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 #include <linux/config.h>
 #endif
@@ -52,7 +57,11 @@ extern const char *yaffs_guts_c_version;
 #include <linux/string.h>
 #include <linux/ctype.h>
 
 #include <linux/string.h>
 #include <linux/ctype.h>
 
+#ifdef YAFFS_COMPILE_BACKGROUND
 #include <linux/kthread.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
+#endif
+
 
 #include "asm/div64.h"
 
 
 #include "asm/div64.h"
 
@@ -1840,6 +1849,7 @@ static int yaffs_do_sync_fs(struct super_block *sb, int do_checkpoint)
  * The thread should not do any writing while the fs is in read only.
  */
 
  * The thread should not do any writing while the fs is in read only.
  */
 
+#ifdef YAFFS_COMPILE_BACKGROUND
 static int yaffs_BackgroundThread(void *data)
 {
        yaffs_Device *dev = (yaffs_Device *)data;
 static int yaffs_BackgroundThread(void *data)
 {
        yaffs_Device *dev = (yaffs_Device *)data;
@@ -1892,6 +1902,22 @@ static void yaffs_BackgroundStop(yaffs_Device *dev)
                ctxt->bgThread = NULL;
        }
 }
                ctxt->bgThread = NULL;
        }
 }
+#else
+static int yaffs_BackgroundThread(void *data)
+{
+       return 0;
+}
+
+static int yaffs_BackgroundStart(yaffs_Device *dev)
+{
+       return 0;
+}
+
+static void yaffs_BackgroundStop(yaffs_Device *dev)
+{
+}
+#endif
+
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static void yaffs_write_super(struct super_block *sb)
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static void yaffs_write_super(struct super_block *sb)
@@ -2370,7 +2396,10 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        param->noTagsECC = 1;
 #endif
 
        param->noTagsECC = 1;
 #endif
 
+#ifdef CONFIG_YAFFS_DISABLE_BACKGROUND
+#else
        param->deferDirectoryUpdate = 1;
        param->deferDirectoryUpdate = 1;
+#endif
 
        if(options.tags_ecc_overridden)
                param->noTagsECC = !options.tags_ecc_on;
 
        if(options.tags_ecc_overridden)
                param->noTagsECC = !options.tags_ecc_on;