Block writes earlier than sync/stabilize would be blocked, too

This commit is contained in:
Vitaliy Filippov
2020-01-10 20:05:17 +03:00
parent b3f2102f33
commit 4b05bde3a2
6 changed files with 38 additions and 12 deletions
+17 -5
View File
@@ -289,12 +289,17 @@ void blockstore_impl_t::check_wait(blockstore_op_t *op)
}
}
void blockstore_impl_t::enqueue_op(blockstore_op_t *op)
void blockstore_impl_t::enqueue_op(blockstore_op_t *op, bool first)
{
int type = op->opcode & BS_OP_TYPE_MASK;
if (type < BS_OP_MIN || type > BS_OP_MAX || (type == BS_OP_READ || type == BS_OP_WRITE) &&
(op->offset >= block_size || op->len > block_size-op->offset || (op->len % DISK_ALIGNMENT)) ||
readonly && type != BS_OP_READ)
if (type < BS_OP_MIN || type > BS_OP_MAX ||
((type == BS_OP_READ || type == BS_OP_WRITE) && (
op->offset >= block_size ||
op->len > block_size-op->offset ||
(op->len % DISK_ALIGNMENT)
)) ||
readonly && type != BS_OP_READ ||
first && type == BS_OP_WRITE)
{
// Basic verification not passed
op->retval = -EINVAL;
@@ -313,7 +318,14 @@ void blockstore_impl_t::enqueue_op(blockstore_op_t *op)
PRIV(op)->wait_for = 0;
PRIV(op)->sync_state = 0;
PRIV(op)->pending_ops = 0;
submit_queue.push_back(op);
if (!first)
{
submit_queue.push_back(op);
}
else
{
submit_queue.push_front(op);
}
if (type == BS_OP_WRITE)
{
enqueue_write(op);