Fix write iov_len check

blocking-uring-test
Vitaliy Filippov 2019-11-18 13:37:32 +03:00
parent 5b8df6768b
commit b6174075de
2 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,7 @@ void blockstore::enqueue_write(blockstore_operation *op)
.oid = op->oid,
.version = UINT64_MAX,
});
dirty_it--;
dirty_it--; // segfaults when dirty_db is empty
if (dirty_it != dirty_db.end() && dirty_it->first.oid == op->oid)
{
found = true;
@ -95,13 +95,14 @@ int blockstore::dequeue_write(blockstore_operation *op)
op->iov_zerofill[vcnt++] = (struct iovec){ op->buf, op->len };
if (op->offset+op->len < block_size)
op->iov_zerofill[vcnt++] = (struct iovec){ zero_object, block_size - (op->offset + op->len) };
data->iov.iov_len = block_size;
}
else
{
vcnt = 1;
op->iov_zerofill[0] = (struct iovec){ op->buf, op->len };
data->iov.iov_len = op->len; // to check it in the callback
}
data->iov.iov_len = op->len; // to check it in the callback
data->callback = cb;
my_uring_prep_writev(
sqe, data_fd, op->iov_zerofill, vcnt, data_offset + (loc << block_order)

View File

@ -37,6 +37,7 @@ void ring_loop_t::unregister_consumer(int number)
void ring_loop_t::loop(bool sleep)
{
// FIXME: we should loop until all "coroutines" are suspended. currently we loop only once before sleeping
struct io_uring_cqe *cqe;
while (!io_uring_peek_cqe(&ring, &cqe))
{