Allow to read specific versions
parent
2d0334f9b9
commit
e5caffb6ac
|
@ -66,8 +66,7 @@ void blockstore::handle_event(ring_data_t *data)
|
|||
else
|
||||
{
|
||||
struct blockstore_operation* op = (struct blockstore_operation*)data->op;
|
||||
if ((op->flags & OP_TYPE_MASK) == OP_READ_DIRTY ||
|
||||
(op->flags & OP_TYPE_MASK) == OP_READ)
|
||||
if ((op->flags & OP_TYPE_MASK) == OP_READ)
|
||||
{
|
||||
handle_read_event(data, op);
|
||||
}
|
||||
|
@ -145,8 +144,7 @@ void blockstore::loop()
|
|||
unsigned ring_space = io_uring_sq_space_left(ringloop->ring);
|
||||
unsigned prev_sqe_pos = ringloop->ring->sq.sqe_tail;
|
||||
int dequeue_op = 0;
|
||||
if ((op->flags & OP_TYPE_MASK) == OP_READ_DIRTY ||
|
||||
(op->flags & OP_TYPE_MASK) == OP_READ)
|
||||
if ((op->flags & OP_TYPE_MASK) == OP_READ)
|
||||
{
|
||||
dequeue_op = dequeue_read(op);
|
||||
}
|
||||
|
|
10
blockstore.h
10
blockstore.h
|
@ -171,11 +171,10 @@ public:
|
|||
// In fact, adding a write operation must immediately result in dirty_db being populated
|
||||
|
||||
#define OP_READ 1
|
||||
#define OP_READ_DIRTY 2
|
||||
#define OP_WRITE 3
|
||||
#define OP_SYNC 4
|
||||
#define OP_STABLE 5
|
||||
#define OP_DELETE 6
|
||||
#define OP_WRITE 2
|
||||
#define OP_SYNC 3
|
||||
#define OP_STABLE 4
|
||||
#define OP_DELETE 5
|
||||
#define OP_TYPE_MASK 0x7
|
||||
|
||||
// Suspend operation until there are more free SQEs
|
||||
|
@ -192,6 +191,7 @@ struct blockstore_operation
|
|||
std::function<void (blockstore_operation*)> callback;
|
||||
uint32_t flags;
|
||||
object_id oid;
|
||||
// For reads: version=0 -> last stable, version=UINT64_MAX -> last unstable, version=X -> specific version
|
||||
uint64_t version;
|
||||
uint32_t offset;
|
||||
uint32_t len;
|
||||
|
|
|
@ -71,7 +71,6 @@ int blockstore::fulfill_read(blockstore_operation *read_op, uint32_t item_start,
|
|||
|
||||
int blockstore::dequeue_read(blockstore_operation *read_op)
|
||||
{
|
||||
// FIXME: allow to read specific version
|
||||
auto clean_it = object_db.find(read_op->oid);
|
||||
auto dirty_it = dirty_db.upper_bound((obj_ver_id){
|
||||
.oid = read_op->oid,
|
||||
|
@ -94,7 +93,7 @@ int blockstore::dequeue_read(blockstore_operation *read_op)
|
|||
while (dirty_it->first.oid == read_op->oid)
|
||||
{
|
||||
dirty_entry& dirty = dirty_it->second;
|
||||
if ((read_op->flags & OP_TYPE_MASK) == OP_READ_DIRTY || IS_STABLE(dirty.state))
|
||||
if (IS_STABLE(dirty.state) || read_op->version >= dirty_it->first.version)
|
||||
{
|
||||
if (!fulfill_read(read_op, dirty.offset, dirty.offset + dirty.size,
|
||||
dirty.state, dirty_it->first.version, dirty.location))
|
||||
|
|
Loading…
Reference in New Issue