Add garbage collection control
authorcharles <charles>
Mon, 15 Mar 2010 23:10:33 +0000 (23:10 +0000)
committercharles <charles>
Mon, 15 Mar 2010 23:10:33 +0000 (23:10 +0000)
yaffs_fs.c
yaffs_guts.c
yaffs_guts.h

index aaf3f0b3ac806572100b02699b20c7f704186d41..69b739b2b6a60c5c780acde58ae495bc5e5d97f7 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 const char *yaffs_fs_c_version =
  */
 
 const char *yaffs_fs_c_version =
-    "$Id: yaffs_fs.c,v 1.101 2010-03-15 22:27:15 charles Exp $";
+    "$Id: yaffs_fs.c,v 1.102 2010-03-15 23:10:33 charles Exp $";
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
 extern const char *yaffs_guts_c_version;
 
 #include <linux/version.h>
@@ -138,16 +138,19 @@ static uint32_t YCALCBLOCKS(uint64_t partition_size, uint32_t block_size)
 unsigned int yaffs_traceMask = YAFFS_TRACE_BAD_BLOCKS | YAFFS_TRACE_ALWAYS;
 unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS;
 unsigned int yaffs_auto_checkpoint = 1;
 unsigned int yaffs_traceMask = YAFFS_TRACE_BAD_BLOCKS | YAFFS_TRACE_ALWAYS;
 unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS;
 unsigned int yaffs_auto_checkpoint = 1;
+unsigned int yaffs_gc_control = 1;
 
 /* Module Parameters */
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
 module_param(yaffs_traceMask, uint, 0644);
 module_param(yaffs_wr_attempts, uint, 0644);
 module_param(yaffs_auto_checkpoint, uint, 0644);
 
 /* Module Parameters */
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
 module_param(yaffs_traceMask, uint, 0644);
 module_param(yaffs_wr_attempts, uint, 0644);
 module_param(yaffs_auto_checkpoint, uint, 0644);
+module_param(yaffs_gc_control, uint, 0644);
 #else
 MODULE_PARM(yaffs_traceMask, "i");
 MODULE_PARM(yaffs_wr_attempts, "i");
 MODULE_PARM(yaffs_auto_checkpoint, "i");
 #else
 MODULE_PARM(yaffs_traceMask, "i");
 MODULE_PARM(yaffs_wr_attempts, "i");
 MODULE_PARM(yaffs_auto_checkpoint, "i");
+MODULE_PARM(yaffs_gc_control, "i");
 #endif
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))
 #endif
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25))
@@ -392,6 +395,11 @@ static const struct super_operations yaffs_super_ops = {
        .sync_fs = yaffs_sync_fs,
        .write_super = yaffs_write_super,
 };
        .sync_fs = yaffs_sync_fs,
        .write_super = yaffs_write_super,
 };
+
+static unsigned yaffs_gc_control_callback(yaffs_Device *dev)
+{
+       return yaffs_gc_control;
+}
                                                                                                                        
 static void yaffs_GrossLock(yaffs_Device *dev)
 {
                                                                                                                        
 static void yaffs_GrossLock(yaffs_Device *dev)
 {
@@ -2462,6 +2470,7 @@ static struct super_block *yaffs_internal_read_super(int yaffsVersion,
        yaffs_DeviceToContext(dev)->putSuperFunc = yaffs_MTDPutSuper;
 
        param->markSuperBlockDirty = yaffs_MarkSuperBlockDirty;
        yaffs_DeviceToContext(dev)->putSuperFunc = yaffs_MTDPutSuper;
 
        param->markSuperBlockDirty = yaffs_MarkSuperBlockDirty;
+       param->gcControl = yaffs_gc_control_callback;
 
        yaffs_DeviceToContext(dev)->superBlock= sb;
        
 
        yaffs_DeviceToContext(dev)->superBlock= sb;
        
@@ -2749,7 +2758,6 @@ static int yaffs_debug_proc_read(char *page,
 {
        struct ylist_head *item;
        char *buf = page;
 {
        struct ylist_head *item;
        char *buf = page;
-       int step = offset;
        int n = 0;
 
        down(&yaffs_context_lock);
        int n = 0;
 
        down(&yaffs_context_lock);
index df66ec89860585636ffbfdaf0c80e7b90186493c..d8ca648d2f47b63f551519fb0ea9ac4efbb9f3bd 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 const char *yaffs_guts_c_version =
  */
 
 const char *yaffs_guts_c_version =
-    "$Id: yaffs_guts.c,v 1.119 2010-03-12 02:48:34 charles Exp $";
+    "$Id: yaffs_guts.c,v 1.120 2010-03-15 23:10:34 charles Exp $";
 
 #include "yportenv.h"
 #include "yaffs_trace.h"
 
 #include "yportenv.h"
 #include "yaffs_trace.h"
@@ -3456,6 +3456,10 @@ static int yaffs_CheckGarbageCollection(yaffs_Device *dev)
 
        int checkpointBlockAdjust;
 
 
        int checkpointBlockAdjust;
 
+       if(dev->param.gcControl &&
+               (dev->param.gcControl(dev) & 1) == 0)
+               return YAFFS_OK;
+
        if (dev->isDoingGC) {
                /* Bail out so we don't get recursive gc */
                return YAFFS_OK;
        if (dev->isDoingGC) {
                /* Bail out so we don't get recursive gc */
                return YAFFS_OK;
index 2791d685878bed9c7033e3d4fe276fd1e93be24d..dabcfe6e5d77b1247f746b945e07005d808dad40 100644 (file)
@@ -598,6 +598,9 @@ struct yaffs_DeviceParamStruct {
 
        /* Callback to mark the superblock dirty */
        void (*markSuperBlockDirty)(struct yaffs_DeviceStruct *dev);
 
        /* Callback to mark the superblock dirty */
        void (*markSuperBlockDirty)(struct yaffs_DeviceStruct *dev);
+       
+       /*  Callback to control garbage collection. */
+       unsigned (*gcControl)(struct yaffs_DeviceStruct *dev);
 
         /* Debug control flags. Don't use unless you know what you're doing */
        int useHeaderFileSize;  /* Flag to determine if we should use file sizes from the header */
 
         /* Debug control flags. Don't use unless you know what you're doing */
        int useHeaderFileSize;  /* Flag to determine if we should use file sizes from the header */