mtd/include/linux jffs2_fs_sb.h,1.58,1.59

Forrest Zhao forrest.zhao at intel.com
Fri Nov 18 02:27:49 EST 2005


Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv20956/include/linux

Modified Files:
	jffs2_fs_sb.h 
Log Message:
This patch eliminated the random nature of wear-leveling(WL) mechanism in JFFS2
by the following approachs:
1 WL is triggered when the erase count gap between each erase block execeed a predefined value(currently is 1024).
2 when WL is triggered, garge collection will pick up erase block with less erase count to do the garge collection.


Index: jffs2_fs_sb.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/jffs2_fs_sb.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- jffs2_fs_sb.h	18 Nov 2005 07:25:28 -0000	1.58
+++ jffs2_fs_sb.h	18 Nov 2005 07:27:46 -0000	1.59
@@ -17,6 +17,20 @@
 #define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
 #define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
 
+#define MAX_ERASE_COUNT_BIT_LEN 18
+#define MAX_ERASE_COUNT (1 << MAX_ERASE_COUNT_BIT_LEN) /* The maximum guaranteed erase cycles for NAND and NOR are ~ 100K at the moment */
+#define WL_DELTA_BIT_LEN 10
+#define WL_DELTA (1 << WL_DELTA_BIT_LEN) /* This is wear-leveling delta, which is defined as "maximum of all erase counts - minimum of all erase counts" */
+#define HASH_SIZE_BIT_LEN (MAX_ERASE_COUNT_BIT_LEN - WL_DELTA_BIT_LEN + 1) /* The range size of per-bucket is half of WL_DELTA */
+#define HASH_SIZE (1 << HASH_SIZE_BIT_LEN) 
+#define BUCKET_RANGE_BIT_LEN (MAX_ERASE_COUNT_BIT_LEN - HASH_SIZE_BIT_LEN)
+#define BUCKET_RANGE (1 << BUCKET_RANGE_BIT_LEN)
+
+struct jffs2_blocks_bucket {
+	uint32_t number;        /* The number of erase blocks in this bucket*/
+	struct list_head chain; /* The head of erase blocks in this bucket */
+};
+
 struct jffs2_inodirty;
 
 /* A struct for the overall file system control.  Pointers to
@@ -120,6 +134,12 @@
 	uint32_t total_erase_count; /* The summary erase count of all erase blocks */
 	uint32_t nr_blocks_with_ebh; /* The number of erase blocks, which has eraseblock header on it */
 	uint32_t max_erase_count; /* The maximum erase count of all erase blocks */
+
+	uint32_t used_blocks_current_index;
+	uint32_t free_blocks_current_index;
+	struct jffs2_blocks_bucket used_blocks[HASH_SIZE]; /* The hash table for both dirty and clean erase blocks */
+	struct jffs2_blocks_bucket free_blocks[HASH_SIZE]; /* The hash table for free erase blocks */
+
 	/* OS-private pointer for getting back to master superblock info */
 	void *os_priv;
 };





More information about the linux-mtd-cvs mailing list