stepcompress: Invert the meaning of the min_clock flag
Use a non-zero qm->min_clock value to indicate that the command uses the move queue and to also store the clock of when that move queue item will be released. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
ff6fef927a
commit
8025921fc8
|
@ -360,7 +360,7 @@ stepcompress_flush(struct stepcompress *sc, uint64_t move_clock)
|
||||||
sc->queue_step_msgid, sc->oid, move.interval, move.count, move.add
|
sc->queue_step_msgid, sc->oid, move.interval, move.count, move.add
|
||||||
};
|
};
|
||||||
struct queue_message *qm = message_alloc_and_encode(msg, 5);
|
struct queue_message *qm = message_alloc_and_encode(msg, 5);
|
||||||
qm->req_clock = sc->last_step_clock;
|
qm->min_clock = qm->req_clock = sc->last_step_clock;
|
||||||
list_add_tail(&qm->node, &sc->msg_queue);
|
list_add_tail(&qm->node, &sc->msg_queue);
|
||||||
|
|
||||||
uint32_t addfactor = move.count*(move.count-1)/2;
|
uint32_t addfactor = move.count*(move.count-1)/2;
|
||||||
|
@ -389,7 +389,6 @@ stepcompress_queue_msg(struct stepcompress *sc, uint32_t *data, int len)
|
||||||
stepcompress_flush(sc, UINT64_MAX);
|
stepcompress_flush(sc, UINT64_MAX);
|
||||||
|
|
||||||
struct queue_message *qm = message_alloc_and_encode(data, len);
|
struct queue_message *qm = message_alloc_and_encode(data, len);
|
||||||
qm->min_clock = -1;
|
|
||||||
qm->req_clock = sc->last_step_clock;
|
qm->req_clock = sc->last_step_clock;
|
||||||
list_add_tail(&qm->node, &sc->msg_queue);
|
list_add_tail(&qm->node, &sc->msg_queue);
|
||||||
}
|
}
|
||||||
|
@ -483,7 +482,6 @@ steppersync_flush(struct steppersync *ss, uint64_t move_clock)
|
||||||
// Order commands by the reqclock of each pending command
|
// Order commands by the reqclock of each pending command
|
||||||
struct list_head msgs;
|
struct list_head msgs;
|
||||||
list_init(&msgs);
|
list_init(&msgs);
|
||||||
uint64_t min_clock = ss->move_clocks[0];
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
// Find message with lowest reqclock
|
// Find message with lowest reqclock
|
||||||
uint64_t req_clock = MAX_CLOCK;
|
uint64_t req_clock = MAX_CLOCK;
|
||||||
|
@ -499,17 +497,17 @@ steppersync_flush(struct steppersync *ss, uint64_t move_clock)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!qm || (!qm->min_clock && req_clock > move_clock))
|
if (!qm || (qm->min_clock && req_clock > move_clock))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Set the min_clock for this command
|
uint64_t next_avail = ss->move_clocks[0];
|
||||||
if (!qm->min_clock) {
|
if (qm->min_clock)
|
||||||
qm->min_clock = min_clock;
|
// The qm->min_clock field is overloaded to indicate that
|
||||||
heap_replace(ss, req_clock);
|
// the command uses the 'move queue' and to store the time
|
||||||
min_clock = ss->move_clocks[0];
|
// that move queue item becomes available.
|
||||||
} else {
|
heap_replace(ss, qm->min_clock);
|
||||||
qm->min_clock = min_clock;
|
// Reset the min_clock to its normal meaning (minimum transmit time)
|
||||||
}
|
qm->min_clock = next_avail;
|
||||||
|
|
||||||
// Batch this command
|
// Batch this command
|
||||||
list_del(&qm->node);
|
list_del(&qm->node);
|
||||||
|
|
Loading…
Reference in New Issue