--- /home/andre/snapper/yaffs2/Kconfig 2005-09-22 03:16:59.000000000 +1200 +++ Kconfig 2005-11-15 10:37:36.000000000 +1300 @@ -80,3 +80,14 @@ but makes look-ups faster. If unsure, say Y. + +config YAFFS_TNODE_LARGE_NAND + bool "Optimise for large NAND devices" + depends on YAFFS_FS + default n + help + If this config is set, then the memory structure will be optimised + for large NAND devices (> 64MB). This uses more memory, but speeds + up access significantly on large devices. + + If unsure, say N. --- /home/andre/snapper/yaffs2/yaffs_guts.c 2005-11-09 15:13:58.000000000 +1300 +++ yaffs_guts.c 2005-11-15 10:36:35.000000000 +1300 @@ -5409,14 +5409,17 @@ if (extraBits > 0) bits++; - /* Level0 Tnodes are 16 bits, so if the bitwidth of the - * chunk range we're using is greater than 16 we need + /* Level0 Tnodes are YAFFS_TNODES_LEVEL0_WIDTH bits, so if the bitwidth of the + * chunk range we're using is greater than YAFFS_TNODES_LEVEL0_WIDTH we need * to figure out chunk shift and chunkGroupSize */ - if (bits <= 16) { + if (bits <= YAFFS_TNODES_LEVEL0_WIDTH) { dev->chunkGroupBits = 0; } else { - dev->chunkGroupBits = bits - 16; + dev->chunkGroupBits = bits - YAFFS_TNODES_LEVEL0_WIDTH; + T(YAFFS_TRACE_ALWAYS, + (TSTR("yaffs: performance warning, chunkGroupBits: %d\n" TENDSTR), + dev->chunkGroupBits)); } dev->chunkGroupSize = 1 << dev->chunkGroupBits; @@ -5657,7 +5660,7 @@ /* yaffs_CheckStruct(yaffs_TagsUnion,8,"yaffs_TagsUnion") */ /* yaffs_CheckStruct(yaffs_Spare,16,"yaffs_Spare") */ #ifndef CONFIG_YAFFS_TNODE_LIST_DEBUG - yaffs_CheckStruct(yaffs_Tnode, 2 * YAFFS_NTNODES_LEVEL0, "yaffs_Tnode") + yaffs_CheckStruct(yaffs_Tnode, (YAFFS_TNODES_LEVEL0_WIDTH / 8) * YAFFS_NTNODES_LEVEL0, "yaffs_Tnode") #endif yaffs_CheckStruct(yaffs_ObjectHeader, 512, "yaffs_ObjectHeader") --- /home/andre/snapper/yaffs2/yaffs_guts.h 2005-10-09 20:55:00.000000000 +1300 +++ yaffs_guts.h 2005-11-15 10:12:58.000000000 +1300 @@ -34,14 +34,28 @@ */ #define YAFFS_MAGIC 0x5941FF53 +#ifdef CONFIG_YAFFS_TNODE_LARGE_NAND +#define YAFFS_NTNODES_LEVEL0 8 +#define YAFFS_TNODES_LEVEL0_BITS 3 +#define YAFFS_TNODES_LEVEL0_MASK 0x7 +#define YAFFS_TNODES_LEVEL0_TYPE __u32 + +#define YAFFS_NTNODES_INTERNAL 8 +#define YAFFS_TNODES_INTERNAL_BITS 3 +#define YAFFS_TNODES_INTERNAL_MASK 0x7 +#define YAFFS_TNODES_MAX_LEVEL 6 +#else #define YAFFS_NTNODES_LEVEL0 16 #define YAFFS_TNODES_LEVEL0_BITS 4 #define YAFFS_TNODES_LEVEL0_MASK 0xf +#define YAFFS_TNODES_LEVEL0_TYPE __u16 #define YAFFS_NTNODES_INTERNAL (YAFFS_NTNODES_LEVEL0 / 2) #define YAFFS_TNODES_INTERNAL_BITS (YAFFS_TNODES_LEVEL0_BITS - 1) #define YAFFS_TNODES_INTERNAL_MASK 0x7 #define YAFFS_TNODES_MAX_LEVEL 6 +#endif +#define YAFFS_TNODES_LEVEL0_WIDTH (sizeof(YAFFS_TNODES_LEVEL0_TYPE) * 8) #ifndef CONFIG_YAFFS_NO_YAFFS1 #define YAFFS_BYTES_PER_SPARE 16 @@ -325,7 +339,7 @@ #else union yaffs_Tnode_union *internal[YAFFS_NTNODES_INTERNAL]; #endif - __u16 level0[YAFFS_NTNODES_LEVEL0]; + YAFFS_TNODES_LEVEL0_TYPE level0[YAFFS_NTNODES_LEVEL0]; };