[Yaffs] why shadowing stuff can be cleaned during GC?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: zheng shi
Date:  
To: yaffs
Subject: [Yaffs] why shadowing stuff can be cleaned during GC?
Hi,
Assume object A is renamed to shadow object B, then things will happen like:
1. A shadow header of object A is written. (of course with the same
name as object B)
2. A deletion header of object B is written.
3. A normal header of object A is written.

GC may probably take place in yaffs_UpdateObjectHeader before the
header chunk is written.

So if step 2 incurs GC, GC will get rid of the shadow header to
generate a normal one.
At this time, deletion header of object B hasn't been written, if
power fails, we will get two
objects with the same name in the same directory.

i.e. things happen like:
1. A shadow header of object A is written.
2. writing deletion header of object B incurs GC, and shadow header of
object A converts to a normal one.
3. power off
4. in yaffs_ScanBackwards we may get object A and B with the same name
in the same dir.

Although the probability is low, I still get confused.
Do I misunderstand anything?

--
Regards, neversetsun