Compare commits

..

No commits in common. "da2bfd0b1e42085607aaba536244ec91f35d758e" and "6acf562e0142cb2b0c8397b45790d17bddd2f7c4" have entirely different histories.

3 changed files with 4 additions and 27 deletions

View File

@ -539,18 +539,10 @@ class Mon
{ {
retries = 1; retries = 1;
} }
const tried = {};
while (retries < 0 || retry < retries) while (retries < 0 || retry < retries)
{ {
const cur_addr = this.pick_next_etcd(); const cur_addr = this.pick_next_etcd();
const base = 'ws'+cur_addr.substr(4); const base = 'ws'+cur_addr.substr(4);
let now = Date.now();
if (tried[base] && now-tried[base] < timeout)
{
await new Promise(ok => setTimeout(ok, timeout-(now-tried[base])));
now = Date.now();
}
tried[base] = now;
const ok = await new Promise((ok, no) => const ok = await new Promise((ok, no) =>
{ {
const timer_id = setTimeout(() => const timer_id = setTimeout(() =>
@ -1796,18 +1788,10 @@ class Mon
{ {
retries = 1; retries = 1;
} }
const tried = {};
while (retries < 0 || retry < retries) while (retries < 0 || retry < retries)
{ {
retry++; retry++;
const base = this.pick_next_etcd(); const base = this.pick_next_etcd();
let now = Date.now();
if (tried[base] && now-tried[base] < timeout)
{
await new Promise(ok => setTimeout(ok, timeout-(now-tried[base])));
now = Date.now();
}
tried[base] = now;
const res = await POST(base+path, body, timeout); const res = await POST(base+path, body, timeout);
if (res.error) if (res.error)
{ {

View File

@ -565,11 +565,11 @@ void cluster_client_t::copy_write(cluster_op_t *op, std::map<object_id, cluster_
while (len > 0) while (len > 0)
{ {
uint64_t new_len = 0; uint64_t new_len = 0;
if (dirty_it == dirty_buffers.end() || dirty_it->first.inode != op->inode) if (dirty_it == dirty_buffers.end())
{ {
new_len = len; new_len = len;
} }
else if (dirty_it->first.stripe > pos) else if (dirty_it->first.inode != op->inode || dirty_it->first.stripe > pos)
{ {
new_len = dirty_it->first.stripe - pos; new_len = dirty_it->first.stripe - pos;
if (new_len > len) if (new_len > len)
@ -881,7 +881,6 @@ void cluster_client_t::slice_rw(cluster_op_t *op)
uint64_t end = (op->offset + op->len) > (stripe + pg_block_size) uint64_t end = (op->offset + op->len) > (stripe + pg_block_size)
? (stripe + pg_block_size) : (op->offset + op->len); ? (stripe + pg_block_size) : (op->offset + op->len);
op->parts[i].iov.reset(); op->parts[i].iov.reset();
op->parts[i].flags = 0;
if (op->cur_inode != op->inode) if (op->cur_inode != op->inode)
{ {
// Read remaining parts from upper layers // Read remaining parts from upper layers
@ -919,10 +918,7 @@ void cluster_client_t::slice_rw(cluster_op_t *op)
else else
add_iov(cur-prev, skip_prev, op, iov_idx, iov_pos, op->parts[i].iov, scrap_buffer, scrap_buffer_size); add_iov(cur-prev, skip_prev, op, iov_idx, iov_pos, op->parts[i].iov, scrap_buffer, scrap_buffer_size);
if (end == begin) if (end == begin)
{
op->done_count++; op->done_count++;
op->parts[i].flags = PART_DONE;
}
} }
else if (op->opcode != OSD_OP_READ_BITMAP && op->opcode != OSD_OP_READ_CHAIN_BITMAP && op->opcode != OSD_OP_DELETE) else if (op->opcode != OSD_OP_READ_BITMAP && op->opcode != OSD_OP_READ_CHAIN_BITMAP && op->opcode != OSD_OP_DELETE)
{ {
@ -934,6 +930,7 @@ void cluster_client_t::slice_rw(cluster_op_t *op)
op->opcode == OSD_OP_DELETE ? 0 : (uint32_t)(end - begin); op->opcode == OSD_OP_DELETE ? 0 : (uint32_t)(end - begin);
op->parts[i].pg_num = pg_num; op->parts[i].pg_num = pg_num;
op->parts[i].osd_num = 0; op->parts[i].osd_num = 0;
op->parts[i].flags = 0;
i++; i++;
} }
} }

View File

@ -585,11 +585,7 @@ static int coroutine_fn vitastor_co_truncate(BlockDriverState *bs, int64_t offse
} }
// TODO: Resize inode to <offset> bytes // TODO: Resize inode to <offset> bytes
#if QEMU_VERSION_MAJOR >= 4 client->size = offset / BDRV_SECTOR_SIZE;
client->size = exact || client->size < offset ? offset : client->size;
#else
client->size = offset;
#endif
return 0; return 0;
} }