Saturday, April 18, 2009

UFFS2 features

UFFS2 is under design. Compares to UFFS1, UFFS2 will have new features/improvements:

1) Reduce memory footprint by using smaller tree node data structure, save 20%~50% memory comparing with UFFS1.

typedef struct uffs_HeadNodeSt {
u16 block;
u16 info; //point to info node
u16 next;
u16 prev;
} uffs_LoadNode;

typedef struct uffs_InfoNodeSt {
u16 father;
u16 serial;
u16 sum;
u8 attr:2; //00 dir, 01 normal file, 10 symbol link, 11 reserved
u8 status:2; //data status:
u8 pageid;
} uffs_InfoNode;

typedef struct uffs_FreeNodeSt {
u16 block;
u16 next;
u16 prev;
} uffs_FreeNode;

typedef struct uffs_DataNodeSt {
u16 block;
u16 father;
u16 serial;
u8 status; //0 - no free page, 1 - has free page
u8 page; //first free page
} uffs_DataNode;

typedef struct uffs_TreeNodeSt {
union {
struct uffs_HeadNodeSt head;
struct uffs_DataNodeSt data;
struct uffs_FreeNodeSt free;
} u;
} TreeNode;

Tree nodes memory cost:
total_blocks * 8 + max_files_and_dirs * 8

for 1Gb NAND flash:
page sze: 512,
pages_per_block: 32,
total_blocks: 8192,
max_files_and_dirs: 1000

tree nodes memory cost: 8192 * 8 + 1000 * 8 = 72KB
(compares to UFFS1: 8192 * 16 = 131KB, save 45%)

2) Allow multiple files/dirs on one block. This will significantly improve flash space efficiency in many circumstances.

Directories and symbol link will only cost one page, small file cost 2~pages_per_block pages, configurable. Large files will use full block.

3) Move ECC to page spare.
ECC data are compatible with YAFFS2.

4) Support Linux VFS interface. This will allow using UFFS2 as file system in embedded linux.
UFFS2 can be used as root file system.

No comments:

Post a Comment