Author: Steve Zook Date: To: yaffs Subject: [Yaffs] Question about garbage collection and delete headers
I'm a little murky on an algorithmic aspect of the yaffs2 and I was hoping
to get educated. I've read all the theory materials but could not find an
answer to the question.
When an object gets deleted, a new header gets written to media to mark the
object as deleted. The deleting header should always be, sequence number
wise, last for that object. When the block containing the deleting header
gets garbage collected, how does it get decided whether to copy the deleting
header or to drop it?
It seems to me that blocks are being garbage collected in arbitrary order
(as compared to sequence number order). Thus, when the block that contains a
deleting header is being garbage collected, there may still be object
headers (obsolete though they may be) in blocks that have yet to be erased.
If this is true, the delete header must be copied, otherwise during a later
mount the object will be resurrected. I don't, however, see any efficient
way to determine whether any such obsolete object headers exist. There might
be any number of them and they may get erased in arbitrary order. Eventually
the deleting header should be discarded but when?