Rename osd_op_t.op to req

This commit is contained in:
Vitaliy Filippov
2020-02-23 23:21:17 +03:00
parent 72a89be912
commit 4a52a15564
8 changed files with 111 additions and 111 deletions
+42 -42
View File
@@ -21,46 +21,46 @@ void osd_t::secondary_op_callback(osd_op_t *cur_op)
void osd_t::exec_secondary(osd_op_t *cur_op)
{
cur_op->bs_op.callback = [this, cur_op](blockstore_op_t* bs_op) { secondary_op_callback(cur_op); };
cur_op->bs_op.opcode = (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_READ ? BS_OP_READ
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_WRITE ? BS_OP_WRITE
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_SYNC ? BS_OP_SYNC
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ? BS_OP_STABLE
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK ? BS_OP_ROLLBACK
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_DELETE ? BS_OP_DELETE
: (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_LIST ? BS_OP_LIST
cur_op->bs_op.opcode = (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ ? BS_OP_READ
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE ? BS_OP_WRITE
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_SYNC ? BS_OP_SYNC
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ? BS_OP_STABLE
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK ? BS_OP_ROLLBACK
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE ? BS_OP_DELETE
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_LIST ? BS_OP_LIST
: -1)))))));
if (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_READ ||
cur_op->op.hdr.opcode == OSD_OP_SECONDARY_WRITE)
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
{
cur_op->bs_op.oid = cur_op->op.sec_rw.oid;
cur_op->bs_op.version = cur_op->op.sec_rw.version;
cur_op->bs_op.offset = cur_op->op.sec_rw.offset;
cur_op->bs_op.len = cur_op->op.sec_rw.len;
cur_op->bs_op.oid = cur_op->req.sec_rw.oid;
cur_op->bs_op.version = cur_op->req.sec_rw.version;
cur_op->bs_op.offset = cur_op->req.sec_rw.offset;
cur_op->bs_op.len = cur_op->req.sec_rw.len;
cur_op->bs_op.buf = cur_op->buf;
}
else if (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_DELETE)
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE)
{
cur_op->bs_op.oid = cur_op->op.sec_del.oid;
cur_op->bs_op.version = cur_op->op.sec_del.version;
cur_op->bs_op.oid = cur_op->req.sec_del.oid;
cur_op->bs_op.version = cur_op->req.sec_del.version;
}
else if (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
cur_op->op.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK)
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK)
{
cur_op->bs_op.len = cur_op->op.sec_stab.len/sizeof(obj_ver_id);
cur_op->bs_op.len = cur_op->req.sec_stab.len/sizeof(obj_ver_id);
cur_op->bs_op.buf = cur_op->buf;
}
else if (cur_op->op.hdr.opcode == OSD_OP_SECONDARY_LIST)
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_LIST)
{
if (cur_op->op.sec_list.pg_count < cur_op->op.sec_list.list_pg)
if (cur_op->req.sec_list.pg_count < cur_op->req.sec_list.list_pg)
{
// requested pg number is greater than total pg count
cur_op->bs_op.retval = -EINVAL;
secondary_op_callback(cur_op);
return;
}
cur_op->bs_op.oid.stripe = cur_op->op.sec_list.parity_block_size;
cur_op->bs_op.len = cur_op->op.sec_list.pg_count;
cur_op->bs_op.offset = cur_op->op.sec_list.list_pg - 1;
cur_op->bs_op.oid.stripe = cur_op->req.sec_list.parity_block_size;
cur_op->bs_op.len = cur_op->req.sec_list.pg_count;
cur_op->bs_op.offset = cur_op->req.sec_list.list_pg - 1;
}
#ifdef OSD_STUB
cur_op->bs_op.retval = cur_op->bs_op.len;
@@ -92,15 +92,15 @@ void osd_t::exec_sync_stab_all(osd_op_t *cur_op)
return;
}
cur_op->bs_op.opcode = BS_OP_SYNC;
cur_op->bs_op.callback = [this, cur_op](blockstore_op_t *op)
cur_op->bs_op.callback = [this, cur_op](blockstore_op_t *bs_op)
{
auto & unstable_writes = bs->get_unstable_writes();
if (op->retval >= 0 && unstable_writes.size() > 0)
if (bs_op->retval >= 0 && unstable_writes.size() > 0)
{
op->opcode = BS_OP_STABLE;
op->len = unstable_writes.size();
obj_ver_id *vers = new obj_ver_id[op->len];
op->buf = vers;
bs_op->opcode = BS_OP_STABLE;
bs_op->len = unstable_writes.size();
obj_ver_id *vers = new obj_ver_id[bs_op->len];
bs_op->buf = vers;
int i = 0;
for (auto it = unstable_writes.begin(); it != unstable_writes.end(); it++, i++)
{
@@ -110,13 +110,13 @@ void osd_t::exec_sync_stab_all(osd_op_t *cur_op)
};
}
unstable_writes.clear();
op->callback = [this, cur_op](blockstore_op_t *op)
bs_op->callback = [this, cur_op](blockstore_op_t *bs_op)
{
secondary_op_callback(cur_op);
obj_ver_id *vers = (obj_ver_id*)op->buf;
obj_ver_id *vers = (obj_ver_id*)bs_op->buf;
delete[] vers;
};
bs->enqueue_op(op);
bs->enqueue_op(bs_op);
}
else
{
@@ -134,9 +134,9 @@ void osd_t::exec_sync_stab_all(osd_op_t *cur_op)
void osd_t::make_reply(osd_op_t *op)
{
op->reply.hdr.magic = SECONDARY_OSD_REPLY_MAGIC;
op->reply.hdr.id = op->op.hdr.id;
op->reply.hdr.opcode = op->op.hdr.opcode;
if (op->op.hdr.opcode == OSD_OP_SHOW_CONFIG)
op->reply.hdr.id = op->req.hdr.id;
op->reply.hdr.opcode = op->req.hdr.opcode;
if (op->req.hdr.opcode == OSD_OP_SHOW_CONFIG)
{
std::string *str = (std::string*)op->buf;
op->reply.hdr.retval = str->size()+1;
@@ -145,20 +145,20 @@ void osd_t::make_reply(osd_op_t *op)
else
{
op->reply.hdr.retval = op->bs_op.retval;
if (op->op.hdr.opcode == OSD_OP_SECONDARY_LIST)
if (op->req.hdr.opcode == OSD_OP_SECONDARY_LIST)
op->reply.sec_list.stable_count = op->bs_op.version;
else if (op->op.hdr.opcode == OSD_OP_SECONDARY_READ ||
op->op.hdr.opcode == OSD_OP_SECONDARY_WRITE)
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
op->reply.sec_rw.version = op->bs_op.version;
else if (op->op.hdr.opcode == OSD_OP_SECONDARY_DELETE)
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE)
op->reply.sec_del.version = op->bs_op.version;
}
if (op->op.hdr.opcode == OSD_OP_SECONDARY_READ &&
if (op->req.hdr.opcode == OSD_OP_SECONDARY_READ &&
op->reply.hdr.retval > 0)
{
op->send_list.push_back(op->buf, op->reply.hdr.retval);
}
else if (op->op.hdr.opcode == OSD_OP_SECONDARY_LIST &&
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_LIST &&
op->reply.hdr.retval > 0)
{
op->buf = op->bs_op.buf; // allocated by blockstore