X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=inline;f=Documentation%2Fyaffs2.html;h=8dd694f38bc99573b98b63cc822722b1c67d2277;hb=1443d5281b629a327b0dec1f23b79bd319a514c1;hp=9014465ba399097aa8fa7a64ff0a9899e63e64bd;hpb=d3a46536d1812c81e1c494235ce8f7e25ebb0e1b;p=yaffs%2F.git diff --git a/Documentation/yaffs2.html b/Documentation/yaffs2.html index 9014465..8dd694f 100644 --- a/Documentation/yaffs2.html +++ b/Documentation/yaffs2.html @@ -7,7 +7,7 @@ - +
Since there is no deletion, a resize (shrinking) of a file will still have valid data chunks past the end of file on the NAND. However, we write a new ObjectHeader at the time of the resize, - therefore this shows the shrunken file size.
+ therefore this shows the shrunken file size. The ObjectHeader also + carries information to say that this is a shrink, for some special + handling in the garbage collector. +
+
This changes erasure slightly:
During garbage collection we can't just look at chunk state flags, instead we must read the tags of each chunk to determine which object's chunk count we must decrement. This step must also be - performed when a block is erased (as part of deletion).
+ performed when a block is erased (as part of deletion). This is + already done in YAFFS by soft deletion.This makes erasure & garbage collection more expensive (by adding reads), but remember that ion YAFFS2 we don't need to do page deletions which are much more expensive operations. Thus, all-up YAFFS2 wins.
+In YAFFS, soft deletion is ued for everything but resizing +(shrinking) a file which has some particularly ugly cases that can +complicate garbage collection.
+As mentioned before, we write a new ObjectHeader to indicate the +shrinking. However, it is important that this ObjectHeader does not +get destroyed (erased) before the data chunks that were discarded +during the shrink are destroyed (erased). If this precaution is not +taken then it is possible that the deleted chunks might be brought +back to life.
+The modification to the garbage collector is as follows:
+The block info flags are expanded as follows:
+containsShrinkObjectHeader: Indicates that one or more of the + chunks in the block are object headers to indicate a file shrink.
+containsShrinkDataChunks: Indicates that one or more of the + chunks in the block are data chunks discarded by a file shrink.
+Before we allow a block with containsShrinkObjectHeader set + to be erased (garbage collected), we must first ensure that all the + earlier blocks (ie according to the block sequence number) that have + containsShrinkDataChunks set are erased (garbage collected) which + ensures that the shrunk data chunks are deleted. The mechanisms to + do this are as follows:
+If the garbage collector attempts to select a block with + containsShrinkObjectHeader set, we check that the above criterion in + met before selecting the block.
+Periodically select the oldest block with + containsShrinkDataChunks for garbage collection.
+
+
+
Each chunk in YAFFS2 has the following information: