Remove cancel_all_writes
Not needed because a) parallel writes to the same object are forbidden b) subsequent writes don't depend on previous ones anyway.
This commit is contained in:
@@ -165,7 +165,6 @@ public:
|
|||||||
|
|
||||||
// Write
|
// Write
|
||||||
bool enqueue_write(blockstore_op_t *op);
|
bool enqueue_write(blockstore_op_t *op);
|
||||||
void cancel_all_writes(blockstore_op_t *op, int retval);
|
|
||||||
void prepare_meta_block_write(blockstore_op_t *op, uint64_t modified_block, io_uring_sqe *sqe = NULL);
|
void prepare_meta_block_write(blockstore_op_t *op, uint64_t modified_block, io_uring_sqe *sqe = NULL);
|
||||||
int dequeue_write(blockstore_op_t *op);
|
int dequeue_write(blockstore_op_t *op);
|
||||||
bool make_big_write(blockstore_op_t *op, uint32_t offset, uint32_t len, uint32_t *modified_block);
|
bool make_big_write(blockstore_op_t *op, uint32_t offset, uint32_t len, uint32_t *modified_block);
|
||||||
|
|||||||
@@ -11,33 +11,6 @@ bool blockstore_impl_t::enqueue_write(blockstore_op_t *op)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockstore_impl_t::cancel_all_writes(blockstore_op_t *op, int retval)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
for (auto other_op: submit_queue)
|
|
||||||
{
|
|
||||||
if (!other_op)
|
|
||||||
{
|
|
||||||
// freed operations during submitting are zeroed
|
|
||||||
}
|
|
||||||
else if (other_op == op)
|
|
||||||
{
|
|
||||||
// <op> may be present in queue multiple times due to moving operations in submit_queue
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else if (found && other_op->oid == op->oid &&
|
|
||||||
(other_op->opcode == BS_OP_WRITE || other_op->opcode == BS_OP_WRITE_STABLE) &&
|
|
||||||
!PRIV(other_op)->op_state)
|
|
||||||
{
|
|
||||||
// Mark operations to cancel them
|
|
||||||
PRIV(other_op)->op_state = 100;
|
|
||||||
other_op->retval = retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
op->retval = retval;
|
|
||||||
FINISH_OP(op);
|
|
||||||
}
|
|
||||||
|
|
||||||
void blockstore_impl_t::prepare_meta_block_write(blockstore_op_t *op, uint64_t modified_block, io_uring_sqe *sqe)
|
void blockstore_impl_t::prepare_meta_block_write(blockstore_op_t *op, uint64_t modified_block, io_uring_sqe *sqe)
|
||||||
{
|
{
|
||||||
if (!sqe)
|
if (!sqe)
|
||||||
@@ -57,12 +30,6 @@ void blockstore_impl_t::prepare_meta_block_write(blockstore_op_t *op, uint64_t m
|
|||||||
// First step of the write algorithm: dequeue operation and submit initial write(s)
|
// First step of the write algorithm: dequeue operation and submit initial write(s)
|
||||||
int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
|
int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
|
||||||
{
|
{
|
||||||
if (PRIV(op)->op_state == 100)
|
|
||||||
{
|
|
||||||
// This is the flag used to cancel ops
|
|
||||||
FINISH_OP(op);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
if (PRIV(op)->op_state)
|
if (PRIV(op)->op_state)
|
||||||
{
|
{
|
||||||
return continue_write(op);
|
return continue_write(op);
|
||||||
@@ -107,7 +74,8 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
|
|||||||
if (!heap->get_inflight_queue_size())
|
if (!heap->get_inflight_queue_size())
|
||||||
{
|
{
|
||||||
// no space
|
// no space
|
||||||
cancel_all_writes(op, -ENOSPC);
|
op->retval = -ENOSPC;
|
||||||
|
FINISH_OP(op);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
PRIV(op)->wait_for = WAIT_COMPACTION;
|
PRIV(op)->wait_for = WAIT_COMPACTION;
|
||||||
@@ -203,7 +171,8 @@ process_intent:
|
|||||||
if (!heap->get_inflight_queue_size())
|
if (!heap->get_inflight_queue_size())
|
||||||
{
|
{
|
||||||
// no space
|
// no space
|
||||||
cancel_all_writes(op, -ENOSPC);
|
op->retval = -ENOSPC;
|
||||||
|
FINISH_OP(op);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
PRIV(op)->wait_for = WAIT_COMPACTION;
|
PRIV(op)->wait_for = WAIT_COMPACTION;
|
||||||
@@ -248,7 +217,8 @@ process_intent:
|
|||||||
if (!heap->get_inflight_queue_size())
|
if (!heap->get_inflight_queue_size())
|
||||||
{
|
{
|
||||||
// no space
|
// no space
|
||||||
cancel_all_writes(op, -ENOSPC);
|
op->retval = -ENOSPC;
|
||||||
|
FINISH_OP(op);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
PRIV(op)->wait_for = WAIT_COMPACTION;
|
PRIV(op)->wait_for = WAIT_COMPACTION;
|
||||||
|
|||||||
Reference in New Issue
Block a user