Unclean block recover

71 views
Skip to first unread message

Savin Zlobec

unread,
Jan 1, 2013, 8:01:05 PM1/1/13
to uf...@googlegroups.com
Hi,

the attached patch:

- adds unclean block (no spare or not sealed) recover
- adds dev->pending.block_in_recovery safeguard to prevent
re-adding bad block currently in recover procedure
- changes page 0 TAG_IS_VALID check to TAG_IS_GOOD in
_BuildValidTreeNode, so blocks with unsealed page 0 will
be immediately erased

I've found another issue with uffs_FlashMarkDirtyPage and NAND flash
which does automatic HW ECC. If we have an half written page NAND will
return ECC failure, but we can see that the tag is not sealed and return
UFFS_FLASH_NOT_SEALED.
If such page is processed by uffs_FlashMarkDirtyPage, than the tag will
be sealed and we are left only with ECC failure from NAND which could
result in UFFS marking the block as bad. Two possible workarounds in the
driver are to ignore uffs_FlashMarkDirtyPage or inspect the tag at the
driver level and avoid returning ECC failure for invalid tags, but the
latter could actually be an real ECC failure.

As far as I could test it looks like working with UFFS_FLASH_NOT_SEALED
and ignoring uffs_FlashMarkDirtyPage doesn't produce any unwanted
results, but it's a workaround not a correct solution.

Regards.
unclean_recover.patch

Ricky Zheng

unread,
Jan 3, 2013, 5:20:00 PM1/3/13
to uf...@googlegroups.com
Hi Savin,

Thanks for the patch, I'll apply it later.

In regarding to uffs_FlashMarkDirtyPage() issue, I think a better solution is to process the unclean block immediately after step one of building tree, so that we don't need uffs_FlashMarkDirtyPage() function at all.

Thanks,
Ricky.




--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To post to this group, send email to uf...@googlegroups.com.
To unsubscribe from this group, send email to uffs+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/uffs?hl=en.


Savin Zlobec

unread,
Jan 4, 2013, 4:25:49 AM1/4/13
to uf...@googlegroups.com
Hi Ricky,

On 01/03/2013 11:20 PM, Ricky Zheng wrote:
> Hi Savin,
>
> Thanks for the patch, I'll apply it later.
>
> In regarding to uffs_FlashMarkDirtyPage() issue, I think a better
> solution is to process the unclean block immediately after step one of
> building tree, so that we don't need uffs_FlashMarkDirtyPage() function
> at all.

You are right, thanks. Please find attached revised patch.

Regards.
unclean_recover.patch

Savin Zlobec

unread,
Jan 4, 2013, 7:33:27 AM1/4/13
to uf...@googlegroups.com
Please disregard the last patch. I improved my stress test checks and
more things 'popped out'...


Savin Zlobec

unread,
Jan 7, 2013, 2:30:05 PM1/7/13
to uf...@googlegroups.com
Hi Ricky,

Please find attached my latest patch which:

- Adds unclean block (no spare or not sealed) recover, with a new bad
block type - PENDING_BLK_CLEANUP - which behaves like
PENDING_BLK_REFRESH, but won't be overridden by PENDING_BLK_RECOVER.
- Removes uffs_FlashMarkDirtyPage - not needed anymore.
- Adds dev->pending.block_in_recovery safeguard to prevent re-adding
bad block currently in recover procedure.
- Changes page 0 TAG_IS_VALID check to TAG_IS_GOOD in
_BuildValidTreeNode, so blocks with unsealed page 0 will be immediately
erased.
- Adds uffs_FlashOpsSt.CheckErasedBlock to let the driver decide how
and if to check erased blocks.
- Modifies uffs_BlockInfoLoad(UFFS_ALL_PAGES) to not bail out on first
read failure, but continue to the end. Tags that can't be read will be
invalid. This saved uffs a lot of rereads when it hits an error and
performs block recovery.
- Optimizes uffs_FindBestPageInBlock for fully loaded blocks.
- Fixes two cases where bad blocks weren't processed correctly, but
instead erased and subsequently reused.

Regards.
uffs.patch

Ricky Zheng

unread,
Jan 9, 2013, 5:47:26 AM1/9/13
to uf...@googlegroups.com
Hi Savin,

The patch looks very good, I've applied it to master branch, thanks !

Cheers,
Ricky.


Reply all
Reply to author
Forward
0 new messages