UFFS usage guidline

UFFS is not a generic file system for every day use like FAT32 or Ext3, or generic flash file system like JFFS2 or YAFFS2 for NAND.

The fact that UFFS consumes one block for each directory and one or more blocks for each file makes it not suitable for large numbers of directories or files.

Not using separate thread for GC makes UFFS very predictable (good for read-time system), but it may also beat performance badly if you randomly moving file pointer across block boundary and modifying the file content.

What UFFS best suit for:

* Not many directories.
Too many directories will cause in low space efficiency but no performance penalty. In fact, many embedded system don't use directory.

* Not many small files.
Full of small files will also cause low space efficiency.

* Large file size.
UFFS performs well when reading/seeking/writing/appending in large size file.

* Appending a file.
UFFS has the best performence if you are appending a file, or doing the modifies within the last block boundary.

* Random reading.
Seeking file pointer is very fast in UFFS.

What should you minimize or avoid:

* Creating and deleting files frequently.
Create a file then delete it results in 2 block erase, which is not a good practice for NAND flash if doing that frequently.

* Moving file pointer across block boundary and modifying the file content.
UFFS won't cache the data across block boundary when writing to a file, so it need to do the block recover immeditly (which will erase one block). This may beat the performance badly.

For example, if you have a size 1MB file, seek the file pointer to 0, write 1 byte, then seek the pointer to 1MB(the end of file), write 1 byte, then close file. The whole process will cause 2 block recoveries, as result, 2 blocks will be erased.

* Opening multiple files for write.
The fact that UFFS can't cache the data across block baundary and files are in different blocks, opening multiple files and writing to them will make UFFS frequetly flush out the cache and cause bock recovery.

* Truncating/Deleting large size file.
When deleting a file, UFFS will erase all blocks belong to the file, which may take quite a long time for large file on slow NAND flash. Truncating a file will also cause erasing the discarded blocks.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值