Rockbox mail archive
Subject: Red led dead and disk spindown
From: Mike Holden (rockbox_at_mikeholden.uklinux.net)
One of the issues with red led dead is that in some situations, the disk
can spin down before the read operation has completed, which makes a bad
situation a lot worse. This is not the only issue, but is certainly one
aspect of the problem. I have found that increasing the disk spindown
setting to a larger value, like 30 seconds helps, but this then makes
battery life more of an issue.
At http://www.mikeholden.org/~rockbox/patches/red.diff is a patch which
resolves this specific issue. It uses a variable, spindown_locks, which is
initialied at 0, and is incremented each time we enter a disk operation,
and decremented as we leave. As we leave, it also sets last_disk_activity
= current_tick so that the spindown then occurs according to the user's
preferred setting. The spindown will only occur if spindown_locks == 0,
otherwise it skips the spindown.
Using an integer count instead of a boolean flag allows for the
possibility that there may be more than one read and/or write operation
going on at the same time. I don't know if this situation ever occurs, but
it was as easy to code for that possibility than to ignore it!
I have tested this on FM, as usual.
Page was last modified "Jan 10 2012" The Rockbox Crew