Fix clang warnings/errors
This commit is contained in:
@@ -167,7 +167,8 @@ protected:
|
|||||||
bool use_rdma = true;
|
bool use_rdma = true;
|
||||||
std::vector<std::string> osd_networks;
|
std::vector<std::string> osd_networks;
|
||||||
std::string rdma_device;
|
std::string rdma_device;
|
||||||
uint64_t rdma_port_num = 1, rdma_gid_index = -1, rdma_mtu = 0;
|
uint64_t rdma_port_num = 1, rdma_mtu = 0;
|
||||||
|
int rdma_gid_index = -1;
|
||||||
msgr_rdma_context_t *rdma_context = NULL;
|
msgr_rdma_context_t *rdma_context = NULL;
|
||||||
uint64_t rdma_max_sge = 0, rdma_max_send = 0, rdma_max_recv = 0;
|
uint64_t rdma_max_sge = 0, rdma_max_send = 0, rdma_max_recv = 0;
|
||||||
uint64_t rdma_max_msg = 0;
|
uint64_t rdma_max_msg = 0;
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
msgr_rdma_context_t *msgr_rdma_context_t::create(std::vector<std::string> osd_networks, const char *ib_devname, uint8_t ib_port, uint8_t gid_index, uint32_t mtu, bool odp, int log_level)
|
msgr_rdma_context_t *msgr_rdma_context_t::create(std::vector<std::string> osd_networks, const char *ib_devname, uint8_t ib_port, int gid_index, uint32_t mtu, bool odp, int log_level)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
ibv_device **dev_list = NULL;
|
ibv_device **dev_list = NULL;
|
||||||
@@ -601,7 +601,7 @@ static int try_send_rdma_copy(osd_client_t *cl, uint8_t *dst, int dst_len)
|
|||||||
iovec & iov = cl->send_list[rc->send_pos];
|
iovec & iov = cl->send_list[rc->send_pos];
|
||||||
uint32_t len = (uint32_t)(iov.iov_len-rc->send_buf_pos < dst_len
|
uint32_t len = (uint32_t)(iov.iov_len-rc->send_buf_pos < dst_len
|
||||||
? iov.iov_len-rc->send_buf_pos : dst_len);
|
? iov.iov_len-rc->send_buf_pos : dst_len);
|
||||||
memcpy(dst, iov.iov_base+rc->send_buf_pos, len);
|
memcpy(dst, (uint8_t*)iov.iov_base+rc->send_buf_pos, len);
|
||||||
dst += len;
|
dst += len;
|
||||||
dst_len -= len;
|
dst_len -= len;
|
||||||
rc->send_buf_pos += len;
|
rc->send_buf_pos += len;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ struct msgr_rdma_context_t
|
|||||||
int max_cqe = 0;
|
int max_cqe = 0;
|
||||||
int used_max_cqe = 0;
|
int used_max_cqe = 0;
|
||||||
|
|
||||||
static msgr_rdma_context_t *create(std::vector<std::string> osd_networks, const char *ib_devname, uint8_t ib_port, uint8_t gid_index, uint32_t mtu, bool odp, int log_level);
|
static msgr_rdma_context_t *create(std::vector<std::string> osd_networks, const char *ib_devname, uint8_t ib_port, int gid_index, uint32_t mtu, bool odp, int log_level);
|
||||||
~msgr_rdma_context_t();
|
~msgr_rdma_context_t();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -324,7 +324,7 @@ resume_2:
|
|||||||
cluster_op_t *sync_op = new cluster_op_t;
|
cluster_op_t *sync_op = new cluster_op_t;
|
||||||
sync_op->opcode = OSD_OP_SYNC;
|
sync_op->opcode = OSD_OP_SYNC;
|
||||||
parent->waiting++;
|
parent->waiting++;
|
||||||
sync_op->callback = [this, parent](cluster_op_t *sync_op)
|
sync_op->callback = [parent](cluster_op_t *sync_op)
|
||||||
{
|
{
|
||||||
parent->waiting--;
|
parent->waiting--;
|
||||||
delete sync_op;
|
delete sync_op;
|
||||||
@@ -539,7 +539,7 @@ struct cli_dd_t
|
|||||||
in_eof = true;
|
in_eof = true;
|
||||||
}
|
}
|
||||||
ring_data_t *data = ((ring_data_t*)sqe->user_data);
|
ring_data_t *data = ((ring_data_t*)sqe->user_data);
|
||||||
data->iov = (iovec){ cur_read->buf + cur_read->len, cur_read->max - cur_read->len };
|
data->iov = (iovec){ (uint8_t*)cur_read->buf + cur_read->len, cur_read->max - cur_read->len };
|
||||||
my_uring_prep_readv(sqe, iinfo.ifd, &data->iov, 1, iinfo.in_seekable ? iseek + cur_read->offset + cur_read->len : -1);
|
my_uring_prep_readv(sqe, iinfo.ifd, &data->iov, 1, iinfo.in_seekable ? iseek + cur_read->offset + cur_read->len : -1);
|
||||||
in_waiting++;
|
in_waiting++;
|
||||||
data->callback = [this, cur_read](ring_data_t *data)
|
data->callback = [this, cur_read](ring_data_t *data)
|
||||||
@@ -672,7 +672,7 @@ struct cli_dd_t
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ring_data_t *data = ((ring_data_t*)sqe->user_data);
|
ring_data_t *data = ((ring_data_t*)sqe->user_data);
|
||||||
data->iov = (iovec){ .iov_base = cur_read->buf+cur_read->len, .iov_len = cur_read->max-cur_read->len };
|
data->iov = (iovec){ .iov_base = (uint8_t*)cur_read->buf+cur_read->len, .iov_len = cur_read->max-cur_read->len };
|
||||||
my_uring_prep_writev(sqe, oinfo.ofd, &data->iov, 1, oinfo.out_seekable ? cur_read->offset+cur_read->len+oseek : -1);
|
my_uring_prep_writev(sqe, oinfo.ofd, &data->iov, 1, oinfo.out_seekable ? cur_read->offset+cur_read->len+oseek : -1);
|
||||||
out_waiting++;
|
out_waiting++;
|
||||||
data->callback = [this, cur_read](ring_data_t *data)
|
data->callback = [this, cur_read](ring_data_t *data)
|
||||||
|
|||||||
+1
-1
@@ -546,7 +546,7 @@ void kv_cli_t::handle_cmd(const std::vector<std::string> & cmd, std::function<vo
|
|||||||
auto & key = cmd[1];
|
auto & key = cmd[1];
|
||||||
if (opname == "get")
|
if (opname == "get")
|
||||||
{
|
{
|
||||||
db->get(key, [this, cb](int res, const std::string & value)
|
db->get(key, [cb](int res, const std::string & value)
|
||||||
{
|
{
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
fprintf(stderr, "Error: %s (code %d)\n", strerror(-res), res);
|
fprintf(stderr, "Error: %s (code %d)\n", strerror(-res), res);
|
||||||
|
|||||||
+1
-1
@@ -1448,7 +1448,7 @@ void kv_op_t::update()
|
|||||||
|
|
||||||
void kv_op_t::update_find()
|
void kv_op_t::update_find()
|
||||||
{
|
{
|
||||||
get_block(db, cur_block, cur_level, recheck_policy, [=, checked_block = cur_block](int res, int refresh)
|
get_block(db, cur_block, cur_level, recheck_policy, [=](int res, int refresh)
|
||||||
{
|
{
|
||||||
res = handle_block(res, refresh, true);
|
res = handle_block(res, refresh, true);
|
||||||
if (res == -EAGAIN)
|
if (res == -EAGAIN)
|
||||||
|
|||||||
+1
-1
@@ -119,7 +119,7 @@ std::string kv_direntry_filename(const std::string & key)
|
|||||||
std::string kv_inode_prefix_key(uint64_t ino, const char *prefix)
|
std::string kv_inode_prefix_key(uint64_t ino, const char *prefix)
|
||||||
{
|
{
|
||||||
int max = 32+strlen(prefix);
|
int max = 32+strlen(prefix);
|
||||||
char key[max] = { 0 };
|
char key[max];
|
||||||
snprintf(key, max, "%s%x", prefix, INODE_POOL(ino));
|
snprintf(key, max, "%s%x", prefix, INODE_POOL(ino));
|
||||||
int n = strnlen(key, max-1);
|
int n = strnlen(key, max-1);
|
||||||
snprintf(key+n+1, max-n-1, "%jx", INODE_NO_POOL(ino));
|
snprintf(key+n+1, max-n-1, "%jx", INODE_NO_POOL(ino));
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ resume_2:
|
|||||||
{
|
{
|
||||||
st->res = res;
|
st->res = res;
|
||||||
kv_continue_create(st, 3);
|
kv_continue_create(st, 3);
|
||||||
}, [st](int res, const std::string & value)
|
}, [](int res, const std::string & value)
|
||||||
{
|
{
|
||||||
return res == -ENOENT;
|
return res == -ENOENT;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -81,12 +81,12 @@ void kv_fs_defrag_t::read()
|
|||||||
empty = true;
|
empty = true;
|
||||||
for (; bitmap_pos < bitmap_size; bitmap_pos += 8)
|
for (; bitmap_pos < bitmap_size; bitmap_pos += 8)
|
||||||
{
|
{
|
||||||
if (*((uint64_t*)(op->bitmap_buf + bitmap_pos)))
|
if (*((uint64_t*)((uint8_t*)op->bitmap_buf + bitmap_pos)))
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
for (; bitmap_pos < bitmap_size; bitmap_pos++)
|
for (; bitmap_pos < bitmap_size; bitmap_pos++)
|
||||||
{
|
{
|
||||||
if (*((uint8_t*)(op->bitmap_buf + bitmap_pos)))
|
if (*((uint8_t*)((uint8_t*)op->bitmap_buf + bitmap_pos)))
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
buf_pos = 0;
|
buf_pos = 0;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ resume_1:
|
|||||||
{
|
{
|
||||||
st->res = res;
|
st->res = res;
|
||||||
nfs_kv_continue_link(st, 2);
|
nfs_kv_continue_link(st, 2);
|
||||||
}, [st](int res, const std::string & old_value)
|
}, [](int res, const std::string & old_value)
|
||||||
{
|
{
|
||||||
return res == -ENOENT;
|
return res == -ENOENT;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ resume_1:
|
|||||||
st->op->offset+st->op->len - (read_offset+read_size));
|
st->op->offset+st->op->len - (read_offset+read_size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
st->op->callback = [st, state](cluster_op_t *op)
|
st->op->callback = [st](cluster_op_t *op)
|
||||||
{
|
{
|
||||||
st->res = op->retval == op->len ? 0 : op->retval;
|
st->res = op->retval == op->len ? 0 : op->retval;
|
||||||
delete op;
|
delete op;
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ resume_4:
|
|||||||
{
|
{
|
||||||
st->res2 = res;
|
st->res2 = res;
|
||||||
nfs_kv_continue_delete(st, 5);
|
nfs_kv_continue_delete(st, 5);
|
||||||
}, [st](int res, const std::string & value)
|
}, [](int res, const std::string & value)
|
||||||
{
|
{
|
||||||
return res == -ENOENT;
|
return res == -ENOENT;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ void nfs_rdma_conn_t::rdma_encode_header(XDR *xdrs, rpc_op_t *rop, bool nomsg)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Copy chunks... it's a real shit
|
// Copy chunks... it's a real shit
|
||||||
outrmsg.rdma_body.rdma_msg = {
|
outrmsg.rdma_body.rdma_msg = (rpc_rdma_header){
|
||||||
.rdma_writes = rop->in_rdma_msg.rdma_body.rdma_msg.rdma_writes,
|
.rdma_writes = rop->in_rdma_msg.rdma_body.rdma_msg.rdma_writes,
|
||||||
.rdma_reply = rop->in_rdma_msg.rdma_body.rdma_msg.rdma_reply,
|
.rdma_reply = rop->in_rdma_msg.rdma_body.rdma_msg.rdma_reply,
|
||||||
};
|
};
|
||||||
@@ -667,7 +667,7 @@ chunk_error:
|
|||||||
assert(hdr_iov_count > 0);
|
assert(hdr_iov_count > 0);
|
||||||
for (unsigned i = 0; i < hdr_iov_count; i++)
|
for (unsigned i = 0; i < hdr_iov_count; i++)
|
||||||
{
|
{
|
||||||
memcpy(rop->buffer + pos, hdr_iov_list[i].iov_base, hdr_iov_list[i].iov_len);
|
memcpy((uint8_t*)rop->buffer + pos, hdr_iov_list[i].iov_base, hdr_iov_list[i].iov_len);
|
||||||
pos += hdr_iov_list[i].iov_len;
|
pos += hdr_iov_list[i].iov_len;
|
||||||
}
|
}
|
||||||
assert(pos == hdr_size);
|
assert(pos == hdr_size);
|
||||||
@@ -675,7 +675,7 @@ chunk_error:
|
|||||||
}
|
}
|
||||||
for (unsigned i = 0; i < iov_count; i++)
|
for (unsigned i = 0; i < iov_count; i++)
|
||||||
{
|
{
|
||||||
memcpy(rop->buffer + pos, iov_list[i].iov_base, iov_list[i].iov_len);
|
memcpy((uint8_t*)rop->buffer + pos, iov_list[i].iov_base, iov_list[i].iov_len);
|
||||||
pos += iov_list[i].iov_len;
|
pos += iov_list[i].iov_len;
|
||||||
}
|
}
|
||||||
// Include header size in msg_size now and then
|
// Include header size in msg_size now and then
|
||||||
@@ -690,11 +690,11 @@ chunk_error:
|
|||||||
uint32_t len = (reply_chunk->target.target_val[i].length < msg_size-pos
|
uint32_t len = (reply_chunk->target.target_val[i].length < msg_size-pos
|
||||||
? reply_chunk->target.target_val[i].length : msg_size-pos);
|
? reply_chunk->target.target_val[i].length : msg_size-pos);
|
||||||
sges[wr_pos] = {
|
sges[wr_pos] = {
|
||||||
.addr = (uintptr_t)(rop->buffer + pos),
|
.addr = (uintptr_t)((uint8_t*)rop->buffer + pos),
|
||||||
.length = len,
|
.length = len,
|
||||||
.lkey = buf_lkey,
|
.lkey = buf_lkey,
|
||||||
};
|
};
|
||||||
wrs[wr_pos] = {
|
wrs[wr_pos] = (ibv_send_wr){
|
||||||
.wr_id = 4, // 4 is chunk write
|
.wr_id = 4, // 4 is chunk write
|
||||||
.opcode = IBV_WR_RDMA_WRITE,
|
.opcode = IBV_WR_RDMA_WRITE,
|
||||||
.wr = {
|
.wr = {
|
||||||
@@ -718,7 +718,7 @@ chunk_error:
|
|||||||
.length = (uint32_t)chunk_iov->iov_len,
|
.length = (uint32_t)chunk_iov->iov_len,
|
||||||
.lkey = rdma_malloc_get_lkey(conn_dev->alloc, chunk_iov->iov_base),
|
.lkey = rdma_malloc_get_lkey(conn_dev->alloc, chunk_iov->iov_base),
|
||||||
};
|
};
|
||||||
wrs[wr_pos] = {
|
wrs[wr_pos] = (ibv_send_wr){
|
||||||
.wr_id = 4, // 4 is chunk write
|
.wr_id = 4, // 4 is chunk write
|
||||||
.opcode = IBV_WR_RDMA_WRITE,
|
.opcode = IBV_WR_RDMA_WRITE,
|
||||||
.wr = {
|
.wr = {
|
||||||
@@ -736,7 +736,7 @@ chunk_error:
|
|||||||
.length = (uint32_t)(reply_chunk ? hdr_size : msg_size),
|
.length = (uint32_t)(reply_chunk ? hdr_size : msg_size),
|
||||||
.lkey = buf_lkey,
|
.lkey = buf_lkey,
|
||||||
};
|
};
|
||||||
wrs[wr_pos] = {
|
wrs[wr_pos] = (ibv_send_wr){
|
||||||
.wr_id = 2, // 2 is send
|
.wr_id = 2, // 2 is send
|
||||||
.opcode = remote_invalidate && !reply_chunk && wr_chunk ? IBV_WR_SEND_WITH_INV : IBV_WR_SEND,
|
.opcode = remote_invalidate && !reply_chunk && wr_chunk ? IBV_WR_SEND_WITH_INV : IBV_WR_SEND,
|
||||||
.send_flags = IBV_SEND_SIGNALED,
|
.send_flags = IBV_SEND_SIGNALED,
|
||||||
@@ -1021,7 +1021,7 @@ int nfs_rdma_conn_t::post_chunk_reads(rpc_op_t *rop, bool push)
|
|||||||
.length = cur->entry.target.length,
|
.length = cur->entry.target.length,
|
||||||
.lkey = buf_lkey,
|
.lkey = buf_lkey,
|
||||||
};
|
};
|
||||||
chunk_wr[i] = {
|
chunk_wr[i] = (ibv_send_wr){
|
||||||
.wr_id = 3, // 3 is chunk read
|
.wr_id = 3, // 3 is chunk read
|
||||||
.next = (i == read_chunk_count-1 ? NULL : &chunk_wr[i+1]),
|
.next = (i == read_chunk_count-1 ? NULL : &chunk_wr[i+1]),
|
||||||
.sg_list = &chunk_sge[i],
|
.sg_list = &chunk_sge[i],
|
||||||
|
|||||||
Reference in New Issue
Block a user