[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Wear Leveling in JFFS2 NOT working!(?)

On Mon, 30 Apr 2001, Vipin Malik wrote:

> Obviously, not all sectors are being "cycled" evenly. As a matter of
> fact, none of the sectors below 0x380000 are being cycled at all.
> Now, one thing that may be tripping up the wear leveling algorithm is
> the fact that the system is being cycled every 2-3 minutes.

That's almost certainly the reason. My testing on prolonged stress tests
showed a fairly even wear levelling.

> David? What does the algorithm to "pickup" a new "less cycled" sector
> and give a over-used sector a rest depend on?

Most of the time we pick the block off the end of the dirty_list. With a
1/100 probability, we pick a block off the clean_list instead.
Freshly-dirtied blocks get put on the back of the dirty_list. Likewise,
freshly-filled blocks get put on back of the clean_list. So it tends to
use them fairly evenly.

However, when we remount the filesystem, we lose that ordering. The blocks
get put on the lists in order, and we pick the block nearest the end of
the medium.

Suggested fix: introduce some randomness to the initial list after

	1. After scan, move the first <n> blocks in the list to the end
		of the list, where 1 < n < sizeof(list).
	2. When adding entries to the lists during scan, do something
		like: if (jiffies % 1) list_add_tail() else list_add().


To unsubscribe from this list: send the line "unsubscribe jffs-dev" in
the body of a message to majordomo@xxxxxxx.com