[Yaffs] Wrong data after unmount/mount

Charles Manning manningc2 at actrix.gen.nz
Tue Aug 30 23:17:20 BST 2005


Thanx Beat

I will investigate this further.

> (1) I saw that setting the "nShortOpCaches" to 10 will allocate 10 times
> the "yaffs_ChunkCache" struct (536Bytes).
> - Why is a value of 10 to 20 recommended (means memory usage of 5KB up
> to 10KB!)

Obviously more caches == more cach hits == better performance, but the benefit 
tails off. However the cache management code is not very clever, so I would 
not recommend going much over 10 (in fact yaffs will not allow more than 20).

If you are concerned about RAM footprint then feel free to cut this back to 
say 5 or so. I would expect that the effect you are seeing (caching gets the 
space back) would be achieved with nShortOpCaches = 2 or 3;

Still, I need to look since yaffs should work fine without the cache.

> - How can I force writing the cache to the flash?
yaffs_close(handle) or yaffs_flush(handle)

> (2) It looks like "yaffs_freespace()" didn't note the lost bytes within
> a page as lost (used)?!

yaffs_freespace does not and should not count the unused bytes in a page. 

THe way this is supposed to work(without caching)  is as follows:

The first write 600 will write two chunks (say 1 and 2). Chunk 1 will be full, 
and chunk 2 only partia (600-512 = 88 bytes)l.

The next write 600 should read back chunk 2, append bytes to the end of the 
page (ie. 512 - 88 = 432 bytes) and write that to chunk 3. SInce this 
replaces chunk 2, chunk 2 should be freed up for future garbage collection 
and should be counted as a free page by yaffs_freespace().  The second write 
will also write 600-432 = 168 bytes to chunk 4.

Clearly something has been broken and I will look at fixing that, but in the 
mean time I suggest you continue with nShortOpCaches=3 or so to keep going.

-- CHarles



More information about the yaffs mailing list