summaryrefslogtreecommitdiffstats
path: root/firmware/storage.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2014-08-30 11:28:50 -0400
committerMichael Sevakis <jethead71@rockbox.org>2014-08-30 14:01:21 -0400
commit5b08f1a5b99136ef052b6f430b62bc618cd44946 (patch)
tree257d405d78e871e6b944db987ffaf5c40f862fce /firmware/storage.c
parent5d31d3c3bc0358eeed08e2a5242dc2b065110aad (diff)
downloadrockbox-5b08f1a5b99136ef052b6f430b62bc618cd44946.tar.gz
rockbox-5b08f1a5b99136ef052b6f430b62bc618cd44946.tar.bz2
rockbox-5b08f1a5b99136ef052b6f430b62bc618cd44946.zip
Remove I/O priority. It is harmful when used with the new file code.
HAVE_IO_PRIORITY was defined for native targets with dircache. It is already effectively disabled for the most part since dircache no longer lowers its thread's I/O priority. It existed primarily for the aforementioned configuration. Change-Id: Ia04935305397ba14df34647c8ea29c2acaea92aa
Diffstat (limited to 'firmware/storage.c')
-rw-r--r--firmware/storage.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/firmware/storage.c b/firmware/storage.c
index e0b491a5f9..e9a3396f30 100644
--- a/firmware/storage.c
+++ b/firmware/storage.c
@@ -33,63 +33,9 @@ static unsigned int storage_drivers[NUM_DRIVES];
static unsigned int num_drives;
#endif
-
-#ifdef HAVE_IO_PRIORITY
-
-/* Same for flash? */
-#define STORAGE_MINIMUM_IDLE_TIME (HZ/10)
-#define STORAGE_DELAY_UNIT (HZ/20)
-
-static unsigned int storage_last_thread[NUM_DRIVES];
-static unsigned int storage_last_activity[NUM_DRIVES];
-
-static bool storage_should_wait(int drive, int prio)
-{
- int other_prio = thread_get_io_priority(storage_last_thread[drive]);
- if(TIME_BEFORE(current_tick,storage_last_activity[drive]+STORAGE_MINIMUM_IDLE_TIME))
- {
- if(prio<=other_prio)
- {
- /* There is another active thread, but we have lower priority */
- return false;
- }
- else
- {
- /* There is another active thread, but it has lower priority */
- return true;
- }
- }
- else
- {
- /* There's nothing going on anyway */
- return false;
- }
-}
-
-static void storage_wait_turn(IF_MD_NONVOID(int drive))
-{
-#ifndef HAVE_MULTIDRIVE
- int drive=0;
-#endif
- int my_prio = thread_get_io_priority(thread_self());
- int loops=my_prio;
- while(storage_should_wait(drive, my_prio) && (loops--)>=0)
- {
- sleep(STORAGE_DELAY_UNIT);
- }
-
- storage_last_thread[drive] = thread_self();
- storage_last_activity[drive] = current_tick;
-}
-#endif
-
int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
void* buf)
{
-#ifdef HAVE_IO_PRIORITY
- storage_wait_turn(IF_MD(drive));
-#endif
-
#ifdef CONFIG_STORAGE_MULTI
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;
@@ -132,10 +78,6 @@ int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count,
int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count,
const void* buf)
{
-#ifdef HAVE_IO_PRIORITY
- storage_wait_turn(IF_MD(drive));
-#endif
-
#ifdef CONFIG_STORAGE_MULTI
int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET;
int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET;