Compare commits
13 Commits
179842d664
...
aeb2b9cc3f
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | aeb2b9cc3f | |
Vitaliy Filippov | 4afb144997 | |
Vitaliy Filippov | 20bdfd94d4 | |
Vitaliy Filippov | 1a9ceb931b | |
Vitaliy Filippov | 97724233f9 | |
Vitaliy Filippov | f9ab67921f | |
Vitaliy Filippov | a182f5d4a5 | |
Vitaliy Filippov | 0314c94c85 | |
Vitaliy Filippov | b2b1088977 | |
Vitaliy Filippov | 43b57ba886 | |
Vitaliy Filippov | 665ebf955c | |
Vitaliy Filippov | 1e5c632d8b | |
Vitaliy Filippov | aedb4d5bfc |
|
@ -673,7 +673,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
|
|||
return false;
|
||||
}
|
||||
// Check alignment
|
||||
if (!op->len && (op->opcode == OSD_OP_READ_BITMAP || op->opcode == OSD_OP_READ_CHAIN_BITMAP || op->opcode == OSD_OP_WRITE) ||
|
||||
if (!op->len && (op->opcode == OSD_OP_READ || op->opcode == OSD_OP_READ_BITMAP || op->opcode == OSD_OP_READ_CHAIN_BITMAP || op->opcode == OSD_OP_WRITE) ||
|
||||
op->offset % pool_it->second.bitmap_granularity || op->len % pool_it->second.bitmap_granularity)
|
||||
{
|
||||
op->retval = -EINVAL;
|
||||
|
|
|
@ -887,23 +887,14 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
|
|||
op->opcode = OSD_OP_READ;
|
||||
op->inode = db->inode_id;
|
||||
op->offset = offset;
|
||||
if (b_it != db->block_cache.end() && !b_it->second.invalidated && !b_it->second.updating)
|
||||
{
|
||||
// just recheck version - it's cheaper than re-reading the block
|
||||
op->len = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
op->len = db->kv_block_size;
|
||||
op->iov.push_back(malloc_or_die(op->len), op->len);
|
||||
}
|
||||
op->len = db->kv_block_size;
|
||||
op->iov.push_back(malloc_or_die(op->len), op->len);
|
||||
op->callback = [=](cluster_op_t *op)
|
||||
{
|
||||
if (op->retval != op->len)
|
||||
{
|
||||
// error
|
||||
if (op->len)
|
||||
free(op->iov.buf[0].iov_base);
|
||||
free(op->iov.buf[0].iov_base);
|
||||
cb(op->retval >= 0 ? -EIO : op->retval, BLK_NOCHANGE);
|
||||
delete op;
|
||||
return;
|
||||
|
@ -918,8 +909,7 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
|
|||
if (blk->updating > 0 && recheck_policy == KV_RECHECK_WAIT)
|
||||
{
|
||||
// Wait until block update stops
|
||||
if (op->len)
|
||||
free(op->iov.buf[0].iov_base);
|
||||
free(op->iov.buf[0].iov_base);
|
||||
delete op;
|
||||
db->continue_update.emplace(blk->offset, [=, blk_offset = blk->offset]()
|
||||
{
|
||||
|
@ -933,13 +923,6 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!op->len)
|
||||
{
|
||||
// Version check failed, re-read block
|
||||
delete op;
|
||||
get_block(db, offset, cur_level, recheck_policy, cb);
|
||||
return;
|
||||
}
|
||||
auto blk = &db->block_cache[op->offset];
|
||||
if (blk_it != db->block_cache.end())
|
||||
{
|
||||
|
@ -961,8 +944,7 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
|
|||
}
|
||||
try_evict(db);
|
||||
}
|
||||
if (op->len)
|
||||
free(op->iov.buf[0].iov_base);
|
||||
free(op->iov.buf[0].iov_base);
|
||||
delete op;
|
||||
};
|
||||
db->cli->execute(op);
|
||||
|
|
Loading…
Reference in New Issue