forked from vitalif/vitastor
Rename OSD_OP_SECONDARY_* to OSD_OP_SEC_*
parent
a86788fe3b
commit
2e8c69fc5b
|
@ -205,7 +205,7 @@ static enum fio_q_status sec_queue(struct thread_data *td, struct io_u *io)
|
||||||
case DDIR_READ:
|
case DDIR_READ:
|
||||||
if (!opt->single_primary)
|
if (!opt->single_primary)
|
||||||
{
|
{
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_READ;
|
op.hdr.opcode = OSD_OP_SEC_READ;
|
||||||
op.sec_rw.oid = {
|
op.sec_rw.oid = {
|
||||||
.inode = 1,
|
.inode = 1,
|
||||||
.stripe = io->offset >> bsd->block_order,
|
.stripe = io->offset >> bsd->block_order,
|
||||||
|
@ -226,7 +226,7 @@ static enum fio_q_status sec_queue(struct thread_data *td, struct io_u *io)
|
||||||
case DDIR_WRITE:
|
case DDIR_WRITE:
|
||||||
if (!opt->single_primary)
|
if (!opt->single_primary)
|
||||||
{
|
{
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_WRITE;
|
op.hdr.opcode = OSD_OP_SEC_WRITE;
|
||||||
op.sec_rw.oid = {
|
op.sec_rw.oid = {
|
||||||
.inode = 1,
|
.inode = 1,
|
||||||
.stripe = io->offset >> bsd->block_order,
|
.stripe = io->offset >> bsd->block_order,
|
||||||
|
|
|
@ -180,20 +180,20 @@ bool osd_messenger_t::handle_finished_read(osd_client_t & cl)
|
||||||
void osd_messenger_t::handle_op_hdr(osd_client_t *cl)
|
void osd_messenger_t::handle_op_hdr(osd_client_t *cl)
|
||||||
{
|
{
|
||||||
osd_op_t *cur_op = cl->read_op;
|
osd_op_t *cur_op = cl->read_op;
|
||||||
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ)
|
if (cur_op->req.hdr.opcode == OSD_OP_SEC_READ)
|
||||||
{
|
{
|
||||||
if (cur_op->req.sec_rw.len > 0)
|
if (cur_op->req.sec_rw.len > 0)
|
||||||
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_rw.len);
|
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_rw.len);
|
||||||
cl->read_remaining = 0;
|
cl->read_remaining = 0;
|
||||||
}
|
}
|
||||||
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
if (cur_op->req.sec_rw.len > 0)
|
if (cur_op->req.sec_rw.len > 0)
|
||||||
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_rw.len);
|
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_rw.len);
|
||||||
cl->read_remaining = cur_op->req.sec_rw.len;
|
cl->read_remaining = cur_op->req.sec_rw.len;
|
||||||
}
|
}
|
||||||
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_STABILIZE ||
|
||||||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK)
|
cur_op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK)
|
||||||
{
|
{
|
||||||
if (cur_op->req.sec_stab.len > 0)
|
if (cur_op->req.sec_stab.len > 0)
|
||||||
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_stab.len);
|
cur_op->buf = memalign(MEM_ALIGNMENT, cur_op->req.sec_stab.len);
|
||||||
|
@ -240,7 +240,7 @@ bool osd_messenger_t::handle_reply_hdr(osd_client_t *cl)
|
||||||
osd_op_t *op = req_it->second;
|
osd_op_t *op = req_it->second;
|
||||||
memcpy(op->reply.buf, cl->read_op->req.buf, OSD_PACKET_SIZE);
|
memcpy(op->reply.buf, cl->read_op->req.buf, OSD_PACKET_SIZE);
|
||||||
cl->sent_ops.erase(req_it);
|
cl->sent_ops.erase(req_it);
|
||||||
if ((op->reply.hdr.opcode == OSD_OP_SECONDARY_READ || op->reply.hdr.opcode == OSD_OP_READ) &&
|
if ((op->reply.hdr.opcode == OSD_OP_SEC_READ || op->reply.hdr.opcode == OSD_OP_READ) &&
|
||||||
op->reply.hdr.retval > 0)
|
op->reply.hdr.retval > 0)
|
||||||
{
|
{
|
||||||
// Read data. In this case we assume that the buffer is preallocated by the caller (!)
|
// Read data. In this case we assume that the buffer is preallocated by the caller (!)
|
||||||
|
@ -251,7 +251,7 @@ bool osd_messenger_t::handle_reply_hdr(osd_client_t *cl)
|
||||||
cl->read_state = CL_READ_REPLY_DATA;
|
cl->read_state = CL_READ_REPLY_DATA;
|
||||||
cl->read_remaining = op->reply.hdr.retval;
|
cl->read_remaining = op->reply.hdr.retval;
|
||||||
}
|
}
|
||||||
else if (op->reply.hdr.opcode == OSD_OP_SECONDARY_LIST && op->reply.hdr.retval > 0)
|
else if (op->reply.hdr.opcode == OSD_OP_SEC_LIST && op->reply.hdr.retval > 0)
|
||||||
{
|
{
|
||||||
assert(!op->iov.count);
|
assert(!op->iov.count);
|
||||||
delete cl->read_op;
|
delete cl->read_op;
|
||||||
|
|
|
@ -76,15 +76,15 @@ bool osd_messenger_t::try_send(osd_client_t & cl)
|
||||||
{
|
{
|
||||||
stats.op_stat_bytes[cl.write_op->req.hdr.opcode] += cl.write_op->req.rw.len;
|
stats.op_stat_bytes[cl.write_op->req.hdr.opcode] += cl.write_op->req.rw.len;
|
||||||
}
|
}
|
||||||
else if (cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
|
else if (cl.write_op->req.hdr.opcode == OSD_OP_SEC_READ ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
stats.op_stat_bytes[cl.write_op->req.hdr.opcode] += cl.write_op->req.sec_rw.len;
|
stats.op_stat_bytes[cl.write_op->req.hdr.opcode] += cl.write_op->req.sec_rw.len;
|
||||||
}
|
}
|
||||||
cl.send_list.push_back(cl.write_op->reply.buf, OSD_PACKET_SIZE);
|
cl.send_list.push_back(cl.write_op->reply.buf, OSD_PACKET_SIZE);
|
||||||
if (cl.write_op->req.hdr.opcode == OSD_OP_READ ||
|
if (cl.write_op->req.hdr.opcode == OSD_OP_READ ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_READ ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_LIST ||
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_LIST ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SHOW_CONFIG)
|
cl.write_op->req.hdr.opcode == OSD_OP_SHOW_CONFIG)
|
||||||
{
|
{
|
||||||
cl.send_list.append(cl.write_op->iov);
|
cl.send_list.append(cl.write_op->iov);
|
||||||
|
@ -94,9 +94,9 @@ bool osd_messenger_t::try_send(osd_client_t & cl)
|
||||||
{
|
{
|
||||||
cl.send_list.push_back(cl.write_op->req.buf, OSD_PACKET_SIZE);
|
cl.send_list.push_back(cl.write_op->req.buf, OSD_PACKET_SIZE);
|
||||||
if (cl.write_op->req.hdr.opcode == OSD_OP_WRITE ||
|
if (cl.write_op->req.hdr.opcode == OSD_OP_WRITE ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE ||
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_WRITE ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_STABILIZE ||
|
||||||
cl.write_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK)
|
cl.write_op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK)
|
||||||
{
|
{
|
||||||
cl.send_list.append(cl.write_op->iov);
|
cl.send_list.append(cl.write_op->iov);
|
||||||
}
|
}
|
||||||
|
|
6
osd.cpp
6
osd.cpp
|
@ -205,7 +205,7 @@ void osd_t::exec_op(osd_op_t *cur_op)
|
||||||
inflight_ops++;
|
inflight_ops++;
|
||||||
if (cur_op->req.hdr.magic != SECONDARY_OSD_OP_MAGIC ||
|
if (cur_op->req.hdr.magic != SECONDARY_OSD_OP_MAGIC ||
|
||||||
cur_op->req.hdr.opcode < OSD_OP_MIN || cur_op->req.hdr.opcode > OSD_OP_MAX ||
|
cur_op->req.hdr.opcode < OSD_OP_MIN || cur_op->req.hdr.opcode > OSD_OP_MAX ||
|
||||||
(cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ || cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE) &&
|
(cur_op->req.hdr.opcode == OSD_OP_SEC_READ || cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE) &&
|
||||||
(cur_op->req.sec_rw.len > OSD_RW_MAX || cur_op->req.sec_rw.len % bs_disk_alignment || cur_op->req.sec_rw.offset % bs_disk_alignment) ||
|
(cur_op->req.sec_rw.len > OSD_RW_MAX || cur_op->req.sec_rw.len % bs_disk_alignment || cur_op->req.sec_rw.offset % bs_disk_alignment) ||
|
||||||
(cur_op->req.hdr.opcode == OSD_OP_READ || cur_op->req.hdr.opcode == OSD_OP_WRITE || cur_op->req.hdr.opcode == OSD_OP_DELETE) &&
|
(cur_op->req.hdr.opcode == OSD_OP_READ || cur_op->req.hdr.opcode == OSD_OP_WRITE || cur_op->req.hdr.opcode == OSD_OP_DELETE) &&
|
||||||
(cur_op->req.rw.len > OSD_RW_MAX || cur_op->req.rw.len % bs_disk_alignment || cur_op->req.rw.offset % bs_disk_alignment))
|
(cur_op->req.rw.len > OSD_RW_MAX || cur_op->req.rw.len % bs_disk_alignment || cur_op->req.rw.offset % bs_disk_alignment))
|
||||||
|
@ -215,8 +215,8 @@ void osd_t::exec_op(osd_op_t *cur_op)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (readonly &&
|
if (readonly &&
|
||||||
cur_op->req.hdr.opcode != OSD_OP_SECONDARY_READ &&
|
cur_op->req.hdr.opcode != OSD_OP_SEC_READ &&
|
||||||
cur_op->req.hdr.opcode != OSD_OP_SECONDARY_LIST &&
|
cur_op->req.hdr.opcode != OSD_OP_SEC_LIST &&
|
||||||
cur_op->req.hdr.opcode != OSD_OP_READ &&
|
cur_op->req.hdr.opcode != OSD_OP_READ &&
|
||||||
cur_op->req.hdr.opcode != OSD_OP_SHOW_CONFIG)
|
cur_op->req.hdr.opcode != OSD_OP_SHOW_CONFIG)
|
||||||
{
|
{
|
||||||
|
|
|
@ -190,14 +190,14 @@ void osd_t::submit_flush_op(pg_num_t pg_num, pg_flush_batch_t *fb, bool rollback
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = (uint64_t)(rollback ? OSD_OP_SECONDARY_ROLLBACK : OSD_OP_SECONDARY_STABILIZE),
|
.opcode = (uint64_t)(rollback ? OSD_OP_SEC_ROLLBACK : OSD_OP_SEC_STABILIZE),
|
||||||
},
|
},
|
||||||
.len = count * sizeof(obj_ver_id),
|
.len = count * sizeof(obj_ver_id),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
op->callback = [this, pg_num, fb, peer_osd](osd_op_t *op)
|
op->callback = [this, pg_num, fb, peer_osd](osd_op_t *op)
|
||||||
{
|
{
|
||||||
handle_flush_op(op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK, pg_num, fb, peer_osd, op->reply.hdr.retval);
|
handle_flush_op(op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK, pg_num, fb, peer_osd, op->reply.hdr.retval);
|
||||||
delete op;
|
delete op;
|
||||||
};
|
};
|
||||||
c_cli.outbox_push(op);
|
c_cli.outbox_push(op);
|
||||||
|
|
14
osd_ops.h
14
osd_ops.h
|
@ -10,14 +10,14 @@
|
||||||
#define OSD_PACKET_SIZE 0x80
|
#define OSD_PACKET_SIZE 0x80
|
||||||
// Opcodes
|
// Opcodes
|
||||||
#define OSD_OP_MIN 1
|
#define OSD_OP_MIN 1
|
||||||
#define OSD_OP_SECONDARY_READ 1
|
#define OSD_OP_SEC_READ 1
|
||||||
#define OSD_OP_SECONDARY_WRITE 2
|
#define OSD_OP_SEC_WRITE 2
|
||||||
#define OSD_OP_SECONDARY_SYNC 3
|
#define OSD_OP_SEC_SYNC 3
|
||||||
#define OSD_OP_SECONDARY_STABILIZE 4
|
#define OSD_OP_SEC_STABILIZE 4
|
||||||
#define OSD_OP_SECONDARY_ROLLBACK 5
|
#define OSD_OP_SEC_ROLLBACK 5
|
||||||
#define OSD_OP_SECONDARY_DELETE 6
|
#define OSD_OP_SEC_DELETE 6
|
||||||
#define OSD_OP_TEST_SYNC_STAB_ALL 7
|
#define OSD_OP_TEST_SYNC_STAB_ALL 7
|
||||||
#define OSD_OP_SECONDARY_LIST 8
|
#define OSD_OP_SEC_LIST 8
|
||||||
#define OSD_OP_SHOW_CONFIG 9
|
#define OSD_OP_SHOW_CONFIG 9
|
||||||
#define OSD_OP_READ 10
|
#define OSD_OP_READ 10
|
||||||
#define OSD_OP_WRITE 11
|
#define OSD_OP_WRITE 11
|
||||||
|
|
|
@ -309,7 +309,7 @@ void osd_t::submit_sync_and_list_subop(osd_num_t role_osd, pg_peering_state_t *p
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = OSD_OP_SECONDARY_SYNC,
|
.opcode = OSD_OP_SEC_SYNC,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -382,7 +382,7 @@ void osd_t::submit_list_subop(osd_num_t role_osd, pg_peering_state_t *ps)
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = OSD_OP_SECONDARY_LIST,
|
.opcode = OSD_OP_SEC_LIST,
|
||||||
},
|
},
|
||||||
.list_pg = ps->pg_num,
|
.list_pg = ps->pg_num,
|
||||||
.pg_count = pg_count,
|
.pg_count = pg_count,
|
||||||
|
|
|
@ -154,7 +154,7 @@ void osd_t::submit_primary_subops(int submit_type, uint64_t op_version, int pg_s
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = (uint64_t)(w ? OSD_OP_SECONDARY_WRITE : OSD_OP_SECONDARY_READ),
|
.opcode = (uint64_t)(w ? OSD_OP_SEC_WRITE : OSD_OP_SEC_READ),
|
||||||
},
|
},
|
||||||
.oid = {
|
.oid = {
|
||||||
.inode = op_data->oid.inode,
|
.inode = op_data->oid.inode,
|
||||||
|
@ -187,7 +187,7 @@ void osd_t::submit_primary_subops(int submit_type, uint64_t op_version, int pg_s
|
||||||
}
|
}
|
||||||
subops[i].callback = [cur_op, this](osd_op_t *subop)
|
subops[i].callback = [cur_op, this](osd_op_t *subop)
|
||||||
{
|
{
|
||||||
int fail_fd = subop->req.hdr.opcode == OSD_OP_SECONDARY_WRITE &&
|
int fail_fd = subop->req.hdr.opcode == OSD_OP_SEC_WRITE &&
|
||||||
subop->reply.hdr.retval != subop->req.sec_rw.len ? subop->peer_fd : -1;
|
subop->reply.hdr.retval != subop->req.sec_rw.len ? subop->peer_fd : -1;
|
||||||
handle_primary_subop(subop, cur_op);
|
handle_primary_subop(subop, cur_op);
|
||||||
if (fail_fd >= 0)
|
if (fail_fd >= 0)
|
||||||
|
@ -205,13 +205,13 @@ void osd_t::submit_primary_subops(int submit_type, uint64_t op_version, int pg_s
|
||||||
|
|
||||||
static uint64_t bs_op_to_osd_op[] = {
|
static uint64_t bs_op_to_osd_op[] = {
|
||||||
0,
|
0,
|
||||||
OSD_OP_SECONDARY_READ, // BS_OP_READ
|
OSD_OP_SEC_READ, // BS_OP_READ
|
||||||
OSD_OP_SECONDARY_WRITE, // BS_OP_WRITE
|
OSD_OP_SEC_WRITE, // BS_OP_WRITE
|
||||||
OSD_OP_SECONDARY_SYNC, // BS_OP_SYNC
|
OSD_OP_SEC_SYNC, // BS_OP_SYNC
|
||||||
OSD_OP_SECONDARY_STABILIZE, // BS_OP_STABLE
|
OSD_OP_SEC_STABILIZE, // BS_OP_STABLE
|
||||||
OSD_OP_SECONDARY_DELETE, // BS_OP_DELETE
|
OSD_OP_SEC_DELETE, // BS_OP_DELETE
|
||||||
OSD_OP_SECONDARY_LIST, // BS_OP_LIST
|
OSD_OP_SEC_LIST, // BS_OP_LIST
|
||||||
OSD_OP_SECONDARY_ROLLBACK, // BS_OP_ROLLBACK
|
OSD_OP_SEC_ROLLBACK, // BS_OP_ROLLBACK
|
||||||
OSD_OP_TEST_SYNC_STAB_ALL, // BS_OP_SYNC_STAB_ALL
|
OSD_OP_TEST_SYNC_STAB_ALL, // BS_OP_SYNC_STAB_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ void osd_t::add_bs_subop_stats(osd_op_t *subop)
|
||||||
(tv_end.tv_sec - subop->tv_begin.tv_sec)*1000000 +
|
(tv_end.tv_sec - subop->tv_begin.tv_sec)*1000000 +
|
||||||
(tv_end.tv_nsec - subop->tv_begin.tv_nsec)/1000
|
(tv_end.tv_nsec - subop->tv_begin.tv_nsec)/1000
|
||||||
);
|
);
|
||||||
if (opcode == OSD_OP_SECONDARY_READ || opcode == OSD_OP_SECONDARY_WRITE)
|
if (opcode == OSD_OP_SEC_READ || opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
c_cli.stats.op_stat_bytes[opcode] += subop->bs_op->len;
|
c_cli.stats.op_stat_bytes[opcode] += subop->bs_op->len;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void osd_t::handle_primary_subop(osd_op_t *subop, osd_op_t *cur_op)
|
||||||
{
|
{
|
||||||
uint64_t opcode = subop->req.hdr.opcode;
|
uint64_t opcode = subop->req.hdr.opcode;
|
||||||
int retval = subop->reply.hdr.retval;
|
int retval = subop->reply.hdr.retval;
|
||||||
int expected = opcode == OSD_OP_SECONDARY_READ || opcode == OSD_OP_SECONDARY_WRITE
|
int expected = opcode == OSD_OP_SEC_READ || opcode == OSD_OP_SEC_WRITE
|
||||||
? subop->req.sec_rw.len : 0;
|
? subop->req.sec_rw.len : 0;
|
||||||
osd_primary_op_data_t *op_data = cur_op->op_data;
|
osd_primary_op_data_t *op_data = cur_op->op_data;
|
||||||
if (retval != expected)
|
if (retval != expected)
|
||||||
|
@ -283,7 +283,7 @@ void osd_t::handle_primary_subop(osd_op_t *subop, osd_op_t *cur_op)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
op_data->done++;
|
op_data->done++;
|
||||||
if (opcode == OSD_OP_SECONDARY_READ || opcode == OSD_OP_SECONDARY_WRITE)
|
if (opcode == OSD_OP_SEC_READ || opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
uint64_t version = subop->reply.sec_rw.version;
|
uint64_t version = subop->reply.sec_rw.version;
|
||||||
#ifdef OSD_DEBUG
|
#ifdef OSD_DEBUG
|
||||||
|
@ -397,7 +397,7 @@ void osd_t::submit_primary_del_subops(osd_op_t *cur_op, uint64_t *cur_set, pg_os
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = OSD_OP_SECONDARY_DELETE,
|
.opcode = OSD_OP_SEC_DELETE,
|
||||||
},
|
},
|
||||||
.oid = {
|
.oid = {
|
||||||
.inode = op_data->oid.inode,
|
.inode = op_data->oid.inode,
|
||||||
|
@ -455,7 +455,7 @@ void osd_t::submit_primary_sync_subops(osd_op_t *cur_op)
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = OSD_OP_SECONDARY_SYNC,
|
.opcode = OSD_OP_SEC_SYNC,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
subops[i].callback = [cur_op, this](osd_op_t *subop)
|
subops[i].callback = [cur_op, this](osd_op_t *subop)
|
||||||
|
@ -507,7 +507,7 @@ void osd_t::submit_primary_stab_subops(osd_op_t *cur_op)
|
||||||
.header = {
|
.header = {
|
||||||
.magic = SECONDARY_OSD_OP_MAGIC,
|
.magic = SECONDARY_OSD_OP_MAGIC,
|
||||||
.id = c_cli.next_subop_id++,
|
.id = c_cli.next_subop_id++,
|
||||||
.opcode = OSD_OP_SECONDARY_STABILIZE,
|
.opcode = OSD_OP_SEC_STABILIZE,
|
||||||
},
|
},
|
||||||
.len = (uint64_t)(stab_osd.len * sizeof(obj_ver_id)),
|
.len = (uint64_t)(stab_osd.len * sizeof(obj_ver_id)),
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,21 +4,21 @@
|
||||||
|
|
||||||
void osd_t::secondary_op_callback(osd_op_t *op)
|
void osd_t::secondary_op_callback(osd_op_t *op)
|
||||||
{
|
{
|
||||||
if (op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
|
if (op->req.hdr.opcode == OSD_OP_SEC_READ ||
|
||||||
op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
op->req.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
op->reply.sec_rw.version = op->bs_op->version;
|
op->reply.sec_rw.version = op->bs_op->version;
|
||||||
}
|
}
|
||||||
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE)
|
else if (op->req.hdr.opcode == OSD_OP_SEC_DELETE)
|
||||||
{
|
{
|
||||||
op->reply.sec_del.version = op->bs_op->version;
|
op->reply.sec_del.version = op->bs_op->version;
|
||||||
}
|
}
|
||||||
if (op->req.hdr.opcode == OSD_OP_SECONDARY_READ &&
|
if (op->req.hdr.opcode == OSD_OP_SEC_READ &&
|
||||||
op->bs_op->retval > 0)
|
op->bs_op->retval > 0)
|
||||||
{
|
{
|
||||||
op->iov.push_back(op->buf, op->bs_op->retval);
|
op->iov.push_back(op->buf, op->bs_op->retval);
|
||||||
}
|
}
|
||||||
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_LIST)
|
else if (op->req.hdr.opcode == OSD_OP_SEC_LIST)
|
||||||
{
|
{
|
||||||
// allocated by blockstore
|
// allocated by blockstore
|
||||||
op->buf = op->bs_op->buf;
|
op->buf = op->bs_op->buf;
|
||||||
|
@ -38,16 +38,16 @@ void osd_t::exec_secondary(osd_op_t *cur_op)
|
||||||
{
|
{
|
||||||
cur_op->bs_op = new blockstore_op_t();
|
cur_op->bs_op = new blockstore_op_t();
|
||||||
cur_op->bs_op->callback = [this, cur_op](blockstore_op_t* bs_op) { secondary_op_callback(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->req.hdr.opcode == OSD_OP_SECONDARY_READ ? BS_OP_READ
|
cur_op->bs_op->opcode = (cur_op->req.hdr.opcode == OSD_OP_SEC_READ ? BS_OP_READ
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE ? BS_OP_WRITE
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE ? BS_OP_WRITE
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_SYNC ? BS_OP_SYNC
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_SYNC ? BS_OP_SYNC
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ? BS_OP_STABLE
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_STABILIZE ? BS_OP_STABLE
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK ? BS_OP_ROLLBACK
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK ? BS_OP_ROLLBACK
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE ? BS_OP_DELETE
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_DELETE ? BS_OP_DELETE
|
||||||
: (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_LIST ? BS_OP_LIST
|
: (cur_op->req.hdr.opcode == OSD_OP_SEC_LIST ? BS_OP_LIST
|
||||||
: -1)))))));
|
: -1)))))));
|
||||||
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ ||
|
if (cur_op->req.hdr.opcode == OSD_OP_SEC_READ ||
|
||||||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
cur_op->req.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
cur_op->bs_op->oid = cur_op->req.sec_rw.oid;
|
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->version = cur_op->req.sec_rw.version;
|
||||||
|
@ -58,7 +58,7 @@ void osd_t::exec_secondary(osd_op_t *cur_op)
|
||||||
cur_op->bs_op->retval = cur_op->bs_op->len;
|
cur_op->bs_op->retval = cur_op->bs_op->len;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_DELETE)
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_DELETE)
|
||||||
{
|
{
|
||||||
cur_op->bs_op->oid = cur_op->req.sec_del.oid;
|
cur_op->bs_op->oid = cur_op->req.sec_del.oid;
|
||||||
cur_op->bs_op->version = cur_op->req.sec_del.version;
|
cur_op->bs_op->version = cur_op->req.sec_del.version;
|
||||||
|
@ -66,8 +66,8 @@ void osd_t::exec_secondary(osd_op_t *cur_op)
|
||||||
cur_op->bs_op->retval = 0;
|
cur_op->bs_op->retval = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_STABILIZE ||
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_STABILIZE ||
|
||||||
cur_op->req.hdr.opcode == OSD_OP_SECONDARY_ROLLBACK)
|
cur_op->req.hdr.opcode == OSD_OP_SEC_ROLLBACK)
|
||||||
{
|
{
|
||||||
cur_op->bs_op->len = cur_op->req.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;
|
cur_op->bs_op->buf = cur_op->buf;
|
||||||
|
@ -75,7 +75,7 @@ void osd_t::exec_secondary(osd_op_t *cur_op)
|
||||||
cur_op->bs_op->retval = 0;
|
cur_op->bs_op->retval = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_LIST)
|
else if (cur_op->req.hdr.opcode == OSD_OP_SEC_LIST)
|
||||||
{
|
{
|
||||||
if (cur_op->req.sec_list.pg_count < cur_op->req.sec_list.list_pg)
|
if (cur_op->req.sec_list.pg_count < cur_op->req.sec_list.list_pg)
|
||||||
{
|
{
|
||||||
|
|
10
osd_test.cpp
10
osd_test.cpp
|
@ -184,7 +184,7 @@ uint64_t test_read(int connect_fd, uint64_t inode, uint64_t stripe, uint64_t ver
|
||||||
osd_any_reply_t reply;
|
osd_any_reply_t reply;
|
||||||
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
||||||
op.hdr.id = 1;
|
op.hdr.id = 1;
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_READ;
|
op.hdr.opcode = OSD_OP_SEC_READ;
|
||||||
op.sec_rw.oid = {
|
op.sec_rw.oid = {
|
||||||
.inode = inode,
|
.inode = inode,
|
||||||
.stripe = stripe,
|
.stripe = stripe,
|
||||||
|
@ -209,7 +209,7 @@ uint64_t test_read(int connect_fd, uint64_t inode, uint64_t stripe, uint64_t ver
|
||||||
}
|
}
|
||||||
free(data);
|
free(data);
|
||||||
printf("Read %lu:%lu v%lu = v%lu\n", inode, stripe, version, reply.sec_rw.version);
|
printf("Read %lu:%lu v%lu = v%lu\n", inode, stripe, version, reply.sec_rw.version);
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_LIST;
|
op.hdr.opcode = OSD_OP_SEC_LIST;
|
||||||
op.sec_list.list_pg = 1;
|
op.sec_list.list_pg = 1;
|
||||||
op.sec_list.pg_count = 1;
|
op.sec_list.pg_count = 1;
|
||||||
op.sec_list.pg_stripe_size = 4*1024*1024;
|
op.sec_list.pg_stripe_size = 4*1024*1024;
|
||||||
|
@ -244,7 +244,7 @@ uint64_t test_write(int connect_fd, uint64_t inode, uint64_t stripe, uint64_t ve
|
||||||
osd_any_reply_t reply;
|
osd_any_reply_t reply;
|
||||||
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
||||||
op.hdr.id = 1;
|
op.hdr.id = 1;
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_WRITE;
|
op.hdr.opcode = OSD_OP_SEC_WRITE;
|
||||||
op.sec_rw.oid = {
|
op.sec_rw.oid = {
|
||||||
.inode = inode,
|
.inode = inode,
|
||||||
.stripe = stripe,
|
.stripe = stripe,
|
||||||
|
@ -354,7 +354,7 @@ void test_list_stab(int connect_fd)
|
||||||
osd_any_reply_t reply;
|
osd_any_reply_t reply;
|
||||||
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
||||||
op.hdr.id = 1;
|
op.hdr.id = 1;
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_LIST;
|
op.hdr.opcode = OSD_OP_SEC_LIST;
|
||||||
op.sec_list.pg_count = 0;
|
op.sec_list.pg_count = 0;
|
||||||
assert(write_blocking(connect_fd, op.buf, OSD_PACKET_SIZE) == OSD_PACKET_SIZE);
|
assert(write_blocking(connect_fd, op.buf, OSD_PACKET_SIZE) == OSD_PACKET_SIZE);
|
||||||
int r = read_blocking(connect_fd, reply.buf, OSD_PACKET_SIZE);
|
int r = read_blocking(connect_fd, reply.buf, OSD_PACKET_SIZE);
|
||||||
|
@ -370,7 +370,7 @@ void test_list_stab(int connect_fd)
|
||||||
// Stabilize in portions of 32 entries
|
// Stabilize in portions of 32 entries
|
||||||
if (i - last_start >= 32 || i == total_count)
|
if (i - last_start >= 32 || i == total_count)
|
||||||
{
|
{
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_STABILIZE;
|
op.hdr.opcode = OSD_OP_SEC_STABILIZE;
|
||||||
op.sec_stab.len = sizeof(obj_ver_id) * (i - last_start);
|
op.sec_stab.len = sizeof(obj_ver_id) * (i - last_start);
|
||||||
assert(write_blocking(connect_fd, op.buf, OSD_PACKET_SIZE) == OSD_PACKET_SIZE);
|
assert(write_blocking(connect_fd, op.buf, OSD_PACKET_SIZE) == OSD_PACKET_SIZE);
|
||||||
assert(write_blocking(connect_fd, data + last_start, op.sec_stab.len) == op.sec_stab.len);
|
assert(write_blocking(connect_fd, data + last_start, op.sec_stab.len) == op.sec_stab.len);
|
||||||
|
|
|
@ -123,7 +123,7 @@ void run_bench(int peer_fd)
|
||||||
// read
|
// read
|
||||||
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
||||||
op.hdr.id = 1;
|
op.hdr.id = 1;
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_READ;
|
op.hdr.opcode = OSD_OP_SEC_READ;
|
||||||
op.sec_rw.oid.inode = 3;
|
op.sec_rw.oid.inode = 3;
|
||||||
op.sec_rw.oid.stripe = (rand() << 17) % (1 << 29); // 512 MB
|
op.sec_rw.oid.stripe = (rand() << 17) % (1 << 29); // 512 MB
|
||||||
op.sec_rw.version = 0;
|
op.sec_rw.version = 0;
|
||||||
|
@ -149,7 +149,7 @@ void run_bench(int peer_fd)
|
||||||
// write
|
// write
|
||||||
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
op.hdr.magic = SECONDARY_OSD_OP_MAGIC;
|
||||||
op.hdr.id = 1;
|
op.hdr.id = 1;
|
||||||
op.hdr.opcode = OSD_OP_SECONDARY_WRITE;
|
op.hdr.opcode = OSD_OP_SEC_WRITE;
|
||||||
op.sec_rw.oid.inode = 3;
|
op.sec_rw.oid.inode = 3;
|
||||||
op.sec_rw.oid.stripe = (rand() << 17) % (1 << 29); // 512 MB
|
op.sec_rw.oid.stripe = (rand() << 17) % (1 << 29); // 512 MB
|
||||||
op.sec_rw.version = 0;
|
op.sec_rw.version = 0;
|
||||||
|
|
|
@ -130,7 +130,7 @@ void run_stub(int peer_fd)
|
||||||
reply.hdr.magic = SECONDARY_OSD_REPLY_MAGIC;
|
reply.hdr.magic = SECONDARY_OSD_REPLY_MAGIC;
|
||||||
reply.hdr.id = op.hdr.id;
|
reply.hdr.id = op.hdr.id;
|
||||||
reply.hdr.opcode = op.hdr.opcode;
|
reply.hdr.opcode = op.hdr.opcode;
|
||||||
if (op.hdr.opcode == OSD_OP_SECONDARY_READ)
|
if (op.hdr.opcode == OSD_OP_SEC_READ)
|
||||||
{
|
{
|
||||||
reply.hdr.retval = op.sec_rw.len;
|
reply.hdr.retval = op.sec_rw.len;
|
||||||
buf = malloc(op.sec_rw.len);
|
buf = malloc(op.sec_rw.len);
|
||||||
|
@ -141,7 +141,7 @@ void run_stub(int peer_fd)
|
||||||
if (r < op.sec_rw.len)
|
if (r < op.sec_rw.len)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (op.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
else if (op.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
buf = malloc(op.sec_rw.len);
|
buf = malloc(op.sec_rw.len);
|
||||||
r = read_blocking(peer_fd, buf, op.sec_rw.len);
|
r = read_blocking(peer_fd, buf, op.sec_rw.len);
|
||||||
|
|
|
@ -105,13 +105,13 @@ void stub_exec_op(osd_messenger_t *msgr, osd_op_t *op)
|
||||||
op->reply.hdr.magic = SECONDARY_OSD_REPLY_MAGIC;
|
op->reply.hdr.magic = SECONDARY_OSD_REPLY_MAGIC;
|
||||||
op->reply.hdr.id = op->req.hdr.id;
|
op->reply.hdr.id = op->req.hdr.id;
|
||||||
op->reply.hdr.opcode = op->req.hdr.opcode;
|
op->reply.hdr.opcode = op->req.hdr.opcode;
|
||||||
if (op->req.hdr.opcode == OSD_OP_SECONDARY_READ)
|
if (op->req.hdr.opcode == OSD_OP_SEC_READ)
|
||||||
{
|
{
|
||||||
op->reply.hdr.retval = op->req.sec_rw.len;
|
op->reply.hdr.retval = op->req.sec_rw.len;
|
||||||
op->buf = malloc(op->req.sec_rw.len);
|
op->buf = malloc(op->req.sec_rw.len);
|
||||||
op->iov.push_back(op->buf, op->req.sec_rw.len);
|
op->iov.push_back(op->buf, op->req.sec_rw.len);
|
||||||
}
|
}
|
||||||
else if (op->req.hdr.opcode == OSD_OP_SECONDARY_WRITE)
|
else if (op->req.hdr.opcode == OSD_OP_SEC_WRITE)
|
||||||
{
|
{
|
||||||
op->reply.hdr.retval = op->req.sec_rw.len;
|
op->reply.hdr.retval = op->req.sec_rw.len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue