On Tuesday 22 June 2010 23:08:33 Sven Van Asbroeck wrote: > I'd like to determine the 'order of magnitude' of my product's flash > lifetime, so I would like to learn more about yaffs's wear leveling > strategies. Have you read http://www.yaffs.net/how-yaffs-works-internals ? > > I think I understand the intrinsic wear-leveling properties of a log-based > file system such as yaffs. No chunk, block or location is favoured over any > other as the log grows. > > Questions: > 1. When choosing a block to erase, does yaffs have a strategy to ensure > erases are spread reasonably evenly across blocks? It is not so much the choice of erasures that matters but the choice of the next block to write and the selection of blocks for garbage collection. > > 2. Imagine two partitions, equal in size. Partition A is 90% free, while > partition B is only 5% free. On each partition, we repeatedly overwrite a > single small file. (This is pretty realistic for my product) Would it be > correct to say that yaffs would only wear level across *free* blocks? Does > this mean the blocks in partition B would wear out faster than the ones in > A? Without "block refreshing" this is true. Unless there is any garbage scattered through the 90% then there will be nothing to trigger garbage collection on these blocks. That would mean that the small file rewriting would continuously cycle through the 5% of flash space. > 3. Would enabling 'block refreshing' help with wear leveling? Yes. Block refreshing rewrites the oldest block so it will help prevent the "block squatting" issue you mention in (2) above. The oldest block (ie. one of the 90%) will be periodically rewritten which will move one of those into the active 5%. Over time that will even things out and cause wear levelling to happen over the whole partition. -- Charles