Compare commits

..

No commits in common. "aa79d1db1c24cd07ec28a722100737ca8491effe" and "4cf6dceed730fa628cf3cdf1c2ec053a7f82ddea" have entirely different histories.

4 changed files with 13 additions and 30 deletions

View File

@ -32,7 +32,7 @@ void blockstore_init_meta::handle_event(ring_data_t *data, int buf_num)
if (data->res < 0)
{
throw std::runtime_error(
std::string("read metadata failed at offset ") + std::to_string(buf_num >= 0 ? bufs[buf_num].offset : last_read_offset) +
std::string("read metadata failed at offset ") + std::to_string(bufs[buf_num].offset) +
std::string(": ") + strerror(-data->res)
);
}
@ -63,7 +63,6 @@ int blockstore_init_meta::loop()
throw std::runtime_error("Failed to allocate metadata read buffer");
// Read superblock
GET_SQE();
last_read_offset = 0;
data->iov = { metadata_buffer, (size_t)bs->dsk.meta_block_size };
data->callback = [this](ring_data_t *data) { handle_event(data, -1); };
my_uring_prep_readv(sqe, bs->dsk.meta_fd, &data->iov, 1, bs->dsk.meta_offset);
@ -101,7 +100,6 @@ resume_1:
{
printf("Initializing metadata area\n");
GET_SQE();
last_read_offset = 0;
data->iov = (struct iovec){ metadata_buffer, (size_t)bs->dsk.meta_block_size };
data->callback = [this](ring_data_t *data) { handle_event(data, -1); };
my_uring_prep_writev(sqe, bs->dsk.meta_fd, &data->iov, 1, bs->dsk.meta_offset);
@ -261,11 +259,9 @@ resume_2:
next_offset = entries_to_zero[i]/entries_per_block;
for (j = i; j < entries_to_zero.size() && entries_to_zero[j]/entries_per_block == next_offset; j++) {}
GET_SQE();
last_read_offset = (1+next_offset)*bs->dsk.meta_block_size;
data->iov = { metadata_buffer, (size_t)bs->dsk.meta_block_size };
data->callback = [this](ring_data_t *data) { handle_event(data, -1); };
my_uring_prep_readv(sqe, bs->dsk.meta_fd, &data->iov, 1, bs->dsk.meta_offset + (1+next_offset)*bs->dsk.meta_block_size);
bs->ringloop->submit();
submitted++;
resume_5:
if (submitted > 0)
@ -282,7 +278,6 @@ resume_5:
data->iov = { metadata_buffer, (size_t)bs->dsk.meta_block_size };
data->callback = [this](ring_data_t *data) { handle_event(data, -1); };
my_uring_prep_writev(sqe, bs->dsk.meta_fd, &data->iov, 1, bs->dsk.meta_offset + (1+next_offset)*bs->dsk.meta_block_size);
bs->ringloop->submit();
submitted++;
resume_6:
if (submitted > 0)
@ -304,7 +299,6 @@ resume_6:
{
GET_SQE();
my_uring_prep_fsync(sqe, bs->dsk.meta_fd, IORING_FSYNC_DATASYNC);
last_read_offset = 0;
data->iov = { 0 };
data->callback = [this](ring_data_t *data) { handle_event(data, -1); };
submitted++;

View File

@ -23,7 +23,6 @@ class blockstore_init_meta
struct ring_data_t *data;
uint64_t md_offset = 0;
uint64_t next_offset = 0;
uint64_t last_read_offset = 0;
uint64_t entries_loaded = 0;
unsigned entries_per_block = 0;
int i = 0, j = 0;

View File

@ -64,6 +64,10 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
(new_cfg["parity_chunks"].uint64_value() > 1 ? 1 : 0);
}
}
if (new_cfg["scheme"] != "ec")
{
new_cfg.erase("parity_chunks");
}
// Check integer values and unknown keys
for (auto kv_it = new_cfg.begin(); kv_it != new_cfg.end(); )
@ -114,12 +118,6 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
}
}
// Check after merging
if (new_cfg["scheme"] != "ec")
{
new_cfg.erase("parity_chunks");
}
// Prevent autovivification of object keys. Now we don't modify the config, we just check it
json11::Json cfg = new_cfg;

View File

@ -238,8 +238,7 @@ void cluster_client_t::erase_op(cluster_op_t *op)
// which may continue following SYNCs, but these SYNCs
// should know about the changed buffer state
// This is ugly but this is the way we do it
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
}
if (!(flags & OP_IMMEDIATE_COMMIT) || enable_writeback)
{
@ -249,8 +248,7 @@ void cluster_client_t::erase_op(cluster_op_t *op)
{
// Call callback at the end to avoid inconsistencies in prev_wait
// if the callback adds more operations itself
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
}
if (flags & OP_FLUSH_BUFFER)
{
@ -550,8 +548,7 @@ void cluster_client_t::execute(cluster_op_t *op)
op->opcode != OSD_OP_READ_BITMAP && op->opcode != OSD_OP_READ_CHAIN_BITMAP && op->opcode != OSD_OP_WRITE)
{
op->retval = -EINVAL;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return;
}
if (!pgs_loaded)
@ -589,8 +586,7 @@ void cluster_client_t::execute_internal(cluster_op_t *op)
wb->start_writebacks(this, 1);
}
op->retval = op->len;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return;
}
if (op->opcode == OSD_OP_WRITE && !(op->flags & OP_IMMEDIATE_COMMIT))
@ -659,8 +655,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
if (!pool_id)
{
op->retval = -EINVAL;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return false;
}
auto pool_it = st_cli.pool_config.find(pool_id);
@ -668,8 +663,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
{
// Pools are loaded, but this one is unknown
op->retval = -EINVAL;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return false;
}
// Check alignment
@ -677,8 +671,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
op->offset % pool_it->second.bitmap_granularity || op->len % pool_it->second.bitmap_granularity)
{
op->retval = -EINVAL;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return false;
}
if (pool_it->second.immediate_commit == IMMEDIATE_ALL)
@ -691,8 +684,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
if (ino_it != st_cli.inode_config.end() && ino_it->second.readonly)
{
op->retval = -EROFS;
auto cb = std::move(op->callback);
cb(op);
std::function<void(cluster_op_t*)>(op->callback)(op);
return false;
}
}