rendered paste bodyIndex: apps/tagcache.c
===================================================================
--- apps/tagcache.c (revision 16244)
+++ apps/tagcache.c (working copy)
@@ -3030,21 +3030,11 @@
return (next == command_queue_ridx);
}
-
-void run_command_queue(bool force)
+bool command_queue_sync_callback(void)
{
+
struct master_header myhdr;
int masterfd;
-
- if (COMMAND_QUEUE_IS_EMPTY)
- return;
-
- if (!force && !command_queue_is_full()
- && current_tick - TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY
- < command_queue_timestamp)
- {
- return;
- }
mutex_lock(&command_queue_mutex);
@@ -3064,7 +3054,7 @@
/* Re-open the masterfd. */
if ( (masterfd = open_master_fd(&myhdr, true)) < 0)
- return;
+ return true;
break;
}
@@ -3082,8 +3072,28 @@
close(masterfd);
mutex_unlock(&command_queue_mutex);
+ return true;
}
+void run_command_queue(bool force)
+{
+ if (COMMAND_QUEUE_IS_EMPTY)
+ return;
+
+ if (!force && !command_queue_is_full()
+ && current_tick - TAGCACHE_COMMAND_QUEUE_COMMIT_DELAY
+ < command_queue_timestamp)
+ {
+ return;
+ }
+ else if (force)
+ {
+ command_queue_sync_callback();
+ return;
+ }
+ ata_callback_register(command_queue_sync_callback);
+}
+
static void queue_command(int cmd, long idx_id, int tag, long data)
{
while (1)