Begin write algorithm

This commit is contained in:
Vitaliy Filippov
2019-11-07 02:24:12 +03:00
parent 2f18a3d19e
commit 84c62840bd
5 changed files with 161 additions and 5 deletions
+26 -1
View File
@@ -138,14 +138,39 @@ void blockstore::loop()
break;
}
}
else if (((*cur)->flags & OP_TYPE_MASK) == OP_WRITE ||
((*cur)->flags & OP_TYPE_MASK) == OP_DELETE)
{
int dequeue_op = dequeue_write(*cur);
if (dequeue_op)
{
submit_queue.erase(cur);
}
else if ((*cur)->wait_for == WAIT_SQE)
{
// ring is full, stop submission
break;
}
}
else if (((*cur)->flags & OP_TYPE_MASK) == OP_SYNC)
{
}
else if (((*cur)->flags & OP_TYPE_MASK) == OP_STABLE)
{
}
}
}
}
int blockstore::enqueue_op(blockstore_operation *op)
{
if (op->offset >= block_size || op->len >= block_size-op->offset)
if (op->offset >= block_size || op->len >= block_size-op->offset ||
(op->len % DISK_ALIGNMENT) ||
(op->flags & OP_TYPE_MASK) < OP_READ || (op->flags & OP_TYPE_MASK) > OP_DELETE)
{
// Basic verification not passed
return -EINVAL;
}
submit_queue.push_back(op);