diff --git a/src/client/messenger.h b/src/client/messenger.h index 8c43552e..e296b7e1 100644 --- a/src/client/messenger.h +++ b/src/client/messenger.h @@ -167,7 +167,8 @@ protected: bool use_rdma = true; std::vector osd_networks; 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; uint64_t rdma_max_sge = 0, rdma_max_send = 0, rdma_max_recv = 0; uint64_t rdma_max_msg = 0; diff --git a/src/client/msgr_rdma.cpp b/src/client/msgr_rdma.cpp index 5195e16b..6feeeef8 100644 --- a/src/client/msgr_rdma.cpp +++ b/src/client/msgr_rdma.cpp @@ -201,7 +201,7 @@ cleanup: } #endif -msgr_rdma_context_t *msgr_rdma_context_t::create(std::vector 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 osd_networks, const char *ib_devname, uint8_t ib_port, int gid_index, uint32_t mtu, bool odp, int log_level) { int res; 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]; uint32_t len = (uint32_t)(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 -= len; rc->send_buf_pos += len; diff --git a/src/client/msgr_rdma.h b/src/client/msgr_rdma.h index 4818982a..cfa3cdf7 100644 --- a/src/client/msgr_rdma.h +++ b/src/client/msgr_rdma.h @@ -36,7 +36,7 @@ struct msgr_rdma_context_t int max_cqe = 0; int used_max_cqe = 0; - static msgr_rdma_context_t *create(std::vector 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 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(); }; diff --git a/src/cmd/cli_dd.cpp b/src/cmd/cli_dd.cpp index 6583eac3..ca7aa0f6 100644 --- a/src/cmd/cli_dd.cpp +++ b/src/cmd/cli_dd.cpp @@ -324,7 +324,7 @@ resume_2: cluster_op_t *sync_op = new cluster_op_t; sync_op->opcode = OSD_OP_SYNC; parent->waiting++; - sync_op->callback = [this, parent](cluster_op_t *sync_op) + sync_op->callback = [parent](cluster_op_t *sync_op) { parent->waiting--; delete sync_op; @@ -539,7 +539,7 @@ struct cli_dd_t in_eof = true; } 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); in_waiting++; data->callback = [this, cur_read](ring_data_t *data) @@ -672,7 +672,7 @@ struct cli_dd_t return false; } 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); out_waiting++; data->callback = [this, cur_read](ring_data_t *data) diff --git a/src/kv/kv_cli.cpp b/src/kv/kv_cli.cpp index ab4d3c91..fcfca5f3 100644 --- a/src/kv/kv_cli.cpp +++ b/src/kv/kv_cli.cpp @@ -546,7 +546,7 @@ void kv_cli_t::handle_cmd(const std::vector & cmd, std::functionget(key, [this, cb](int res, const std::string & value) + db->get(key, [cb](int res, const std::string & value) { if (res < 0) fprintf(stderr, "Error: %s (code %d)\n", strerror(-res), res); diff --git a/src/kv/kv_db.cpp b/src/kv/kv_db.cpp index 57af47ad..8583ec10 100644 --- a/src/kv/kv_db.cpp +++ b/src/kv/kv_db.cpp @@ -1448,7 +1448,7 @@ void kv_op_t::update() 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); if (res == -EAGAIN) diff --git a/src/nfs/nfs_kv.cpp b/src/nfs/nfs_kv.cpp index 791ec2b1..44e4b155 100644 --- a/src/nfs/nfs_kv.cpp +++ b/src/nfs/nfs_kv.cpp @@ -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) { int max = 32+strlen(prefix); - char key[max] = { 0 }; + char key[max]; snprintf(key, max, "%s%x", prefix, INODE_POOL(ino)); int n = strnlen(key, max-1); snprintf(key+n+1, max-n-1, "%jx", INODE_NO_POOL(ino)); diff --git a/src/nfs/nfs_kv_create.cpp b/src/nfs/nfs_kv_create.cpp index c1a87a37..c4602d62 100644 --- a/src/nfs/nfs_kv_create.cpp +++ b/src/nfs/nfs_kv_create.cpp @@ -147,7 +147,7 @@ resume_2: { st->res = res; kv_continue_create(st, 3); - }, [st](int res, const std::string & value) + }, [](int res, const std::string & value) { return res == -ENOENT; }); diff --git a/src/nfs/nfs_kv_defrag.cpp b/src/nfs/nfs_kv_defrag.cpp index d049dd6f..5912acd8 100644 --- a/src/nfs/nfs_kv_defrag.cpp +++ b/src/nfs/nfs_kv_defrag.cpp @@ -81,12 +81,12 @@ void kv_fs_defrag_t::read() empty = true; 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; } 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; } buf_pos = 0; diff --git a/src/nfs/nfs_kv_link.cpp b/src/nfs/nfs_kv_link.cpp index a44eb68e..93690951 100644 --- a/src/nfs/nfs_kv_link.cpp +++ b/src/nfs/nfs_kv_link.cpp @@ -81,7 +81,7 @@ resume_1: { st->res = res; nfs_kv_continue_link(st, 2); - }, [st](int res, const std::string & old_value) + }, [](int res, const std::string & old_value) { return res == -ENOENT; }); diff --git a/src/nfs/nfs_kv_read.cpp b/src/nfs/nfs_kv_read.cpp index cf936ff9..16ee4d4e 100644 --- a/src/nfs/nfs_kv_read.cpp +++ b/src/nfs/nfs_kv_read.cpp @@ -107,7 +107,7 @@ resume_1: 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; delete op; diff --git a/src/nfs/nfs_kv_remove.cpp b/src/nfs/nfs_kv_remove.cpp index 17a2eee7..4344e16c 100644 --- a/src/nfs/nfs_kv_remove.cpp +++ b/src/nfs/nfs_kv_remove.cpp @@ -169,7 +169,7 @@ resume_4: { st->res2 = res; nfs_kv_continue_delete(st, 5); - }, [st](int res, const std::string & value) + }, [](int res, const std::string & value) { return res == -ENOENT; }); diff --git a/src/nfs/nfs_proxy_rdma.cpp b/src/nfs/nfs_proxy_rdma.cpp index 6b111e7b..2e07f1f0 100644 --- a/src/nfs/nfs_proxy_rdma.cpp +++ b/src/nfs/nfs_proxy_rdma.cpp @@ -520,7 +520,7 @@ void nfs_rdma_conn_t::rdma_encode_header(XDR *xdrs, rpc_op_t *rop, bool nomsg) else { // 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_reply = rop->in_rdma_msg.rdma_body.rdma_msg.rdma_reply, }; @@ -667,7 +667,7 @@ chunk_error: assert(hdr_iov_count > 0); 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; } assert(pos == hdr_size); @@ -675,7 +675,7 @@ chunk_error: } 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; } // 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 ? reply_chunk->target.target_val[i].length : msg_size-pos); sges[wr_pos] = { - .addr = (uintptr_t)(rop->buffer + pos), + .addr = (uintptr_t)((uint8_t*)rop->buffer + pos), .length = len, .lkey = buf_lkey, }; - wrs[wr_pos] = { + wrs[wr_pos] = (ibv_send_wr){ .wr_id = 4, // 4 is chunk write .opcode = IBV_WR_RDMA_WRITE, .wr = { @@ -718,7 +718,7 @@ chunk_error: .length = (uint32_t)chunk_iov->iov_len, .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 .opcode = IBV_WR_RDMA_WRITE, .wr = { @@ -736,7 +736,7 @@ chunk_error: .length = (uint32_t)(reply_chunk ? hdr_size : msg_size), .lkey = buf_lkey, }; - wrs[wr_pos] = { + wrs[wr_pos] = (ibv_send_wr){ .wr_id = 2, // 2 is send .opcode = remote_invalidate && !reply_chunk && wr_chunk ? IBV_WR_SEND_WITH_INV : IBV_WR_SEND, .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, .lkey = buf_lkey, }; - chunk_wr[i] = { + chunk_wr[i] = (ibv_send_wr){ .wr_id = 3, // 3 is chunk read .next = (i == read_chunk_count-1 ? NULL : &chunk_wr[i+1]), .sg_list = &chunk_sge[i],