diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2014-08-30 11:28:50 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2014-08-30 14:01:21 -0400 |
commit | 5b08f1a5b99136ef052b6f430b62bc618cd44946 (patch) | |
tree | 257d405d78e871e6b944db987ffaf5c40f862fce /firmware/storage.c | |
parent | 5d31d3c3bc0358eeed08e2a5242dc2b065110aad (diff) | |
download | rockbox-5b08f1a5b99136ef052b6f430b62bc618cd44946.tar.gz 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.c | 58 |
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]; | |||
33 | static unsigned int num_drives; | 33 | static unsigned int num_drives; |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | |||
37 | #ifdef HAVE_IO_PRIORITY | ||
38 | |||
39 | /* Same for flash? */ | ||
40 | #define STORAGE_MINIMUM_IDLE_TIME (HZ/10) | ||
41 | #define STORAGE_DELAY_UNIT (HZ/20) | ||
42 | |||
43 | static unsigned int storage_last_thread[NUM_DRIVES]; | ||
44 | static unsigned int storage_last_activity[NUM_DRIVES]; | ||
45 | |||
46 | static bool storage_should_wait(int drive, int prio) | ||
47 | { | ||
48 | int other_prio = thread_get_io_priority(storage_last_thread[drive]); | ||
49 | if(TIME_BEFORE(current_tick,storage_last_activity[drive]+STORAGE_MINIMUM_IDLE_TIME)) | ||
50 | { | ||
51 | if(prio<=other_prio) | ||
52 | { | ||
53 | /* There is another active thread, but we have lower priority */ | ||
54 | return false; | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | /* There is another active thread, but it has lower priority */ | ||
59 | return true; | ||
60 | } | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | /* There's nothing going on anyway */ | ||
65 | return false; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | static void storage_wait_turn(IF_MD_NONVOID(int drive)) | ||
70 | { | ||
71 | #ifndef HAVE_MULTIDRIVE | ||
72 | int drive=0; | ||
73 | #endif | ||
74 | int my_prio = thread_get_io_priority(thread_self()); | ||
75 | int loops=my_prio; | ||
76 | while(storage_should_wait(drive, my_prio) && (loops--)>=0) | ||
77 | { | ||
78 | sleep(STORAGE_DELAY_UNIT); | ||
79 | } | ||
80 | |||
81 | storage_last_thread[drive] = thread_self(); | ||
82 | storage_last_activity[drive] = current_tick; | ||
83 | } | ||
84 | #endif | ||
85 | |||
86 | int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, | 36 | int storage_read_sectors(IF_MD(int drive,) unsigned long start, int count, |
87 | void* buf) | 37 | void* buf) |
88 | { | 38 | { |
89 | #ifdef HAVE_IO_PRIORITY | ||
90 | storage_wait_turn(IF_MD(drive)); | ||
91 | #endif | ||
92 | |||
93 | #ifdef CONFIG_STORAGE_MULTI | 39 | #ifdef CONFIG_STORAGE_MULTI |
94 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; | 40 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
95 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; | 41 | 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, | |||
132 | int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count, | 78 | int storage_write_sectors(IF_MD(int drive,) unsigned long start, int count, |
133 | const void* buf) | 79 | const void* buf) |
134 | { | 80 | { |
135 | #ifdef HAVE_IO_PRIORITY | ||
136 | storage_wait_turn(IF_MD(drive)); | ||
137 | #endif | ||
138 | |||
139 | #ifdef CONFIG_STORAGE_MULTI | 81 | #ifdef CONFIG_STORAGE_MULTI |
140 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; | 82 | int driver=(storage_drivers[drive] & DRIVER_MASK)>>DRIVER_OFFSET; |
141 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; | 83 | int ldrive=(storage_drivers[drive] & DRIVE_MASK)>>DRIVE_OFFSET; |