-
Notifications
You must be signed in to change notification settings - Fork 5
Q: when i want to write a file that contents servel pages,and when i've not finished write all pages ,for example,my file has 4 pages and i write 3 of them,but power loss when i want to write the last one ,then i reboot the uffs,how it detects wether the formel write operation is finished or not?
A: If the power cut before start writing the 4th page (assuming page id = 10), UFFS does not know it (and don't care about it), UFFS will pick the old content (if you are modifying file content), or the file only content 3 pages data (if you are creating/appending) in the next mount.
If the power cut during writing to the 4th page, then we have: mini header.status == 0 && tag.valid == 1(invalid), UFFS simply discard this page (dirty = 0, valid = 1). UFFS will skip this page later.
There is a small chance that tag.valid == 0(valid) but the rest of tag haven't been written to flash completely, in this case tag ECC will failed and it might be treated as a 'bad' block, which will trigger block recover in uffs_BadBlockRecover(), this is not a proper way to deal with it and I'll address this issue in the next change.
L: https://groups.google.com/forum/?hl=en#!topic/uffs/KFPPnDHpjy0
Q: uffs_FlashOpsSt has many member functions do same work that some mark " UFFS do the layout" while some mark "driver do the layout".what's the different?
A: ReadPage()/ReadPageWithLayout() : implement one of them, depends on what type of your hardware. For some hardware which automatically write spare area after writing page data, you should implement ReadPageWithLayout(), otherwise implement ReadPage() or ReadPageWithLayout().
Ditto for WritePage()/WritePageWithLayout() pair.
L: https://groups.google.com/forum/?hl=en#!topic/uffs/JhkekFeBYjI