Block lists by previous writes

This commit is contained in:
Vitaliy Filippov
2025-12-02 01:52:12 +03:00
parent f3048d0858
commit 8992eb57df
+16 -3
View File
@@ -97,6 +97,7 @@ void blockstore_impl_t::loop()
// try to submit ops // try to submit ops
unsigned initial_ring_space = ringloop->space_left(); unsigned initial_ring_space = ringloop->space_left();
int op_idx = 0, new_idx = 0; int op_idx = 0, new_idx = 0;
bool has_unfinished_writes = false;
for (; op_idx < submit_queue.size(); op_idx++, new_idx++) for (; op_idx < submit_queue.size(); op_idx++, new_idx++)
{ {
auto op = submit_queue[op_idx]; auto op = submit_queue[op_idx];
@@ -111,6 +112,9 @@ void blockstore_impl_t::loop()
} }
else if (PRIV(op)->wait_for) else if (PRIV(op)->wait_for)
{ {
has_unfinished_writes = has_unfinished_writes || op->opcode == BS_OP_WRITE ||
op->opcode == BS_OP_WRITE_STABLE || op->opcode == BS_OP_DELETE ||
op->opcode == BS_OP_STABLE || op->opcode == BS_OP_ROLLBACK;
continue; continue;
} }
} }
@@ -126,6 +130,7 @@ void blockstore_impl_t::loop()
else if (op->opcode == BS_OP_WRITE || op->opcode == BS_OP_WRITE_STABLE || op->opcode == BS_OP_DELETE) else if (op->opcode == BS_OP_WRITE || op->opcode == BS_OP_WRITE_STABLE || op->opcode == BS_OP_DELETE)
{ {
wr_st = dequeue_write(op); wr_st = dequeue_write(op);
has_unfinished_writes = has_unfinished_writes || (wr_st != 2);
} }
else if (op->opcode == BS_OP_SYNC) else if (op->opcode == BS_OP_SYNC)
{ {
@@ -135,12 +140,20 @@ void blockstore_impl_t::loop()
else if (op->opcode == BS_OP_STABLE || op->opcode == BS_OP_ROLLBACK) else if (op->opcode == BS_OP_STABLE || op->opcode == BS_OP_ROLLBACK)
{ {
wr_st = dequeue_stable(op); wr_st = dequeue_stable(op);
has_unfinished_writes = has_unfinished_writes || (wr_st != 2);
} }
else if (op->opcode == BS_OP_LIST) else if (op->opcode == BS_OP_LIST)
{ {
// LIST doesn't have to be blocked by previous modifications // LIST has to be blocked by previous writes and commits/rollbacks
process_list(op); if (!has_unfinished_writes)
wr_st = 2; {
process_list(op);
wr_st = 2;
}
else
{
wr_st = 0;
}
} }
if (wr_st == 2) if (wr_st == 2)
{ {