From ea78bbd26ae5fde2ba473c82e4e800612481247b Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Mon, 18 Nov 2024 08:35:45 -0500 Subject: [PATCH] DAOS-16209 pool: return mem file size on pool query Return the mem file size for phase2 pool on pool query. This patch bumped DAOS_POOL_VERSION from 6 to 7, and dropped version 5 support. Required-githooks: true Signed-off-by: Niu Yawei --- src/include/daos_pool.h | 24 ++ src/pool/cli.c | 10 +- src/pool/rpc.c | 68 ++--- src/pool/rpc.h | 601 +++++++++++++++------------------------- src/pool/srv.c | 19 +- src/pool/srv_internal.h | 66 ++--- src/pool/srv_pool.c | 273 +++++++++--------- src/pool/srv_target.c | 97 ++++++- src/vos/vos_layout.h | 4 +- src/vos/vos_pool.c | 5 + src/vos/vos_space.c | 6 + 11 files changed, 534 insertions(+), 639 deletions(-) diff --git a/src/include/daos_pool.h b/src/include/daos_pool.h index 73f44368913..ecd56b7e028 100644 --- a/src/include/daos_pool.h +++ b/src/include/daos_pool.h @@ -70,6 +70,15 @@ struct daos_space { uint64_t s_total[DAOS_MEDIA_MAX]; /** Free space in bytes */ uint64_t s_free[DAOS_MEDIA_MAX]; + /** Memory file size (in bytes) for md-on-ssd phase2 pool */ + uint64_t s_total_mem; +}; + +struct daos_space_v6 { + /** Total space in bytes */ + uint64_t s_total[DAOS_MEDIA_MAX]; + /** Free space in bytes */ + uint64_t s_free[DAOS_MEDIA_MAX]; }; /** Target information */ @@ -100,6 +109,21 @@ struct daos_pool_space { uint32_t ps_padding; }; +struct daos_pool_space_v6 { + /** Aggregated space for all live targets */ + struct daos_space_v6 ps_space; + /** Min target free space in bytes */ + uint64_t ps_free_min[DAOS_MEDIA_MAX]; + /** Max target free space in bytes */ + uint64_t ps_free_max[DAOS_MEDIA_MAX]; + /** Average target free space in bytes */ + uint64_t ps_free_mean[DAOS_MEDIA_MAX]; + /** Target(VOS) count */ + uint32_t ps_ntargets; + /** padding - not used */ + uint32_t ps_padding; +}; + enum daos_rebuild_state_t { DRS_IN_PROGRESS = 0, DRS_NOT_STARTED = 1, diff --git a/src/pool/cli.c b/src/pool/cli.c index 6825f57568f..94e26e47f5d 100644 --- a/src/pool/cli.c +++ b/src/pool/cli.c @@ -205,15 +205,15 @@ dc_pool_init(void) daos_register_key(&dc_pool_module_key); dc_pool_proto_version = 0; - rc = daos_rpc_proto_query(pool_proto_fmt_v5.cpf_base, ver_array, 2, &dc_pool_proto_version); + rc = daos_rpc_proto_query(pool_proto_fmt_v6.cpf_base, ver_array, 2, &dc_pool_proto_version); if (rc) return rc; if (dc_pool_proto_version == DAOS_POOL_VERSION - 1) { - rc = daos_rpc_register(&pool_proto_fmt_v5, POOL_PROTO_CLI_COUNT, NULL, + rc = daos_rpc_register(&pool_proto_fmt_v6, POOL_PROTO_CLI_COUNT, NULL, DAOS_POOL_MODULE); } else if (dc_pool_proto_version == DAOS_POOL_VERSION) { - rc = daos_rpc_register(&pool_proto_fmt_v6, POOL_PROTO_CLI_COUNT, NULL, + rc = daos_rpc_register(&pool_proto_fmt_v7, POOL_PROTO_CLI_COUNT, NULL, DAOS_POOL_MODULE); } else { D_ERROR("%d version pool RPC not supported.\n", dc_pool_proto_version); @@ -236,9 +236,9 @@ dc_pool_fini(void) int rc; if (dc_pool_proto_version == DAOS_POOL_VERSION - 1) { - rc = daos_rpc_unregister(&pool_proto_fmt_v5); - } else if (dc_pool_proto_version == DAOS_POOL_VERSION) { rc = daos_rpc_unregister(&pool_proto_fmt_v6); + } else if (dc_pool_proto_version == DAOS_POOL_VERSION) { + rc = daos_rpc_unregister(&pool_proto_fmt_v7); } else { rc = -DER_PROTO; DL_ERROR(rc, "%d version pool RPC not supported", dc_pool_proto_version); diff --git a/src/pool/rpc.c b/src/pool/rpc.c index bcf1fbdd75e..e6faf37ee8d 100644 --- a/src/pool/rpc.c +++ b/src/pool/rpc.c @@ -65,7 +65,6 @@ crt_proc_struct_rsvc_hint(crt_proc_t proc, crt_proc_op_t proc_op, } CRT_RPC_DEFINE(pool_op, DAOS_ISEQ_POOL_OP, DAOS_OSEQ_POOL_OP) -CRT_RPC_DEFINE(pool_op_v6, DAOS_ISEQ_POOL_OP_V6, DAOS_OSEQ_POOL_OP) static int crt_proc_struct_pool_op_in(crt_proc_t proc, crt_proc_op_t proc_op, @@ -81,60 +80,41 @@ crt_proc_struct_pool_op_out(crt_proc_t proc, crt_proc_op_t proc_op, return crt_proc_pool_op_out(proc, data); } -static int -crt_proc_struct_pool_op_v6_in(crt_proc_t proc, crt_proc_op_t proc_op, struct pool_op_v6_in *data) -{ - return crt_proc_pool_op_v6_in(proc, data); -} - CRT_RPC_DEFINE(pool_create, DAOS_ISEQ_POOL_CREATE, DAOS_OSEQ_POOL_CREATE) -CRT_RPC_DEFINE(pool_connect_v6, DAOS_ISEQ_POOL_CONNECT_V6, DAOS_OSEQ_POOL_CONNECT) +CRT_RPC_DEFINE(pool_connect_v6, DAOS_ISEQ_POOL_CONNECT, DAOS_OSEQ_POOL_CONNECT_V6) CRT_RPC_DEFINE(pool_connect, DAOS_ISEQ_POOL_CONNECT, DAOS_OSEQ_POOL_CONNECT) -CRT_RPC_DEFINE(pool_disconnect_v6, DAOS_ISEQ_POOL_DISCONNECT_V6, DAOS_OSEQ_POOL_DISCONNECT) CRT_RPC_DEFINE(pool_disconnect, DAOS_ISEQ_POOL_DISCONNECT, DAOS_OSEQ_POOL_DISCONNECT) -CRT_RPC_DEFINE(pool_query_v6, DAOS_ISEQ_POOL_QUERY_V6, DAOS_OSEQ_POOL_QUERY) +CRT_RPC_DEFINE(pool_query_v6, DAOS_ISEQ_POOL_QUERY, DAOS_OSEQ_POOL_QUERY_V6) CRT_RPC_DEFINE(pool_query, DAOS_ISEQ_POOL_QUERY, DAOS_OSEQ_POOL_QUERY) -CRT_RPC_DEFINE(pool_attr_list_v6, DAOS_ISEQ_POOL_ATTR_LIST_V6, DAOS_OSEQ_POOL_ATTR_LIST) CRT_RPC_DEFINE(pool_attr_list, DAOS_ISEQ_POOL_ATTR_LIST, DAOS_OSEQ_POOL_ATTR_LIST) -CRT_RPC_DEFINE(pool_attr_get_v6, DAOS_ISEQ_POOL_ATTR_GET_V6, DAOS_OSEQ_POOL_OP) CRT_RPC_DEFINE(pool_attr_get, DAOS_ISEQ_POOL_ATTR_GET, DAOS_OSEQ_POOL_OP) -CRT_RPC_DEFINE(pool_attr_set_v6, DAOS_ISEQ_POOL_ATTR_SET_V6, DAOS_OSEQ_POOL_OP) CRT_RPC_DEFINE(pool_attr_set, DAOS_ISEQ_POOL_ATTR_SET, DAOS_OSEQ_POOL_OP) -CRT_RPC_DEFINE(pool_attr_del_v6, DAOS_ISEQ_POOL_ATTR_DEL_V6, DAOS_OSEQ_POOL_OP) CRT_RPC_DEFINE(pool_attr_del, DAOS_ISEQ_POOL_ATTR_DEL, DAOS_OSEQ_POOL_OP) CRT_RPC_DEFINE(pool_replicas_add, DAOS_ISEQ_POOL_MEMBERSHIP, DAOS_OSEQ_POOL_MEMBERSHIP) CRT_RPC_DEFINE(pool_replicas_remove, DAOS_ISEQ_POOL_MEMBERSHIP, DAOS_OSEQ_POOL_MEMBERSHIP) -CRT_RPC_DEFINE(pool_extend, DAOS_ISEQ_POOL_EXTEND_V6, DAOS_OSEQ_POOL_EXTEND) -CRT_RPC_DEFINE(pool_add_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) +CRT_RPC_DEFINE(pool_extend, DAOS_ISEQ_POOL_EXTEND, DAOS_OSEQ_POOL_EXTEND) CRT_RPC_DEFINE(pool_add, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DEFINE(pool_add_in_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DEFINE(pool_add_in, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DEFINE(pool_exclude_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DEFINE(pool_exclude, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DEFINE(pool_drain_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DEFINE(pool_drain, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DEFINE(pool_exclude_out_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DEFINE(pool_exclude_out, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DEFINE(pool_evict, DAOS_ISEQ_POOL_EVICT_V6, DAOS_OSEQ_POOL_EVICT) -CRT_RPC_DEFINE(pool_svc_stop_v6, DAOS_ISEQ_POOL_SVC_STOP_V6, DAOS_OSEQ_POOL_SVC_STOP) +CRT_RPC_DEFINE(pool_evict, DAOS_ISEQ_POOL_EVICT, DAOS_OSEQ_POOL_EVICT) CRT_RPC_DEFINE(pool_svc_stop, DAOS_ISEQ_POOL_SVC_STOP, DAOS_OSEQ_POOL_SVC_STOP) CRT_RPC_DEFINE(pool_tgt_disconnect, DAOS_ISEQ_POOL_TGT_DISCONNECT, DAOS_OSEQ_POOL_TGT_DISCONNECT) -CRT_RPC_DEFINE(pool_tgt_query, DAOS_ISEQ_POOL_TGT_QUERY, - DAOS_OSEQ_POOL_TGT_QUERY) +CRT_RPC_DEFINE(pool_tgt_query_v6, DAOS_ISEQ_POOL_TGT_QUERY, DAOS_OSEQ_POOL_TGT_QUERY_V6) +CRT_RPC_DEFINE(pool_tgt_query, DAOS_ISEQ_POOL_TGT_QUERY, DAOS_OSEQ_POOL_TGT_QUERY) CRT_RPC_DEFINE(pool_tgt_dist_hdls, DAOS_ISEQ_POOL_TGT_DIST_HDLS, DAOS_OSEQ_POOL_TGT_DIST_HDLS) -/* NB: prop_get/set, and acl_update/delete, upgrade use V6 input. single version engine<->engine */ -CRT_RPC_DEFINE(pool_prop_get, DAOS_ISEQ_POOL_PROP_GET_V6, DAOS_OSEQ_POOL_PROP_GET) -CRT_RPC_DEFINE(pool_prop_set, DAOS_ISEQ_POOL_PROP_SET_V6, DAOS_OSEQ_POOL_PROP_SET) -CRT_RPC_DEFINE(pool_acl_update, DAOS_ISEQ_POOL_ACL_UPDATE_V6, DAOS_OSEQ_POOL_ACL_UPDATE) -CRT_RPC_DEFINE(pool_acl_delete, DAOS_ISEQ_POOL_ACL_DELETE_V6, DAOS_OSEQ_POOL_ACL_DELETE) +CRT_RPC_DEFINE(pool_prop_get, DAOS_ISEQ_POOL_PROP_GET, DAOS_OSEQ_POOL_PROP_GET) +CRT_RPC_DEFINE(pool_prop_set, DAOS_ISEQ_POOL_PROP_SET, DAOS_OSEQ_POOL_PROP_SET) +CRT_RPC_DEFINE(pool_acl_update, DAOS_ISEQ_POOL_ACL_UPDATE, DAOS_OSEQ_POOL_ACL_UPDATE) +CRT_RPC_DEFINE(pool_acl_delete, DAOS_ISEQ_POOL_ACL_DELETE, DAOS_OSEQ_POOL_ACL_DELETE) CRT_RPC_DEFINE(pool_ranks_get, DAOS_ISEQ_POOL_RANKS_GET, DAOS_OSEQ_POOL_RANKS_GET) -CRT_RPC_DEFINE(pool_upgrade, DAOS_ISEQ_POOL_UPGRADE_V6, DAOS_OSEQ_POOL_UPGRADE) -CRT_RPC_DEFINE(pool_list_cont_v6, DAOS_ISEQ_POOL_LIST_CONT_V6, DAOS_OSEQ_POOL_LIST_CONT) +CRT_RPC_DEFINE(pool_upgrade, DAOS_ISEQ_POOL_UPGRADE, DAOS_OSEQ_POOL_UPGRADE) CRT_RPC_DEFINE(pool_list_cont, DAOS_ISEQ_POOL_LIST_CONT, DAOS_OSEQ_POOL_LIST_CONT) static int @@ -214,9 +194,8 @@ crt_proc_daos_pool_cont_filter_t(crt_proc_t proc, crt_proc_op_t proc_op, return 0; } -CRT_RPC_DEFINE(pool_filter_cont_v6, DAOS_ISEQ_POOL_FILTER_CONT_V6, DAOS_OSEQ_POOL_FILTER_CONT) CRT_RPC_DEFINE(pool_filter_cont, DAOS_ISEQ_POOL_FILTER_CONT, DAOS_OSEQ_POOL_FILTER_CONT) -CRT_RPC_DEFINE(pool_query_info_v6, DAOS_ISEQ_POOL_QUERY_INFO_V6, DAOS_OSEQ_POOL_QUERY_INFO) +CRT_RPC_DEFINE(pool_query_info_v6, DAOS_ISEQ_POOL_QUERY_INFO, DAOS_OSEQ_POOL_QUERY_INFO_V6) CRT_RPC_DEFINE(pool_query_info, DAOS_ISEQ_POOL_QUERY_INFO, DAOS_OSEQ_POOL_QUERY_INFO) CRT_RPC_DEFINE(pool_tgt_query_map, DAOS_ISEQ_POOL_TGT_QUERY_MAP, DAOS_OSEQ_POOL_TGT_QUERY_MAP) CRT_RPC_DEFINE(pool_tgt_discard, DAOS_ISEQ_POOL_TGT_DISCARD, DAOS_OSEQ_POOL_TGT_DISCARD) @@ -234,29 +213,24 @@ CRT_RPC_DEFINE(pool_tgt_warmup, DAOS_ISEQ_POOL_TGT_WARMUP, DAOS_OSEQ_POOL_TGT_WA }, static struct crt_proto_rpc_format pool_proto_rpc_fmt_v6[] = {POOL_PROTO_CLI_RPC_LIST(6) - POOL_PROTO_SRV_RPC_LIST}; - -static struct crt_proto_rpc_format pool_proto_rpc_fmt_v5[] = { - POOL_PROTO_CLI_RPC_LIST(5) - POOL_PROTO_SRV_RPC_LIST -}; + POOL_PROTO_SRV_RPC_LIST(6)}; +static struct crt_proto_rpc_format pool_proto_rpc_fmt_v7[] = {POOL_PROTO_CLI_RPC_LIST(7) + POOL_PROTO_SRV_RPC_LIST(7)}; #undef X -struct crt_proto_format pool_proto_fmt_v5 = { - .cpf_name = "pool", - .cpf_ver = 5, - .cpf_count = ARRAY_SIZE(pool_proto_rpc_fmt_v5), - .cpf_prf = pool_proto_rpc_fmt_v5, - .cpf_base = DAOS_RPC_OPCODE(0, DAOS_POOL_MODULE, 0) -}; - struct crt_proto_format pool_proto_fmt_v6 = {.cpf_name = "pool", .cpf_ver = 6, .cpf_count = ARRAY_SIZE(pool_proto_rpc_fmt_v6), .cpf_prf = pool_proto_rpc_fmt_v6, .cpf_base = DAOS_RPC_OPCODE(0, DAOS_POOL_MODULE, 0)}; +struct crt_proto_format pool_proto_fmt_v7 = {.cpf_name = "pool", + .cpf_ver = 7, + .cpf_count = ARRAY_SIZE(pool_proto_rpc_fmt_v7), + .cpf_prf = pool_proto_rpc_fmt_v7, + .cpf_base = DAOS_RPC_OPCODE(0, DAOS_POOL_MODULE, 0)}; + uint64_t pool_query_bits(daos_pool_info_t *po_info, daos_prop_t *prop) { diff --git a/src/pool/rpc.h b/src/pool/rpc.h index cfddcc48931..199fc000634 100644 --- a/src/pool/rpc.h +++ b/src/pool/rpc.h @@ -28,7 +28,7 @@ * These are for daos_rpc::dr_opc and DAOS_RPC_OPCODE(opc, ...) rather than * crt_req_create(..., opc, ...). See src/include/daos/rpc.h. */ -#define DAOS_POOL_VERSION 6 +#define DAOS_POOL_VERSION 7 /* LIST of internal RPCS in form of: * OPCODE, flags, FMT, handler, corpc_hdlr, */ @@ -37,53 +37,41 @@ #define POOL_PROTO_CLI_RPC_LIST(ver) \ X(POOL_CREATE, 0, &CQF_pool_create, ds_pool_create_handler, NULL) \ - X(POOL_CONNECT, 0, ver >= 6 ? &CQF_pool_connect_v6 : &CQF_pool_connect, \ - ver >= 6 ? ds_pool_connect_handler_v6 : ds_pool_connect_handler_v5, NULL) \ - X(POOL_DISCONNECT, 0, ver >= 6 ? &CQF_pool_disconnect_v6 : &CQF_pool_disconnect, \ - ver >= 6 ? ds_pool_disconnect_handler_v6 : ds_pool_disconnect_handler_v5, NULL) \ - X(POOL_QUERY, 0, ver >= 6 ? &CQF_pool_query_v6 : &CQF_pool_query, \ - ver >= 6 ? ds_pool_query_handler_v6 : ds_pool_query_handler_v5, NULL) \ - X(POOL_QUERY_INFO, 0, ver >= 6 ? &CQF_pool_query_info_v6 : &CQF_pool_query_info, \ - ver >= 6 ? ds_pool_query_info_handler_v6 : ds_pool_query_info_handler_v5, NULL) \ - X(POOL_EXCLUDE, 0, ver >= 6 ? &CQF_pool_exclude_v6 : &CQF_pool_exclude, \ - ver >= 6 ? ds_pool_update_handler_v6 : ds_pool_update_handler_v5, NULL) \ - X(POOL_DRAIN, 0, ver >= 6 ? &CQF_pool_drain_v6 : &CQF_pool_drain, \ - ver >= 6 ? ds_pool_update_handler_v6 : ds_pool_update_handler_v5, NULL) \ + X(POOL_CONNECT, 0, ver >= 7 ? &CQF_pool_connect : &CQF_pool_connect_v6, \ + ver >= 7 ? ds_pool_connect_handler : ds_pool_connect_handler_v6, NULL) \ + X(POOL_DISCONNECT, 0, &CQF_pool_disconnect, ds_pool_disconnect_handler, NULL) \ + X(POOL_QUERY, 0, ver >= 7 ? &CQF_pool_query : &CQF_pool_query_v6, \ + ver >= 7 ? ds_pool_query_handler : ds_pool_query_handler_v6, NULL) \ + X(POOL_QUERY_INFO, 0, ver >= 7 ? &CQF_pool_query_info : &CQF_pool_query_info_v6, \ + ver >= 7 ? ds_pool_query_info_handler : ds_pool_query_info_handler_v6, NULL) \ + X(POOL_EXCLUDE, 0, &CQF_pool_exclude, ds_pool_update_handler, NULL) \ + X(POOL_DRAIN, 0, &CQF_pool_drain, ds_pool_update_handler, NULL) \ X(POOL_EXTEND, 0, &CQF_pool_extend, ds_pool_extend_handler, NULL) \ X(POOL_EVICT, 0, &CQF_pool_evict, ds_pool_evict_handler, NULL) \ - X(POOL_REINT, 0, ver >= 6 ? &CQF_pool_add_v6 : &CQF_pool_add, \ - ver >= 6 ? ds_pool_update_handler_v6 : ds_pool_update_handler_v5, NULL) \ - X(POOL_ADD_IN, 0, ver >= 6 ? &CQF_pool_add_in_v6 : &CQF_pool_add_in, \ - ver >= 6 ? ds_pool_update_handler_v6 : ds_pool_update_handler_v5, NULL) \ - X(POOL_EXCLUDE_OUT, 0, ver >= 6 ? &CQF_pool_exclude_out_v6 : &CQF_pool_exclude_out, \ - ver >= 6 ? ds_pool_update_handler_v6 : ds_pool_update_handler_v5, NULL) \ - X(POOL_SVC_STOP, 0, ver >= 6 ? &CQF_pool_svc_stop_v6 : &CQF_pool_svc_stop, \ - ver >= 6 ? ds_pool_svc_stop_handler_v6 : ds_pool_svc_stop_handler_v5, NULL) \ - X(POOL_ATTR_LIST, 0, ver >= 6 ? &CQF_pool_attr_list_v6 : &CQF_pool_attr_list, \ - ver >= 6 ? ds_pool_attr_list_handler_v6 : ds_pool_attr_list_handler_v5, NULL) \ - X(POOL_ATTR_GET, 0, ver >= 6 ? &CQF_pool_attr_get_v6 : &CQF_pool_attr_get, \ - ver >= 6 ? ds_pool_attr_get_handler_v6 : ds_pool_attr_get_handler_v5, NULL) \ - X(POOL_ATTR_SET, 0, ver >= 6 ? &CQF_pool_attr_set_v6 : &CQF_pool_attr_set, \ - ver >= 6 ? ds_pool_attr_set_handler_v6 : ds_pool_attr_set_handler_v5, NULL) \ - X(POOL_ATTR_DEL, 0, ver >= 6 ? &CQF_pool_attr_del_v6 : &CQF_pool_attr_del, \ - ver >= 6 ? ds_pool_attr_del_handler_v6 : ds_pool_attr_del_handler_v5, NULL) \ + X(POOL_REINT, 0, &CQF_pool_add, ds_pool_update_handler, NULL) \ + X(POOL_ADD_IN, 0, &CQF_pool_add_in, ds_pool_update_handler, NULL) \ + X(POOL_EXCLUDE_OUT, 0, &CQF_pool_exclude_out, ds_pool_update_handler, NULL) \ + X(POOL_SVC_STOP, 0, &CQF_pool_svc_stop, ds_pool_svc_stop_handler, NULL) \ + X(POOL_ATTR_LIST, 0, &CQF_pool_attr_list, ds_pool_attr_list_handler, NULL) \ + X(POOL_ATTR_GET, 0, &CQF_pool_attr_get, ds_pool_attr_get_handler, NULL) \ + X(POOL_ATTR_SET, 0, &CQF_pool_attr_set, ds_pool_attr_set_handler, NULL) \ + X(POOL_ATTR_DEL, 0, &CQF_pool_attr_del, ds_pool_attr_del_handler, NULL) \ X(POOL_REPLICAS_ADD, 0, &CQF_pool_replicas_add, ds_pool_replicas_update_handler, NULL) \ X(POOL_REPLICAS_REMOVE, 0, &CQF_pool_replicas_remove, ds_pool_replicas_update_handler, \ NULL) \ - X(POOL_LIST_CONT, 0, ver >= 6 ? &CQF_pool_list_cont_v6 : &CQF_pool_list_cont, \ - ver >= 6 ? ds_pool_list_cont_handler_v6 : ds_pool_list_cont_handler_v5, NULL) \ + X(POOL_LIST_CONT, 0, &CQF_pool_list_cont, ds_pool_list_cont_handler, NULL) \ X(POOL_TGT_QUERY_MAP, 0, &CQF_pool_tgt_query_map, ds_pool_tgt_query_map_handler, NULL) \ - X(POOL_FILTER_CONT, 0, ver >= 6 ? &CQF_pool_filter_cont_v6 : &CQF_pool_filter_cont, \ - ver >= 6 ? ds_pool_filter_cont_handler_v6 : ds_pool_filter_cont_handler_v5, NULL) \ + X(POOL_FILTER_CONT, 0, &CQF_pool_filter_cont, ds_pool_filter_cont_handler, NULL) \ X(POOL_TGT_WARMUP, 0, &CQF_pool_tgt_warmup, ds_pool_tgt_warmup_handler, NULL) -#define POOL_PROTO_SRV_RPC_LIST \ +#define POOL_PROTO_SRV_RPC_LIST(ver) \ X(POOL_TGT_DISCONNECT, 0, &CQF_pool_tgt_disconnect, ds_pool_tgt_disconnect_handler, \ &ds_pool_tgt_disconnect_co_ops) \ - X(POOL_TGT_QUERY, 0, &CQF_pool_tgt_query, ds_pool_tgt_query_handler, \ - &ds_pool_tgt_query_co_ops) \ + X(POOL_TGT_QUERY, 0, ver >= 7 ? &CQF_pool_tgt_query : &CQF_pool_tgt_query_v6, \ + ver >= 7 ? ds_pool_tgt_query_handler : ds_pool_tgt_query_handler_v6, \ + ver >= 7 ? &ds_pool_tgt_query_co_ops : &ds_pool_tgt_query_co_ops_v6) \ X(POOL_PROP_GET, 0, &CQF_pool_prop_get, ds_pool_prop_get_handler, NULL) \ - X(POOL_ADD_TGT, 0, &CQF_pool_add_v6, ds_pool_update_handler_v6, NULL) \ + X(POOL_ADD_TGT, 0, &CQF_pool_add, ds_pool_update_handler, NULL) \ X(POOL_PROP_SET, 0, &CQF_pool_prop_set, ds_pool_prop_set_handler, NULL) \ X(POOL_ACL_UPDATE, 0, &CQF_pool_acl_update, ds_pool_acl_update_handler, NULL) \ X(POOL_ACL_DELETE, 0, &CQF_pool_acl_delete, ds_pool_acl_delete_handler, NULL) \ @@ -93,7 +81,7 @@ #define POOL_PROTO_RPC_LIST \ POOL_PROTO_CLI_RPC_LIST(DAOS_POOL_VERSION) \ - POOL_PROTO_SRV_RPC_LIST + POOL_PROTO_SRV_RPC_LIST(DAOS_POOL_VERSION) /* Define for RPC enum population below */ #define X(a, b, c, d, e) a, @@ -103,25 +91,21 @@ enum pool_operation { POOL_PROTO_CLI_RPC_LIST(DAOS_POOL_VERSION) POOL_PROTO_CLI_COUNT, POOL_PROTO_CLI_LAST = POOL_PROTO_CLI_COUNT - 1, - POOL_PROTO_SRV_RPC_LIST + POOL_PROTO_SRV_RPC_LIST(DAOS_POOL_VERSION) }; #undef X char *dc_pool_op_str(enum pool_operation op); -extern struct crt_proto_format pool_proto_fmt_v5; extern struct crt_proto_format pool_proto_fmt_v6; +extern struct crt_proto_format pool_proto_fmt_v7; extern int dc_pool_proto_version; /* clang-format off */ -#define DAOS_ISEQ_POOL_OP /* input fields */ \ - ((uuid_t) (pi_uuid) CRT_VAR) \ - ((uuid_t) (pi_hdl) CRT_VAR) - -#define DAOS_ISEQ_POOL_OP_V6 /* input fields */ \ - ((uuid_t)(pi_uuid)CRT_VAR)((uuid_t)(pi_hdl)CRT_VAR)((uuid_t)(pi_cli_id)CRT_VAR)( \ +#define DAOS_ISEQ_POOL_OP /* input fields */ \ + ((uuid_t)(pi_uuid)CRT_VAR)((uuid_t)(pi_hdl)CRT_VAR)((uuid_t)(pi_cli_id)CRT_VAR)( \ (uint64_t)(pi_time)CRT_VAR) #define DAOS_OSEQ_POOL_OP /* output fields */ \ @@ -129,12 +113,11 @@ extern int dc_pool_proto_version; ((uint32_t) (po_map_version) CRT_VAR) \ ((struct rsvc_hint) (po_hint) CRT_VAR) -CRT_RPC_DECLARE(pool_op_v6, DAOS_ISEQ_POOL_OP_V6, DAOS_OSEQ_POOL_OP) CRT_RPC_DECLARE(pool_op, DAOS_ISEQ_POOL_OP, DAOS_OSEQ_POOL_OP) /* If pri_op.pi_hdl is not null, call rdb_campaign. */ #define DAOS_ISEQ_POOL_CREATE /* input fields */ \ - ((struct pool_op_v6_in) (pri_op) CRT_VAR) \ + ((struct pool_op_in) (pri_op) CRT_VAR) \ ((d_rank_list_t) (pri_tgt_ranks) CRT_PTR) \ ((daos_prop_t) (pri_prop) CRT_PTR) \ ((uint32_t) (pri_ndomains) CRT_VAR) \ @@ -241,24 +224,23 @@ pool_create_in_set_data(crt_rpc_t *rpc, d_rank_list_t *pri_tgt_ranks, daos_prop_ /* only set on -DER_TRUNC */ \ ((uint32_t) (pco_map_buf_size) CRT_VAR) -#define DAOS_ISEQ_POOL_CONNECT /* input fields */ \ - ((struct pool_op_in) (pci_op) CRT_VAR) \ - ((d_iov_t) (pci_cred) CRT_VAR) \ - ((uint64_t) (pci_flags) CRT_VAR) \ - ((uint64_t) (pci_query_bits) CRT_VAR) \ - ((crt_bulk_t) (pci_map_bulk) CRT_VAR) \ - ((uint32_t) (pci_pool_version) CRT_VAR) +#define DAOS_OSEQ_POOL_CONNECT_V6 /* output fields */ \ + ((struct pool_op_out) (pco_op) CRT_VAR) \ + ((struct daos_pool_space_v6) (pco_space) CRT_RAW) \ + ((struct daos_rebuild_status) (pco_rebuild_st) CRT_RAW) \ + /* only set on -DER_TRUNC */ \ + ((uint32_t) (pco_map_buf_size) CRT_VAR) -#define DAOS_ISEQ_POOL_CONNECT_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pci_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_CONNECT /* input fields */ \ + ((struct pool_op_in) (pci_op) CRT_VAR) \ ((d_iov_t) (pci_cred) CRT_VAR) \ ((uint64_t) (pci_flags) CRT_VAR) \ ((uint64_t) (pci_query_bits) CRT_VAR) \ ((crt_bulk_t) (pci_map_bulk) CRT_VAR) \ ((uint32_t) (pci_pool_version) CRT_VAR) +CRT_RPC_DECLARE(pool_connect_v6, DAOS_ISEQ_POOL_CONNECT, DAOS_OSEQ_POOL_CONNECT_V6) CRT_RPC_DECLARE(pool_connect, DAOS_ISEQ_POOL_CONNECT, DAOS_OSEQ_POOL_CONNECT) -CRT_RPC_DECLARE(pool_connect_v6, DAOS_ISEQ_POOL_CONNECT_V6, DAOS_OSEQ_POOL_CONNECT) /* clang-format on */ @@ -271,58 +253,40 @@ rpc_ver_atleast(crt_rpc_t *rpc, int min_ver) static inline void pool_connect_in_get_cred(crt_rpc_t *rpc, d_iov_t **pci_credp) { - void *in = crt_req_get(rpc); + struct pool_connect_in *in = crt_req_get(rpc); - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) - *pci_credp = &(((struct pool_connect_v6_in *)in)->pci_cred); - else - *pci_credp = &(((struct pool_connect_in *)in)->pci_cred); + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pci_credp = &in->pci_cred; } static inline void pool_connect_in_get_data(crt_rpc_t *rpc, uint64_t *pci_flagsp, uint64_t *pci_query_bitsp, crt_bulk_t *pci_map_bulkp, uint32_t *pci_pool_versionp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - if (pci_flagsp) - *pci_flagsp = ((struct pool_connect_v6_in *)in)->pci_flags; - if (pci_query_bitsp) - *pci_query_bitsp = ((struct pool_connect_v6_in *)in)->pci_query_bits; - if (pci_map_bulkp) - *pci_map_bulkp = ((struct pool_connect_v6_in *)in)->pci_map_bulk; - if (pci_pool_versionp) - *pci_pool_versionp = ((struct pool_connect_v6_in *)in)->pci_pool_version; - } else { - if (pci_flagsp) - *pci_flagsp = ((struct pool_connect_in *)in)->pci_flags; - if (pci_query_bitsp) - *pci_query_bitsp = ((struct pool_connect_in *)in)->pci_query_bits; - if (pci_map_bulkp) - *pci_map_bulkp = ((struct pool_connect_in *)in)->pci_map_bulk; - if (pci_pool_versionp) - *pci_pool_versionp = ((struct pool_connect_in *)in)->pci_pool_version; - } + struct pool_connect_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + if (pci_flagsp) + *pci_flagsp = in->pci_flags; + if (pci_query_bitsp) + *pci_query_bitsp = in->pci_query_bits; + if (pci_map_bulkp) + *pci_map_bulkp = in->pci_map_bulk; + if (pci_pool_versionp) + *pci_pool_versionp = in->pci_pool_version; } static inline void pool_connect_in_set_data(crt_rpc_t *rpc, uint64_t pci_flags, uint64_t pci_query_bits, crt_bulk_t pci_map_bulk, uint32_t pci_pool_version) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_connect_v6_in *)in)->pci_flags = pci_flags; - ((struct pool_connect_v6_in *)in)->pci_query_bits = pci_query_bits; - ((struct pool_connect_v6_in *)in)->pci_map_bulk = pci_map_bulk; - ((struct pool_connect_v6_in *)in)->pci_pool_version = pci_pool_version; - } else { - ((struct pool_connect_in *)in)->pci_flags = pci_flags; - ((struct pool_connect_in *)in)->pci_query_bits = pci_query_bits; - ((struct pool_connect_in *)in)->pci_map_bulk = pci_map_bulk; - ((struct pool_connect_in *)in)->pci_pool_version = pci_pool_version; - } + struct pool_connect_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pci_flags = pci_flags; + in->pci_query_bits = pci_query_bits; + in->pci_map_bulk = pci_map_bulk; + in->pci_pool_version = pci_pool_version; } /* clang-format off */ @@ -330,24 +294,25 @@ pool_connect_in_set_data(crt_rpc_t *rpc, uint64_t pci_flags, uint64_t pci_query_ #define DAOS_ISEQ_POOL_DISCONNECT /* input fields */ \ ((struct pool_op_in) (pdi_op) CRT_VAR) -#define DAOS_ISEQ_POOL_DISCONNECT_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pdi_op) CRT_VAR) - #define DAOS_OSEQ_POOL_DISCONNECT /* output fields */ \ ((struct pool_op_out) (pdo_op) CRT_VAR) CRT_RPC_DECLARE(pool_disconnect, DAOS_ISEQ_POOL_DISCONNECT, DAOS_OSEQ_POOL_DISCONNECT) -CRT_RPC_DECLARE(pool_disconnect_v6, DAOS_ISEQ_POOL_DISCONNECT_V6, DAOS_OSEQ_POOL_DISCONNECT) #define DAOS_ISEQ_POOL_QUERY /* input fields */ \ ((struct pool_op_in) (pqi_op) CRT_VAR) \ ((crt_bulk_t) (pqi_map_bulk) CRT_VAR) \ ((uint64_t) (pqi_query_bits) CRT_VAR) -#define DAOS_ISEQ_POOL_QUERY_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pqi_op) CRT_VAR) \ - ((crt_bulk_t) (pqi_map_bulk) CRT_VAR) \ - ((uint64_t) (pqi_query_bits) CRT_VAR) +#define DAOS_OSEQ_POOL_QUERY_V6 /* output fields */ \ + ((struct pool_op_out) (pqo_op) CRT_VAR) \ + ((daos_prop_t) (pqo_prop) CRT_PTR) \ + ((struct daos_pool_space_v6) (pqo_space) CRT_RAW) \ + ((struct daos_rebuild_status) (pqo_rebuild_st) CRT_RAW) \ + /* only set on -DER_TRUNC */ \ + ((uint32_t) (pqo_map_buf_size) CRT_VAR) \ + ((uint32_t) (pqo_pool_layout_ver) CRT_VAR) \ + ((uint32_t) (pqo_upgrade_layout_ver) CRT_VAR) #define DAOS_OSEQ_POOL_QUERY /* output fields */ \ ((struct pool_op_out) (pqo_op) CRT_VAR) \ @@ -359,37 +324,29 @@ CRT_RPC_DECLARE(pool_disconnect_v6, DAOS_ISEQ_POOL_DISCONNECT_V6, DAOS_OSEQ_POOL ((uint32_t) (pqo_pool_layout_ver) CRT_VAR) \ ((uint32_t) (pqo_upgrade_layout_ver) CRT_VAR) +CRT_RPC_DECLARE(pool_query_v6, DAOS_ISEQ_POOL_QUERY, DAOS_OSEQ_POOL_QUERY_V6) CRT_RPC_DECLARE(pool_query, DAOS_ISEQ_POOL_QUERY, DAOS_OSEQ_POOL_QUERY) -CRT_RPC_DECLARE(pool_query_v6, DAOS_ISEQ_POOL_QUERY_V6, DAOS_OSEQ_POOL_QUERY) /* clang-format on */ static inline void pool_query_in_get_data(crt_rpc_t *rpc, crt_bulk_t *pqi_map_bulkp, uint64_t *pqi_query_bitsp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pqi_map_bulkp = ((struct pool_query_v6_in *)in)->pqi_map_bulk; - *pqi_query_bitsp = ((struct pool_query_v6_in *)in)->pqi_query_bits; - } else { - *pqi_map_bulkp = ((struct pool_query_in *)in)->pqi_map_bulk; - *pqi_query_bitsp = ((struct pool_query_in *)in)->pqi_query_bits; - } + struct pool_query_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pqi_map_bulkp = in->pqi_map_bulk; + *pqi_query_bitsp = in->pqi_query_bits; } static inline void pool_query_in_set_data(crt_rpc_t *rpc, crt_bulk_t pqi_map_bulk, uint64_t pqi_query_bits) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_query_v6_in *)in)->pqi_map_bulk = pqi_map_bulk; - ((struct pool_query_v6_in *)in)->pqi_query_bits = pqi_query_bits; - } else { - ((struct pool_query_in *)in)->pqi_map_bulk = pqi_map_bulk; - ((struct pool_query_in *)in)->pqi_query_bits = pqi_query_bits; - } + struct pool_query_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pqi_map_bulk = pqi_map_bulk; + in->pqi_query_bits = pqi_query_bits; } /* clang-format off */ @@ -399,10 +356,12 @@ pool_query_in_set_data(crt_rpc_t *rpc, crt_bulk_t pqi_map_bulk, uint64_t pqi_que ((d_rank_t) (pqii_rank) CRT_VAR) \ ((uint32_t) (pqii_tgt) CRT_VAR) -#define DAOS_ISEQ_POOL_QUERY_INFO_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pqii_op) CRT_VAR) \ - ((d_rank_t) (pqii_rank) CRT_VAR) \ - ((uint32_t) (pqii_tgt) CRT_VAR) +#define DAOS_OSEQ_POOL_QUERY_INFO_V6 /* output fields */ \ + ((struct pool_op_out) (pqio_op) CRT_VAR) \ + ((d_rank_t) (pqio_rank) CRT_VAR) \ + ((uint32_t) (pqio_tgt) CRT_VAR) \ + ((struct daos_space_v6) (pqio_space) CRT_RAW) \ + ((daos_target_state_t) (pqio_state) CRT_VAR) #define DAOS_OSEQ_POOL_QUERY_INFO /* output fields */ \ ((struct pool_op_out) (pqio_op) CRT_VAR) \ @@ -411,37 +370,29 @@ pool_query_in_set_data(crt_rpc_t *rpc, crt_bulk_t pqi_map_bulk, uint64_t pqi_que ((struct daos_space) (pqio_space) CRT_RAW) \ ((daos_target_state_t) (pqio_state) CRT_VAR) +CRT_RPC_DECLARE(pool_query_info_v6, DAOS_ISEQ_POOL_QUERY_INFO, DAOS_OSEQ_POOL_QUERY_INFO_V6) CRT_RPC_DECLARE(pool_query_info, DAOS_ISEQ_POOL_QUERY_INFO, DAOS_OSEQ_POOL_QUERY_INFO) -CRT_RPC_DECLARE(pool_query_info_v6, DAOS_ISEQ_POOL_QUERY_INFO_V6, DAOS_OSEQ_POOL_QUERY_INFO) /* clang-format on */ static inline void pool_query_info_in_get_data(crt_rpc_t *rpc, d_rank_t *pqii_rankp, uint32_t *pqii_tgtp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pqii_rankp = ((struct pool_query_info_v6_in *)in)->pqii_rank; - *pqii_tgtp = ((struct pool_query_info_v6_in *)in)->pqii_tgt; - } else { - *pqii_rankp = ((struct pool_query_info_in *)in)->pqii_rank; - *pqii_tgtp = ((struct pool_query_info_in *)in)->pqii_tgt; - } + struct pool_query_info_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pqii_rankp = in->pqii_rank; + *pqii_tgtp = in->pqii_tgt; } static inline void pool_query_info_in_set_data(crt_rpc_t *rpc, d_rank_t pqii_rank, uint32_t pqii_tgt) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_query_info_v6_in *)in)->pqii_rank = pqii_rank; - ((struct pool_query_info_v6_in *)in)->pqii_tgt = pqii_tgt; - } else { - ((struct pool_query_info_in *)in)->pqii_rank = pqii_rank; - ((struct pool_query_info_in *)in)->pqii_tgt = pqii_tgt; - } + struct pool_query_info_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pqii_rank = pqii_rank; + in->pqii_tgt = pqii_tgt; } /* clang-format off */ @@ -450,16 +401,11 @@ pool_query_info_in_set_data(crt_rpc_t *rpc, d_rank_t pqii_rank, uint32_t pqii_tg ((struct pool_op_in) (pali_op) CRT_VAR) \ ((crt_bulk_t) (pali_bulk) CRT_VAR) -#define DAOS_ISEQ_POOL_ATTR_LIST_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pali_op) CRT_VAR) \ - ((crt_bulk_t) (pali_bulk) CRT_VAR) - #define DAOS_OSEQ_POOL_ATTR_LIST /* output fields */ \ ((struct pool_op_out) (palo_op) CRT_VAR) \ ((uint64_t) (palo_size) CRT_VAR) CRT_RPC_DECLARE(pool_attr_list, DAOS_ISEQ_POOL_ATTR_LIST, DAOS_OSEQ_POOL_ATTR_LIST) -CRT_RPC_DECLARE(pool_attr_list_v6, DAOS_ISEQ_POOL_ATTR_LIST_V6, DAOS_OSEQ_POOL_ATTR_LIST) #define DAOS_ISEQ_POOL_TGT_WARMUP /* input fields */ \ ((crt_bulk_t) (tw_bulk) CRT_VAR) @@ -472,25 +418,19 @@ CRT_RPC_DECLARE(pool_tgt_warmup, DAOS_ISEQ_POOL_TGT_WARMUP, DAOS_OSEQ_POOL_TGT_W static inline void pool_attr_list_in_get_data(crt_rpc_t *rpc, crt_bulk_t *pali_bulkp) { - void *in = crt_req_get(rpc); + struct pool_attr_list_in *in = crt_req_get(rpc); - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pali_bulkp = ((struct pool_attr_list_v6_in *)in)->pali_bulk; - } else { - *pali_bulkp = ((struct pool_attr_list_in *)in)->pali_bulk; - } + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pali_bulkp = in->pali_bulk; } static inline void pool_attr_list_in_set_data(crt_rpc_t *rpc, crt_bulk_t pali_bulk) { - void *in = crt_req_get(rpc); + struct pool_attr_list_in *in = crt_req_get(rpc); - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_attr_list_v6_in *)in)->pali_bulk = pali_bulk; - } else { - ((struct pool_attr_list_in *)in)->pali_bulk = pali_bulk; - } + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pali_bulk = pali_bulk; } /* clang-format off */ @@ -501,14 +441,7 @@ pool_attr_list_in_set_data(crt_rpc_t *rpc, crt_bulk_t pali_bulk) ((uint64_t) (pagi_key_length) CRT_VAR) \ ((crt_bulk_t) (pagi_bulk) CRT_VAR) -#define DAOS_ISEQ_POOL_ATTR_GET_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pagi_op) CRT_VAR) \ - ((uint64_t) (pagi_count) CRT_VAR) \ - ((uint64_t) (pagi_key_length) CRT_VAR) \ - ((crt_bulk_t) (pagi_bulk) CRT_VAR) - CRT_RPC_DECLARE(pool_attr_get, DAOS_ISEQ_POOL_ATTR_GET, DAOS_OSEQ_POOL_OP) -CRT_RPC_DECLARE(pool_attr_get_v6, DAOS_ISEQ_POOL_ATTR_GET_V6, DAOS_OSEQ_POOL_OP) /* clang-format on */ @@ -516,17 +449,12 @@ static inline void pool_attr_get_in_get_data(crt_rpc_t *rpc, uint64_t *pagi_countp, uint64_t *pagi_key_lengthp, crt_bulk_t *pagi_bulkp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pagi_countp = ((struct pool_attr_get_v6_in *)in)->pagi_count; - *pagi_key_lengthp = ((struct pool_attr_get_v6_in *)in)->pagi_key_length; - *pagi_bulkp = ((struct pool_attr_get_v6_in *)in)->pagi_bulk; - } else { - *pagi_countp = ((struct pool_attr_get_in *)in)->pagi_count; - *pagi_key_lengthp = ((struct pool_attr_get_in *)in)->pagi_key_length; - *pagi_bulkp = ((struct pool_attr_get_in *)in)->pagi_bulk; - } + struct pool_attr_get_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pagi_countp = in->pagi_count; + *pagi_key_lengthp = in->pagi_key_length; + *pagi_bulkp = in->pagi_bulk; } static inline void @@ -534,17 +462,12 @@ pool_attr_get_in_set_data(crt_rpc_t *rpc, uint64_t pagi_count, uint64_t pagi_key crt_bulk_t pagi_bulk) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_attr_get_v6_in *)in)->pagi_count = pagi_count; - ((struct pool_attr_get_v6_in *)in)->pagi_key_length = pagi_key_length; - ((struct pool_attr_get_v6_in *)in)->pagi_bulk = pagi_bulk; - } else { - ((struct pool_attr_get_in *)in)->pagi_count = pagi_count; - ((struct pool_attr_get_in *)in)->pagi_key_length = pagi_key_length; - ((struct pool_attr_get_in *)in)->pagi_bulk = pagi_bulk; - } + struct pool_attr_get_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pagi_count = pagi_count; + in->pagi_key_length = pagi_key_length; + in->pagi_bulk = pagi_bulk; } /* clang-format off */ @@ -554,42 +477,28 @@ pool_attr_get_in_set_data(crt_rpc_t *rpc, uint64_t pagi_count, uint64_t pagi_key ((uint64_t) (pasi_count) CRT_VAR) \ ((crt_bulk_t) (pasi_bulk) CRT_VAR) -#define DAOS_ISEQ_POOL_ATTR_SET_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pasi_op) CRT_VAR) \ - ((uint64_t) (pasi_count) CRT_VAR) \ - ((crt_bulk_t) (pasi_bulk) CRT_VAR) - CRT_RPC_DECLARE(pool_attr_set, DAOS_ISEQ_POOL_ATTR_SET, DAOS_OSEQ_POOL_OP) -CRT_RPC_DECLARE(pool_attr_set_v6, DAOS_ISEQ_POOL_ATTR_SET_V6, DAOS_OSEQ_POOL_OP) /* clang-format on */ static inline void pool_attr_set_in_get_data(crt_rpc_t *rpc, uint64_t *pasi_countp, crt_bulk_t *pasi_bulkp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pasi_countp = ((struct pool_attr_set_v6_in *)in)->pasi_count; - *pasi_bulkp = ((struct pool_attr_set_v6_in *)in)->pasi_bulk; - } else { - *pasi_countp = ((struct pool_attr_set_in *)in)->pasi_count; - *pasi_bulkp = ((struct pool_attr_set_in *)in)->pasi_bulk; - } + struct pool_attr_set_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pasi_countp = in->pasi_count; + *pasi_bulkp = in->pasi_bulk; } static inline void pool_attr_set_in_set_data(crt_rpc_t *rpc, uint64_t pasi_count, crt_bulk_t pasi_bulk) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_attr_set_v6_in *)in)->pasi_count = pasi_count; - ((struct pool_attr_set_v6_in *)in)->pasi_bulk = pasi_bulk; - } else { - ((struct pool_attr_set_in *)in)->pasi_count = pasi_count; - ((struct pool_attr_set_in *)in)->pasi_bulk = pasi_bulk; - } + struct pool_attr_set_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pasi_count = pasi_count; + in->pasi_bulk = pasi_bulk; } /* clang-format off */ @@ -599,42 +508,28 @@ pool_attr_set_in_set_data(crt_rpc_t *rpc, uint64_t pasi_count, crt_bulk_t pasi_b ((uint64_t) (padi_count) CRT_VAR) \ ((crt_bulk_t) (padi_bulk) CRT_VAR) -#define DAOS_ISEQ_POOL_ATTR_DEL_V6 /* input fields */ \ - ((struct pool_op_v6_in) (padi_op) CRT_VAR) \ - ((uint64_t) (padi_count) CRT_VAR) \ - ((crt_bulk_t) (padi_bulk) CRT_VAR) - CRT_RPC_DECLARE(pool_attr_del, DAOS_ISEQ_POOL_ATTR_DEL, DAOS_OSEQ_POOL_OP) -CRT_RPC_DECLARE(pool_attr_del_v6, DAOS_ISEQ_POOL_ATTR_DEL_V6, DAOS_OSEQ_POOL_OP) /* clang-format on */ static inline void pool_attr_del_in_get_data(crt_rpc_t *rpc, uint64_t *padi_countp, crt_bulk_t *padi_bulkp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *padi_countp = ((struct pool_attr_del_v6_in *)in)->padi_count; - *padi_bulkp = ((struct pool_attr_del_v6_in *)in)->padi_bulk; - } else { - *padi_countp = ((struct pool_attr_del_in *)in)->padi_count; - *padi_bulkp = ((struct pool_attr_del_in *)in)->padi_bulk; - } + struct pool_attr_del_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *padi_countp = in->padi_count; + *padi_bulkp = in->padi_bulk; } static inline void pool_attr_del_in_set_data(crt_rpc_t *rpc, uint64_t padi_count, crt_bulk_t padi_bulk) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_attr_del_v6_in *)in)->padi_count = padi_count; - ((struct pool_attr_del_v6_in *)in)->padi_bulk = padi_bulk; - } else { - ((struct pool_attr_del_in *)in)->padi_count = padi_count; - ((struct pool_attr_del_in *)in)->padi_bulk = padi_bulk; - } + struct pool_attr_del_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->padi_count = padi_count; + in->padi_bulk = padi_bulk; } /* clang-format off */ @@ -656,16 +551,12 @@ CRT_RPC_DECLARE(pool_replicas_remove, DAOS_ISEQ_POOL_MEMBERSHIP, DAOS_OSEQ_POOL_ ((struct pool_op_in) (pti_op) CRT_VAR) \ ((struct pool_target_addr) (pti_addr_list) CRT_ARRAY) -#define DAOS_ISEQ_POOL_TGT_UPDATE_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pti_op) CRT_VAR) \ - ((struct pool_target_addr) (pti_addr_list) CRT_ARRAY) - #define DAOS_OSEQ_POOL_TGT_UPDATE /* output fields */ \ ((struct pool_op_out) (pto_op) CRT_VAR) \ ((struct pool_target_addr) (pto_addr_list) CRT_ARRAY) -#define DAOS_ISEQ_POOL_EXTEND_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pei_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_EXTEND /* input fields */ \ + ((struct pool_op_in) (pei_op) CRT_VAR) \ ((d_rank_list_t) (pei_tgt_ranks) CRT_PTR) \ ((uint32_t) (pei_ntgts) CRT_VAR) \ ((uint32_t) (pei_ndomains) CRT_VAR) \ @@ -675,54 +566,40 @@ CRT_RPC_DECLARE(pool_replicas_remove, DAOS_ISEQ_POOL_MEMBERSHIP, DAOS_OSEQ_POOL_ ((struct pool_op_out) (peo_op) CRT_VAR) CRT_RPC_DECLARE(pool_tgt_update, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_tgt_update_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_extend, DAOS_ISEQ_POOL_EXTEND_V6, DAOS_OSEQ_POOL_EXTEND) +CRT_RPC_DECLARE(pool_extend, DAOS_ISEQ_POOL_EXTEND, DAOS_OSEQ_POOL_EXTEND) CRT_RPC_DECLARE(pool_add, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_add_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DECLARE(pool_add_in, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_add_in_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DECLARE(pool_exclude, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_exclude_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DECLARE(pool_drain, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_drain_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) CRT_RPC_DECLARE(pool_exclude_out, DAOS_ISEQ_POOL_TGT_UPDATE, DAOS_OSEQ_POOL_TGT_UPDATE) -CRT_RPC_DECLARE(pool_exclude_out_v6, DAOS_ISEQ_POOL_TGT_UPDATE_V6, DAOS_OSEQ_POOL_TGT_UPDATE) /* clang-format on */ static inline void pool_tgt_update_in_get_data(crt_rpc_t *rpc, struct pool_target_addr **pti_addr_listp, int *countp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pti_addr_listp = ((struct pool_tgt_update_v6_in *)in)->pti_addr_list.ca_arrays; - *countp = (int)((struct pool_tgt_update_v6_in *)in)->pti_addr_list.ca_count; - } else { - *pti_addr_listp = ((struct pool_tgt_update_in *)in)->pti_addr_list.ca_arrays; - *countp = (int)((struct pool_tgt_update_in *)in)->pti_addr_list.ca_count; - } + struct pool_tgt_update_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pti_addr_listp = in->pti_addr_list.ca_arrays; + *countp = in->pti_addr_list.ca_count; } static inline void pool_tgt_update_in_set_data(crt_rpc_t *rpc, struct pool_target_addr *pti_addr_list, uint64_t count) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_tgt_update_v6_in *)in)->pti_addr_list.ca_arrays = pti_addr_list; - ((struct pool_tgt_update_v6_in *)in)->pti_addr_list.ca_count = count; - } else { - ((struct pool_tgt_update_in *)in)->pti_addr_list.ca_arrays = pti_addr_list; - ((struct pool_tgt_update_in *)in)->pti_addr_list.ca_count = count; - } + struct pool_tgt_update_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pti_addr_list.ca_arrays = pti_addr_list; + in->pti_addr_list.ca_count = count; } /* clang-format off */ -#define DAOS_ISEQ_POOL_EVICT_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pvi_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_EVICT /* input fields */ \ + ((struct pool_op_in) (pvi_op) CRT_VAR) \ ((uint32_t) (pvi_pool_destroy) CRT_VAR) \ ((uint32_t) (pvi_pool_destroy_force) CRT_VAR) \ ((uuid_t) (pvi_hdls) CRT_ARRAY) \ @@ -732,19 +609,15 @@ pool_tgt_update_in_set_data(crt_rpc_t *rpc, struct pool_target_addr *pti_addr_li ((struct pool_op_out) (pvo_op) CRT_VAR) \ ((uint32_t) (pvo_n_hdls_evicted) CRT_VAR) -CRT_RPC_DECLARE(pool_evict, DAOS_ISEQ_POOL_EVICT_V6, DAOS_OSEQ_POOL_EVICT) +CRT_RPC_DECLARE(pool_evict, DAOS_ISEQ_POOL_EVICT, DAOS_OSEQ_POOL_EVICT) #define DAOS_ISEQ_POOL_SVC_STOP /* input fields */ \ ((struct pool_op_in) (psi_op) CRT_VAR) -#define DAOS_ISEQ_POOL_SVC_STOP_V6 /* input fields */ \ - ((struct pool_op_v6_in) (psi_op) CRT_VAR) - #define DAOS_OSEQ_POOL_SVC_STOP /* output fields */ \ ((struct pool_op_out) (pso_op) CRT_VAR) CRT_RPC_DECLARE(pool_svc_stop, DAOS_ISEQ_POOL_SVC_STOP, DAOS_OSEQ_POOL_SVC_STOP) -CRT_RPC_DECLARE(pool_svc_stop_v6, DAOS_ISEQ_POOL_SVC_STOP_V6, DAOS_OSEQ_POOL_SVC_STOP) #define DAOS_ISEQ_POOL_TGT_DISCONNECT /* input fields */ \ ((uuid_t) (tdi_uuid) CRT_VAR) \ @@ -762,6 +635,11 @@ CRT_RPC_DECLARE(pool_tgt_disconnect, DAOS_ISEQ_POOL_TGT_DISCONNECT, DAOS_OSEQ_PO ((struct daos_pool_space) (tqo_space) CRT_RAW) \ ((uint32_t) (tqo_rc) CRT_VAR) +#define DAOS_OSEQ_POOL_TGT_QUERY_V6 /* output fields */ \ + ((struct daos_pool_space_v6) (tqo_space) CRT_RAW) \ + ((uint32_t) (tqo_rc) CRT_VAR) + +CRT_RPC_DECLARE(pool_tgt_query_v6, DAOS_ISEQ_POOL_TGT_QUERY, DAOS_OSEQ_POOL_TGT_QUERY_V6) CRT_RPC_DECLARE(pool_tgt_query, DAOS_ISEQ_POOL_TGT_QUERY, DAOS_OSEQ_POOL_TGT_QUERY) #define DAOS_ISEQ_POOL_TGT_DIST_HDLS /* input fields */ \ @@ -773,127 +651,127 @@ CRT_RPC_DECLARE(pool_tgt_query, DAOS_ISEQ_POOL_TGT_QUERY, DAOS_OSEQ_POOL_TGT_QUE CRT_RPC_DECLARE(pool_tgt_dist_hdls, DAOS_ISEQ_POOL_TGT_DIST_HDLS, DAOS_OSEQ_POOL_TGT_DIST_HDLS) -#define DAOS_ISEQ_POOL_PROP_GET_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pgi_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_PROP_GET /* input fields */ \ + ((struct pool_op_in) (pgi_op) CRT_VAR) \ ((uint64_t) (pgi_query_bits) CRT_VAR) #define DAOS_OSEQ_POOL_PROP_GET /* output fields */ \ ((struct pool_op_out) (pgo_op) CRT_VAR) \ ((daos_prop_t) (pgo_prop) CRT_PTR) -CRT_RPC_DECLARE(pool_prop_get, DAOS_ISEQ_POOL_PROP_GET_V6, DAOS_OSEQ_POOL_PROP_GET) +CRT_RPC_DECLARE(pool_prop_get, DAOS_ISEQ_POOL_PROP_GET, DAOS_OSEQ_POOL_PROP_GET) /* clang-format on */ static inline void pool_prop_get_in_get_data(crt_rpc_t *rpc, uint64_t *pgi_query_bitsp) { - void *in = crt_req_get(rpc); + struct pool_prop_get_in *in = crt_req_get(rpc); /* engine<->engine RPC, assume same protocol version between them */ - *pgi_query_bitsp = ((struct pool_prop_get_in *)in)->pgi_query_bits; + *pgi_query_bitsp = in->pgi_query_bits; } static inline void pool_prop_get_in_set_data(crt_rpc_t *rpc, uint64_t pgi_query_bits) { - void *in = crt_req_get(rpc); + struct pool_prop_get_in *in = crt_req_get(rpc); - ((struct pool_prop_get_in *)in)->pgi_query_bits = pgi_query_bits; + in->pgi_query_bits = pgi_query_bits; } /* clang-format off */ -#define DAOS_ISEQ_POOL_PROP_SET_V6 /* input fields */ \ - ((struct pool_op_v6_in) (psi_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_PROP_SET /* input fields */ \ + ((struct pool_op_in) (psi_op) CRT_VAR) \ ((daos_prop_t) (psi_prop) CRT_PTR) #define DAOS_OSEQ_POOL_PROP_SET /* output fields */ \ ((struct pool_op_out) (pso_op) CRT_VAR) -CRT_RPC_DECLARE(pool_prop_set, DAOS_ISEQ_POOL_PROP_SET_V6, DAOS_OSEQ_POOL_PROP_SET) +CRT_RPC_DECLARE(pool_prop_set, DAOS_ISEQ_POOL_PROP_SET, DAOS_OSEQ_POOL_PROP_SET) /* clang-format on */ static inline void pool_prop_set_in_get_data(crt_rpc_t *rpc, daos_prop_t **psi_propp) { - void *in = crt_req_get(rpc); + struct pool_prop_set_in *in = crt_req_get(rpc); /* engine<->engine RPC, assume same protocol version between them */ - *psi_propp = ((struct pool_prop_set_in *)in)->psi_prop; + *psi_propp = in->psi_prop; } static inline void pool_prop_set_in_set_data(crt_rpc_t *rpc, daos_prop_t *psi_prop) { - void *in = crt_req_get(rpc); + struct pool_prop_set_in *in = crt_req_get(rpc); - ((struct pool_prop_set_in *)in)->psi_prop = psi_prop; + in->psi_prop = psi_prop; } /* clang-format off */ -#define DAOS_ISEQ_POOL_ACL_UPDATE_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pui_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_ACL_UPDATE /* input fields */ \ + ((struct pool_op_in) (pui_op) CRT_VAR) \ ((struct daos_acl) (pui_acl) CRT_PTR) #define DAOS_OSEQ_POOL_ACL_UPDATE /* output fields */ \ ((struct pool_op_out) (puo_op) CRT_VAR) -CRT_RPC_DECLARE(pool_acl_update, DAOS_ISEQ_POOL_ACL_UPDATE_V6, DAOS_OSEQ_POOL_ACL_UPDATE) +CRT_RPC_DECLARE(pool_acl_update, DAOS_ISEQ_POOL_ACL_UPDATE, DAOS_OSEQ_POOL_ACL_UPDATE) /* clang-format on */ static inline void pool_acl_update_in_get_data(crt_rpc_t *rpc, struct daos_acl **pui_aclp) { - void *in = crt_req_get(rpc); + struct pool_acl_update_in *in = crt_req_get(rpc); /* engine<->engine RPC, assume same protocol version between them */ - *pui_aclp = ((struct pool_acl_update_in *)in)->pui_acl; + *pui_aclp = in->pui_acl; } static inline void pool_acl_update_in_set_data(crt_rpc_t *rpc, struct daos_acl *pui_acl) { - void *in = crt_req_get(rpc); + struct pool_acl_update_in *in = crt_req_get(rpc); - ((struct pool_acl_update_in *)in)->pui_acl = pui_acl; + in->pui_acl = pui_acl; } /* clang-format off */ -#define DAOS_ISEQ_POOL_ACL_DELETE_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pdi_op) CRT_VAR) \ +#define DAOS_ISEQ_POOL_ACL_DELETE /* input fields */ \ + ((struct pool_op_in) (pdi_op) CRT_VAR) \ ((d_const_string_t) (pdi_principal) CRT_VAR) \ ((uint8_t) (pdi_type) CRT_VAR) #define DAOS_OSEQ_POOL_ACL_DELETE /* output fields */ \ ((struct pool_op_out) (pdo_op) CRT_VAR) -CRT_RPC_DECLARE(pool_acl_delete, DAOS_ISEQ_POOL_ACL_DELETE_V6, DAOS_OSEQ_POOL_ACL_DELETE) +CRT_RPC_DECLARE(pool_acl_delete, DAOS_ISEQ_POOL_ACL_DELETE, DAOS_OSEQ_POOL_ACL_DELETE) /* clang-format on */ static inline void pool_acl_delete_in_get_data(crt_rpc_t *rpc, d_const_string_t *pdi_principalp, uint8_t *pdi_typep) { - void *in = crt_req_get(rpc); + struct pool_acl_delete_in *in = crt_req_get(rpc); /* engine<->engine RPC, assume same protocol version between them */ - *pdi_principalp = ((struct pool_acl_delete_in *)in)->pdi_principal; - *pdi_typep = ((struct pool_acl_delete_in *)in)->pdi_type; + *pdi_principalp = in->pdi_principal; + *pdi_typep = in->pdi_type; } static inline void pool_acl_delete_in_set_data(crt_rpc_t *rpc, crt_opcode_t opc, d_const_string_t pdi_principal, uint8_t pdi_type) { - void *in = crt_req_get(rpc); + struct pool_acl_delete_in *in = crt_req_get(rpc); - ((struct pool_acl_delete_in *)in)->pdi_principal = pdi_principal; - ((struct pool_acl_delete_in *)in)->pdi_type = pdi_type; + in->pdi_principal = pdi_principal; + in->pdi_type = pdi_type; } /* clang-format off */ @@ -903,46 +781,32 @@ pool_acl_delete_in_set_data(crt_rpc_t *rpc, crt_opcode_t opc, d_const_string_t p ((crt_bulk_t) (plci_cont_bulk) CRT_VAR) \ ((uint64_t) (plci_ncont) CRT_VAR) -#define DAOS_ISEQ_POOL_LIST_CONT_V6 /* input fields */ \ - ((struct pool_op_v6_in) (plci_op) CRT_VAR) \ - ((crt_bulk_t) (plci_cont_bulk) CRT_VAR) \ - ((uint64_t) (plci_ncont) CRT_VAR) - #define DAOS_OSEQ_POOL_LIST_CONT /* output fields */ \ ((struct pool_op_out) (plco_op) CRT_VAR) \ ((uint64_t) (plco_ncont) CRT_VAR) CRT_RPC_DECLARE(pool_list_cont, DAOS_ISEQ_POOL_LIST_CONT, DAOS_OSEQ_POOL_LIST_CONT) -CRT_RPC_DECLARE(pool_list_cont_v6, DAOS_ISEQ_POOL_LIST_CONT_V6, DAOS_OSEQ_POOL_LIST_CONT) /* clang-format on */ static inline void pool_list_cont_in_get_data(crt_rpc_t *rpc, crt_bulk_t *plci_cont_bulkp, uint64_t *plci_ncontp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *plci_cont_bulkp = ((struct pool_list_cont_v6_in *)in)->plci_cont_bulk; - *plci_ncontp = ((struct pool_list_cont_v6_in *)in)->plci_ncont; - } else { - *plci_cont_bulkp = ((struct pool_list_cont_in *)in)->plci_cont_bulk; - *plci_ncontp = ((struct pool_list_cont_in *)in)->plci_ncont; - } + struct pool_list_cont_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *plci_cont_bulkp = in->plci_cont_bulk; + *plci_ncontp = in->plci_ncont; } static inline void pool_list_cont_in_set_data(crt_rpc_t *rpc, crt_bulk_t plci_cont_bulk, uint64_t plci_ncont) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_list_cont_v6_in *)in)->plci_cont_bulk = plci_cont_bulk; - ((struct pool_list_cont_v6_in *)in)->plci_ncont = plci_ncont; - } else { - ((struct pool_list_cont_in *)in)->plci_cont_bulk = plci_cont_bulk; - ((struct pool_list_cont_in *)in)->plci_ncont = plci_ncont; - } + struct pool_list_cont_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->plci_cont_bulk = plci_cont_bulk; + in->plci_ncont = plci_ncont; } /* clang-format off */ @@ -953,18 +817,11 @@ pool_list_cont_in_set_data(crt_rpc_t *rpc, crt_bulk_t plci_cont_bulk, uint64_t p ((uint64_t) (pfci_ncont) CRT_VAR) \ ((daos_pool_cont_filter_t) (pfci_filt) CRT_VAR) -#define DAOS_ISEQ_POOL_FILTER_CONT_V6 /* input fields */ \ - ((struct pool_op_v6_in) (pfci_op) CRT_VAR) \ - ((crt_bulk_t) (pfci_cont_bulk) CRT_VAR) \ - ((uint64_t) (pfci_ncont) CRT_VAR) \ - ((daos_pool_cont_filter_t) (pfci_filt) CRT_VAR) - #define DAOS_OSEQ_POOL_FILTER_CONT /* output fields */ \ ((struct pool_op_out) (pfco_op) CRT_VAR) \ ((uint64_t) (pfco_ncont) CRT_VAR) CRT_RPC_DECLARE(pool_filter_cont, DAOS_ISEQ_POOL_FILTER_CONT, DAOS_OSEQ_POOL_FILTER_CONT) -CRT_RPC_DECLARE(pool_filter_cont_v6, DAOS_ISEQ_POOL_FILTER_CONT_V6, DAOS_OSEQ_POOL_FILTER_CONT) /* clang-format on */ @@ -972,43 +829,27 @@ static inline void pool_filter_cont_in_get_data(crt_rpc_t *rpc, crt_bulk_t *pfci_cont_bulkp, uint64_t *pfci_ncontp, daos_pool_cont_filter_t **pfci_filtp) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - *pfci_cont_bulkp = ((struct pool_filter_cont_v6_in *)in)->pfci_cont_bulk; - *pfci_ncontp = ((struct pool_filter_cont_v6_in *)in)->pfci_ncont; - *pfci_filtp = &((struct pool_filter_cont_v6_in *)in)->pfci_filt; - } else { - *pfci_cont_bulkp = ((struct pool_filter_cont_in *)in)->pfci_cont_bulk; - *pfci_ncontp = ((struct pool_filter_cont_in *)in)->pfci_ncont; - *pfci_filtp = &((struct pool_filter_cont_in *)in)->pfci_filt; - } + struct pool_filter_cont_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + *pfci_cont_bulkp = in->pfci_cont_bulk; + *pfci_ncontp = in->pfci_ncont; + *pfci_filtp = &in->pfci_filt; } static inline void pool_filter_cont_in_set_data(crt_rpc_t *rpc, crt_bulk_t pfci_cont_bulk, uint64_t pfci_ncont, daos_pool_cont_filter_t *pfci_filt) { - void *in = crt_req_get(rpc); - - if (rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - ((struct pool_filter_cont_v6_in *)in)->pfci_cont_bulk = pfci_cont_bulk; - ((struct pool_filter_cont_v6_in *)in)->pfci_ncont = pfci_ncont; - if (pfci_filt) - ((struct pool_filter_cont_v6_in *)in)->pfci_filt = *pfci_filt; - else - memset(&((struct pool_filter_cont_v6_in *)in)->pfci_filt, 0, - sizeof(daos_pool_cont_filter_t)); - - } else { - ((struct pool_filter_cont_in *)in)->pfci_cont_bulk = pfci_cont_bulk; - ((struct pool_filter_cont_in *)in)->pfci_ncont = pfci_ncont; - if (pfci_filt) - ((struct pool_filter_cont_in *)in)->pfci_filt = *pfci_filt; - else - memset(&((struct pool_filter_cont_in *)in)->pfci_filt, 0, - sizeof(daos_pool_cont_filter_t)); - } + struct pool_filter_cont_in *in = crt_req_get(rpc); + + D_ASSERT(rpc_ver_atleast(rpc, POOL_PROTO_VER_WITH_SVC_OP_KEY)); + in->pfci_cont_bulk = pfci_cont_bulk; + in->pfci_ncont = pfci_ncont; + if (pfci_filt) + in->pfci_filt = *pfci_filt; + else + memset(&in->pfci_filt, 0, sizeof(daos_pool_cont_filter_t)); } /* clang-format off */ @@ -1024,13 +865,13 @@ pool_filter_cont_in_set_data(crt_rpc_t *rpc, crt_bulk_t pfci_cont_bulk, uint64_t CRT_RPC_DECLARE(pool_ranks_get, DAOS_ISEQ_POOL_RANKS_GET, DAOS_OSEQ_POOL_RANKS_GET) -#define DAOS_ISEQ_POOL_UPGRADE_V6 /* input fields */ \ - ((struct pool_op_v6_in) (poi_op) CRT_VAR) +#define DAOS_ISEQ_POOL_UPGRADE /* input fields */ \ + ((struct pool_op_in) (poi_op) CRT_VAR) #define DAOS_OSEQ_POOL_UPGRADE /* output fields */ \ ((struct pool_op_out) (poo_op) CRT_VAR) -CRT_RPC_DECLARE(pool_upgrade, DAOS_ISEQ_POOL_UPGRADE_V6, DAOS_OSEQ_POOL_UPGRADE) +CRT_RPC_DECLARE(pool_upgrade, DAOS_ISEQ_POOL_UPGRADE, DAOS_OSEQ_POOL_UPGRADE) #define DAOS_ISEQ_POOL_TGT_QUERY_MAP /* input fields */ \ ((struct pool_op_in) (tmi_op) CRT_VAR) \ @@ -1063,7 +904,7 @@ pool_req_create(crt_context_t crt_ctx, crt_endpoint_t *tgt_ep, crt_opcode_t opc, crt_opcode_t opcode; static __thread uuid_t cli_id; int proto_ver; - struct pool_op_in *in; + struct pool_op_in *in = crt_req_get(*req); proto_ver = dc_pool_proto_version ? dc_pool_proto_version : DAOS_POOL_VERSION; @@ -1087,12 +928,10 @@ pool_req_create(crt_context_t crt_ctx, crt_endpoint_t *tgt_ep, crt_opcode_t opc, if (req_timep && (*req_timep == 0)) *req_timep = d_hlc_get(); - /* Temporary req_timep check: some opcodes aren't (yet) at v8 and don't have the op key */ - if (req_timep && (proto_ver >= POOL_PROTO_VER_WITH_SVC_OP_KEY)) { - struct pool_op_v6_in *in6 = crt_req_get(*req); - - uuid_copy(in6->pi_cli_id, cli_id); - in6->pi_time = *req_timep; + D_ASSERT(proto_ver >= POOL_PROTO_VER_WITH_SVC_OP_KEY); + if (req_timep) { + uuid_copy(in->pi_cli_id, cli_id); + in->pi_time = *req_timep; } return 0; } diff --git a/src/pool/srv.c b/src/pool/srv.c index 7e5548e8508..452959885ea 100644 --- a/src/pool/srv.c +++ b/src/pool/srv.c @@ -1,5 +1,5 @@ /** - * (C) Copyright 2016-2022 Intel Corporation. + * (C) Copyright 2016-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -118,6 +118,11 @@ static struct crt_corpc_ops ds_pool_tgt_disconnect_co_ops = { .co_pre_forward = NULL, }; +static struct crt_corpc_ops ds_pool_tgt_query_co_ops_v6 = { + .co_aggregate = ds_pool_tgt_query_aggregator_v6, + .co_pre_forward = NULL, +}; + static struct crt_corpc_ops ds_pool_tgt_query_co_ops = { .co_aggregate = ds_pool_tgt_query_aggregator, .co_pre_forward = NULL, @@ -133,11 +138,11 @@ static struct crt_corpc_ops ds_pool_tgt_query_co_ops = { .dr_corpc_ops = e, \ }, -static struct daos_rpc_handler pool_handlers_v5[] = {POOL_PROTO_CLI_RPC_LIST(5) - POOL_PROTO_SRV_RPC_LIST}; - static struct daos_rpc_handler pool_handlers_v6[] = {POOL_PROTO_CLI_RPC_LIST(6) - POOL_PROTO_SRV_RPC_LIST}; + POOL_PROTO_SRV_RPC_LIST(6)}; + +static struct daos_rpc_handler pool_handlers_v7[] = {POOL_PROTO_CLI_RPC_LIST(7) + POOL_PROTO_SRV_RPC_LIST(7)}; #undef X @@ -204,9 +209,9 @@ struct dss_module pool_module = { .sm_fini = fini, .sm_setup = setup, .sm_cleanup = cleanup, - .sm_proto_fmt = {&pool_proto_fmt_v5, &pool_proto_fmt_v6}, + .sm_proto_fmt = {&pool_proto_fmt_v6, &pool_proto_fmt_v7}, .sm_cli_count = {POOL_PROTO_CLI_COUNT, POOL_PROTO_CLI_COUNT}, - .sm_handlers = {pool_handlers_v5, pool_handlers_v6}, + .sm_handlers = {pool_handlers_v6, pool_handlers_v7}, .sm_key = &pool_module_key, .sm_metrics = &pool_metrics, }; diff --git a/src/pool/srv_internal.h b/src/pool/srv_internal.h index 612f7760fd1..2e322abcb94 100644 --- a/src/pool/srv_internal.h +++ b/src/pool/srv_internal.h @@ -162,58 +162,27 @@ int ds_pool_stop_all(void); int ds_pool_hdl_is_from_srv(struct ds_pool *pool, uuid_t hdl); int ds_pool_svc_upgrade_vos_pool(struct ds_pool *pool); void ds_pool_create_handler(crt_rpc_t *rpc); -void - ds_pool_connect_handler_v6(crt_rpc_t *rpc); -void ds_pool_connect_handler_v5(crt_rpc_t *rpc); -void -ds_pool_disconnect_handler_v6(crt_rpc_t *rpc); -void -ds_pool_disconnect_handler_v5(crt_rpc_t *rpc); -void - ds_pool_query_handler_v6(crt_rpc_t *rpc); -void ds_pool_query_handler_v5(crt_rpc_t *rpc); +void ds_pool_connect_handler_v6(crt_rpc_t *rpc); +void ds_pool_connect_handler(crt_rpc_t *rpc); +void ds_pool_disconnect_handler(crt_rpc_t *rpc); +void ds_pool_query_handler_v6(crt_rpc_t *rpc); +void ds_pool_query_handler(crt_rpc_t *rpc); void ds_pool_prop_get_handler(crt_rpc_t *rpc); void ds_pool_prop_set_handler(crt_rpc_t *rpc); void ds_pool_acl_update_handler(crt_rpc_t *rpc); void ds_pool_acl_delete_handler(crt_rpc_t *rpc); -void -ds_pool_update_handler_v6(crt_rpc_t *rpc); -void - ds_pool_update_handler_v5(crt_rpc_t *rpc); +void ds_pool_update_handler(crt_rpc_t *rpc); void ds_pool_extend_handler(crt_rpc_t *rpc); void ds_pool_evict_handler(crt_rpc_t *rpc); -void -ds_pool_svc_stop_handler_v6(crt_rpc_t *rpc); -void -ds_pool_svc_stop_handler_v5(crt_rpc_t *rpc); -void -ds_pool_attr_list_handler_v6(crt_rpc_t *rpc); -void -ds_pool_attr_list_handler_v5(crt_rpc_t *rpc); -void -ds_pool_attr_get_handler_v6(crt_rpc_t *rpc); -void -ds_pool_attr_get_handler_v5(crt_rpc_t *rpc); -void -ds_pool_attr_set_handler_v6(crt_rpc_t *rpc); -void -ds_pool_attr_set_handler_v5(crt_rpc_t *rpc); -void -ds_pool_attr_del_handler_v6(crt_rpc_t *rpc); -void -ds_pool_attr_del_handler_v5(crt_rpc_t *rpc); -void -ds_pool_list_cont_handler_v6(crt_rpc_t *rpc); -void -ds_pool_list_cont_handler_v5(crt_rpc_t *rpc); -void -ds_pool_filter_cont_handler_v6(crt_rpc_t *rpc); -void -ds_pool_filter_cont_handler_v5(crt_rpc_t *rpc); -void -ds_pool_query_info_handler_v6(crt_rpc_t *rpc); -void - ds_pool_query_info_handler_v5(crt_rpc_t *rpc); +void ds_pool_svc_stop_handler(crt_rpc_t *rpc); +void ds_pool_attr_list_handler(crt_rpc_t *rpc); +void ds_pool_attr_get_handler(crt_rpc_t *rpc); +void ds_pool_attr_set_handler(crt_rpc_t *rpc); +void ds_pool_attr_del_handler(crt_rpc_t *rpc); +void ds_pool_list_cont_handler(crt_rpc_t *rpc); +void ds_pool_filter_cont_handler(crt_rpc_t *rpc); +void ds_pool_query_info_handler_v6(crt_rpc_t *rpc); +void ds_pool_query_info_handler(crt_rpc_t *rpc); void ds_pool_ranks_get_handler(crt_rpc_t *rpc); void ds_pool_upgrade_handler(crt_rpc_t *rpc); @@ -228,9 +197,10 @@ void ds_pool_hdl_hash_fini(void); void ds_pool_tgt_disconnect_handler(crt_rpc_t *rpc); int ds_pool_tgt_disconnect_aggregator(crt_rpc_t *source, crt_rpc_t *result, void *priv); +void ds_pool_tgt_query_handler_v6(crt_rpc_t *rpc); void ds_pool_tgt_query_handler(crt_rpc_t *rpc); -int ds_pool_tgt_query_aggregator(crt_rpc_t *source, crt_rpc_t *result, - void *priv); +int ds_pool_tgt_query_aggregator_v6(crt_rpc_t *source, crt_rpc_t *result, void *priv); +int ds_pool_tgt_query_aggregator(crt_rpc_t *source, crt_rpc_t *result, void *priv); void ds_pool_replicas_update_handler(crt_rpc_t *rpc); int ds_pool_tgt_prop_update(struct ds_pool *pool, struct pool_iv_prop *iv_prop); int ds_pool_tgt_connect(struct ds_pool *pool, struct pool_iv_conn *pic); diff --git a/src/pool/srv_pool.c b/src/pool/srv_pool.c index 7fa0f33ea5f..bc6f4b7967c 100644 --- a/src/pool/srv_pool.c +++ b/src/pool/srv_pool.c @@ -228,7 +228,7 @@ static bool pool_disable_exclude; static int pool_prop_read(struct rdb_tx *tx, const struct pool_svc *svc, uint64_t bits, daos_prop_t **prop_out); static int pool_space_query_bcast(crt_context_t ctx, struct pool_svc *svc, - uuid_t pool_hdl, struct daos_pool_space *ps); + uuid_t pool_hdl, struct daos_pool_space *ps, int handler_version); static int ds_pool_upgrade_if_needed(uuid_t pool_uuid, struct rsvc_hint *po_hint, struct pool_svc *svc, crt_rpc_t *rpc); static int @@ -3483,19 +3483,16 @@ static int pool_op_lookup(struct rdb_tx *tx, struct pool_svc *svc, crt_rpc_t *rpc, int pool_proto_ver, bool *is_dup, struct ds_pool_svc_op_val *valp) { - struct pool_op_v6_in *in6 = crt_req_get(rpc); + struct pool_op_in *in = crt_req_get(rpc); crt_opcode_t opc = opc_get(rpc->cr_opc); int rc = 0; - /* If client didn't provide a key (old protocol), skip */ - if (pool_proto_ver < POOL_PROTO_VER_WITH_SVC_OP_KEY) - goto out; - + D_ASSERT(pool_proto_ver >= POOL_PROTO_VER_WITH_SVC_OP_KEY); /* If the operation is not a write, skip (read-only ops not tracked for duplicates) */ if (!pool_op_is_write(opc)) goto out; - rc = ds_pool_svc_ops_lookup(tx, svc, svc->ps_uuid, &in6->pi_cli_id, in6->pi_time, is_dup, + rc = ds_pool_svc_ops_lookup(tx, svc, svc->ps_uuid, &in->pi_cli_id, in->pi_time, is_dup, valp); out: @@ -3590,22 +3587,19 @@ static int pool_op_save(struct rdb_tx *tx, struct pool_svc *svc, crt_rpc_t *rpc, int pool_proto_ver, bool dup_op, int rc_in, struct ds_pool_svc_op_val *op_valp) { - struct pool_op_v6_in *in6 = crt_req_get(rpc); + struct pool_op_in *in = crt_req_get(rpc); crt_opcode_t opc = opc_get(rpc->cr_opc); int rc = 0; if (!dup_op) op_valp->ov_rc = rc_in; - /* If client didn't provide a key (old protocol), skip */ - if (pool_proto_ver < POOL_PROTO_VER_WITH_SVC_OP_KEY) - goto out; - + D_ASSERT(pool_proto_ver >= POOL_PROTO_VER_WITH_SVC_OP_KEY); /* If the operation is not a write, skip (read-only ops not tracked for duplicates) */ if (!pool_op_is_write(opc)) goto out; - rc = ds_pool_svc_ops_save(tx, svc, svc->ps_uuid, &in6->pi_cli_id, in6->pi_time, dup_op, + rc = ds_pool_svc_ops_save(tx, svc, svc->ps_uuid, &in->pi_cli_id, in->pi_time, dup_op, rc_in, op_valp); out: @@ -3815,10 +3809,11 @@ bulk_cb(const struct crt_bulk_cb_info *cb_info) #define NUM_POOL_VERSIONS 2 static void -ds_pool_connect_handler(crt_rpc_t *rpc, int handler_version) +pool_connect_handler(crt_rpc_t *rpc, int handler_version) { struct pool_connect_in *in = crt_req_get(rpc); struct pool_connect_out *out = crt_reply_get(rpc); + struct pool_connect_v6_out *out6 = crt_reply_get(rpc); struct pool_svc *svc; struct pool_buf *map_buf = NULL; uint32_t map_version; @@ -3861,8 +3856,7 @@ ds_pool_connect_handler(crt_rpc_t *rpc, int handler_version) fi_pass_nl_noreply = DAOS_FAIL_CHECK(DAOS_MD_OP_PASS_NOREPLY_NEWLDR); fi_fail_nl_noreply = DAOS_FAIL_CHECK(DAOS_MD_OP_FAIL_NOREPLY_NEWLDR); - rc = pool_svc_lookup_leader(in->pci_op.pi_uuid, &svc, - &out->pco_op.po_hint); + rc = pool_svc_lookup_leader(in->pci_op.pi_uuid, &svc, &out->pco_op.po_hint); if (rc != 0) D_GOTO(out, rc); @@ -3870,7 +3864,10 @@ ds_pool_connect_handler(crt_rpc_t *rpc, int handler_version) pool_connect_in_get_data(rpc, &flags, &query_bits, &bulk, &cli_pool_version); if (query_bits & DAOS_PO_QUERY_REBUILD_STATUS) { - rc = ds_rebuild_query(in->pci_op.pi_uuid, &out->pco_rebuild_st); + if (handler_version == 6) + rc = ds_rebuild_query(in->pci_op.pi_uuid, &out6->pco_rebuild_st); + else + rc = ds_rebuild_query(in->pci_op.pi_uuid, &out->pco_rebuild_st); if (rc != 0) D_GOTO(out_svc, rc); } @@ -4150,14 +4147,19 @@ ds_pool_connect_handler(crt_rpc_t *rpc, int handler_version) } if ((rc == 0) && (query_bits & DAOS_PO_QUERY_SPACE)) - rc = pool_space_query_bcast(rpc->cr_ctx, svc, in->pci_op.pi_hdl, &out->pco_space); + rc = pool_space_query_bcast(rpc->cr_ctx, svc, in->pci_op.pi_hdl, &out->pco_space, + handler_version); out_lock: ABT_rwlock_unlock(svc->ps_lock); rdb_tx_end(&tx); if (rc == 0 && transfer_map) { - rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, - &out->pco_map_buf_size); + if (handler_version == 6) + rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, + &out6->pco_map_buf_size); + else + rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, + &out->pco_map_buf_size); /** TODO: roll back tx if transfer fails? Perhaps rdb_tx_discard()? */ } if (rc == 0) @@ -4203,13 +4205,13 @@ ds_pool_connect_handler(crt_rpc_t *rpc, int handler_version) void ds_pool_connect_handler_v6(crt_rpc_t *rpc) { - ds_pool_connect_handler(rpc, 6); + pool_connect_handler(rpc, 6); } void -ds_pool_connect_handler_v5(crt_rpc_t *rpc) +ds_pool_connect_handler(crt_rpc_t *rpc) { - ds_pool_connect_handler(rpc, 5); + pool_connect_handler(rpc, DAOS_POOL_VERSION); } static int @@ -4315,7 +4317,7 @@ pool_disconnect_hdls(struct rdb_tx *tx, struct pool_svc *svc, uuid_t *hdl_uuids, } static void -ds_pool_disconnect_handler(crt_rpc_t *rpc, int handler_version) +pool_disconnect_handler(crt_rpc_t *rpc, int handler_version) { struct pool_disconnect_in *pdi = crt_req_get(rpc); struct pool_disconnect_out *pdo = crt_reply_get(rpc); @@ -4331,13 +4333,11 @@ ds_pool_disconnect_handler(crt_rpc_t *rpc, int handler_version) D_DEBUG(DB_MD, DF_UUID ": processing rpc: %p hdl=" DF_UUID "\n", DP_UUID(pdi->pdi_op.pi_uuid), rpc, DP_UUID(pdi->pdi_op.pi_hdl)); - if (handler_version >= POOL_PROTO_VER_WITH_SVC_OP_KEY) { - struct pool_disconnect_v6_in *in6 = crt_req_get(rpc); - D_DEBUG(DB_MD, DF_UUID ": client= " DF_UUID ", time=" DF_X64 "\n", - DP_UUID(pdi->pdi_op.pi_uuid), DP_UUID(in6->pdi_op.pi_cli_id), - in6->pdi_op.pi_time); - } + D_ASSERT(handler_version >= POOL_PROTO_VER_WITH_SVC_OP_KEY); + D_DEBUG(DB_MD, DF_UUID ": client= " DF_UUID ", time=" DF_X64 "\n", + DP_UUID(pdi->pdi_op.pi_uuid), DP_UUID(pdi->pdi_op.pi_cli_id), + pdi->pdi_op.pi_time); rc = pool_svc_lookup_leader(pdi->pdi_op.pi_uuid, &svc, &pdo->pdo_op.po_hint); @@ -4417,20 +4417,14 @@ ds_pool_disconnect_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_disconnect_handler_v6(crt_rpc_t *rpc) +ds_pool_disconnect_handler(crt_rpc_t *rpc) { - ds_pool_disconnect_handler(rpc, 6); -} - -void -ds_pool_disconnect_handler_v5(crt_rpc_t *rpc) -{ - ds_pool_disconnect_handler(rpc, 5); + pool_disconnect_handler(rpc, DAOS_POOL_VERSION); } static int pool_space_query_bcast(crt_context_t ctx, struct pool_svc *svc, uuid_t pool_hdl, - struct daos_pool_space *ps) + struct daos_pool_space *ps, int handler_version) { struct pool_tgt_query_in *in; struct pool_tgt_query_out *out; @@ -4455,17 +4449,26 @@ pool_space_query_bcast(crt_context_t ctx, struct pool_svc *svc, uuid_t pool_hdl, if (rc != 0) goto out_rpc; - out = crt_reply_get(rpc); - rc = out->tqo_rc; + D_ASSERT(ps != NULL); + if (handler_version == 6) { + struct pool_tgt_query_v6_out *out6 = crt_reply_get(rpc); + struct daos_pool_space_v6 *ps6 = (struct daos_pool_space_v6 *)ps; + + rc = out6->tqo_rc; + if (rc == 0) + *ps6 = out6->tqo_space; + } else { + out = crt_reply_get(rpc); + rc = out->tqo_rc; + if (rc == 0) + *ps = out->tqo_space; + } + if (rc != 0) { D_ERROR(DF_UUID ": failed to query from targets: " DF_RC "\n", DP_UUID(svc->ps_uuid), DP_RC(rc)); rc = -DER_IO; - } else { - D_ASSERT(ps != NULL); - *ps = out->tqo_space; } - out_rpc: crt_req_decref(rpc); out: @@ -4666,7 +4669,7 @@ static bool is_pool_from_srv(uuid_t pool_uuid, uuid_t poh_uuid); * Requires a pool handle (except for rebuild). */ static void -ds_pool_list_cont_handler(crt_rpc_t *rpc, int handler_version) +pool_list_cont_handler(crt_rpc_t *rpc, int handler_version) { struct pool_list_cont_in *in = crt_req_get(rpc); struct pool_list_cont_out *out = crt_reply_get(rpc); @@ -4758,15 +4761,9 @@ ds_pool_list_cont_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_list_cont_handler_v6(crt_rpc_t *rpc) -{ - ds_pool_list_cont_handler(rpc, 6); -} - -void -ds_pool_list_cont_handler_v5(crt_rpc_t *rpc) +ds_pool_list_cont_handler(crt_rpc_t *rpc) { - ds_pool_list_cont_handler(rpc, 5); + pool_list_cont_handler(rpc, DAOS_POOL_VERSION); } /* TODO: consider moving to common function for client and engine use */ @@ -4812,7 +4809,7 @@ pool_cont_filter_is_valid(uuid_t pool_uuid, daos_pool_cont_filter_t *filt) * Requires a pool handle. */ static void -ds_pool_filter_cont_handler(crt_rpc_t *rpc, int handler_version) +pool_filter_cont_handler(crt_rpc_t *rpc, int handler_version) { struct pool_filter_cont_in *in = crt_req_get(rpc); struct pool_filter_cont_out *out = crt_reply_get(rpc); @@ -4910,22 +4907,17 @@ ds_pool_filter_cont_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_filter_cont_handler_v6(crt_rpc_t *rpc) -{ - ds_pool_filter_cont_handler(rpc, 6); -} - -void -ds_pool_filter_cont_handler_v5(crt_rpc_t *rpc) +ds_pool_filter_cont_handler(crt_rpc_t *rpc) { - ds_pool_filter_cont_handler(rpc, 5); + pool_filter_cont_handler(rpc, DAOS_POOL_VERSION); } static void -ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) +pool_query_handler(crt_rpc_t *rpc, int handler_version) { struct pool_query_in *in = crt_req_get(rpc); struct pool_query_out *out = crt_reply_get(rpc); + struct pool_query_v6_out *out6 = crt_reply_get(rpc); daos_prop_t *prop = NULL; struct pool_buf *map_buf; uint32_t map_version = 0; @@ -4950,7 +4942,10 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) pool_query_in_get_data(rpc, &bulk, &query_bits); if (query_bits & DAOS_PO_QUERY_REBUILD_STATUS) { - rc = ds_rebuild_query(in->pqi_op.pi_uuid, &out->pqo_rebuild_st); + if (handler_version == 6) + rc = ds_rebuild_query(in->pqi_op.pi_uuid, &out6->pqo_rebuild_st); + else + rc = ds_rebuild_query(in->pqi_op.pi_uuid, &out->pqo_rebuild_st); if (rc != 0) D_GOTO(out_svc, rc); } @@ -4984,8 +4979,13 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) entry = daos_prop_entry_get(prop, DAOS_PROP_PO_GLOBAL_VERSION); D_ASSERT(entry != NULL); - out->pqo_pool_layout_ver = entry->dpe_val; - out->pqo_upgrade_layout_ver = DAOS_POOL_GLOBAL_VERSION; + if (handler_version == 6) { + out6->pqo_pool_layout_ver = entry->dpe_val; + out6->pqo_upgrade_layout_ver = DAOS_POOL_GLOBAL_VERSION; + } else { + out->pqo_pool_layout_ver = entry->dpe_val; + out->pqo_upgrade_layout_ver = DAOS_POOL_GLOBAL_VERSION; + } daos_prop_free(prop); prop = NULL; @@ -5103,7 +5103,12 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) if (rc != 0) goto out_svc; - rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, &out->pqo_map_buf_size); + if (handler_version == 6) + rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, + &out6->pqo_map_buf_size); + else + rc = ds_pool_transfer_map_buf(map_buf, map_version, rpc, bulk, + &out->pqo_map_buf_size); D_FREE(map_buf); if (rc != 0) goto out_svc; @@ -5113,7 +5118,7 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) /* See comment above, rebuild doesn't connect the pool */ if (query_bits & DAOS_PO_QUERY_SPACE) { rc = pool_space_query_bcast(rpc->cr_ctx, svc, in->pqi_op.pi_hdl, - &out->pqo_space); + &out->pqo_space, handler_version); if (unlikely(rc)) goto out_svc; @@ -5138,15 +5143,15 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_query_handler_v5(crt_rpc_t *rpc) +ds_pool_query_handler_v6(crt_rpc_t *rpc) { - ds_pool_query_handler(rpc, 5); + pool_query_handler(rpc, 6); } void -ds_pool_query_handler_v6(crt_rpc_t *rpc) +ds_pool_query_handler(crt_rpc_t *rpc) { - ds_pool_query_handler(rpc, 6); + pool_query_handler(rpc, DAOS_POOL_VERSION); } /* Convert pool_comp_state_t to daos_target_state_t */ @@ -5168,7 +5173,7 @@ enum_pool_comp_state_to_tgt_state(int tgt_state) static int pool_query_tgt_space(crt_context_t ctx, struct pool_svc *svc, uuid_t pool_hdl, - d_rank_t rank, uint32_t tgt_idx, struct daos_space *ds) + d_rank_t rank, uint32_t tgt_idx, struct daos_space *ds, int handler_version) { struct pool_tgt_query_in *in; struct pool_tgt_query_out *out; @@ -5198,26 +5203,34 @@ pool_query_tgt_space(crt_context_t ctx, struct pool_svc *svc, uuid_t pool_hdl, if (rc != 0) goto out_rpc; - out = crt_reply_get(rpc); - rc = out->tqo_rc; - if (rc != 0) { - D_ERROR(DF_UUID": failed to query rank:%u, tgt:%u, "DF_RC"\n", - DP_UUID(svc->ps_uuid), rank, tgt_idx, DP_RC(rc)); + D_ASSERT(ds != NULL); + if (handler_version == 6) { + struct pool_tgt_query_v6_out *out6 = crt_reply_get(rpc); + struct daos_space_v6 *ds6 = (struct daos_space_v6 *)ds; + + rc = out6->tqo_rc; + if (rc == 0) + *ds6 = out6->tqo_space.ps_space; } else { - D_ASSERT(ds != NULL); - *ds = out->tqo_space.ps_space; + out = crt_reply_get(rpc); + rc = out->tqo_rc; + if (rc == 0) + *ds = out->tqo_space.ps_space; } - + if (rc != 0) + D_ERROR(DF_UUID": failed to query rank:%u, tgt:%u, "DF_RC"\n", + DP_UUID(svc->ps_uuid), rank, tgt_idx, DP_RC(rc)); out_rpc: crt_req_decref(rpc); return rc; } static void -ds_pool_query_info_handler(crt_rpc_t *rpc, int handler_version) +pool_query_info_handler(crt_rpc_t *rpc, int handler_version) { struct pool_query_info_in *in = crt_req_get(rpc); struct pool_query_info_out *out = crt_reply_get(rpc); + struct pool_query_info_v6_out *out6 = crt_reply_get(rpc); struct pool_svc *svc; struct pool_target *target = NULL; int tgt_state; @@ -5250,20 +5263,26 @@ ds_pool_query_info_handler(crt_rpc_t *rpc, int handler_version) D_ASSERT(target != NULL); tgt_state = target->ta_comp.co_status; - out->pqio_state = enum_pool_comp_state_to_tgt_state(tgt_state); - out->pqio_op.po_map_version = - pool_map_get_version(svc->ps_pool->sp_map); + if (handler_version == 6) { + out6->pqio_state = enum_pool_comp_state_to_tgt_state(tgt_state); + } else { + out->pqio_state = enum_pool_comp_state_to_tgt_state(tgt_state); + } + out->pqio_op.po_map_version = pool_map_get_version(svc->ps_pool->sp_map); ABT_rwlock_unlock(svc->ps_pool->sp_lock); if (tgt_state == PO_COMP_ST_UPIN) { rc = pool_query_tgt_space(rpc->cr_ctx, svc, in->pqii_op.pi_hdl, rank, tgt, - &out->pqio_space); + &out->pqio_space, handler_version); if (rc) DL_ERROR(rc, DF_UUID ": Failed to query rank:%u, tgt:%d", DP_UUID(in->pqii_op.pi_uuid), rank, tgt); } else { - memset(&out->pqio_space, 0, sizeof(out->pqio_space)); + if (handler_version == 6) + memset(&out6->pqio_space, 0, sizeof(out6->pqio_space)); + else + memset(&out->pqio_space, 0, sizeof(out->pqio_space)); } out_svc: ds_rsvc_set_hint(&svc->ps_rsvc, &out->pqio_op.po_hint); @@ -5281,13 +5300,13 @@ ds_pool_query_info_handler(crt_rpc_t *rpc, int handler_version) void ds_pool_query_info_handler_v6(crt_rpc_t *rpc) { - ds_pool_query_info_handler(rpc, 6); + pool_query_info_handler(rpc, 6); } void -ds_pool_query_info_handler_v5(crt_rpc_t *rpc) +ds_pool_query_info_handler(crt_rpc_t *rpc) { - ds_pool_query_info_handler(rpc, 5); + pool_query_info_handler(rpc, DAOS_POOL_VERSION); } /** @@ -7404,7 +7423,7 @@ pool_discard(crt_context_t ctx, struct pool_svc *svc, struct pool_target_addr_li } static void -ds_pool_update_handler(crt_rpc_t *rpc, int handler_version) +pool_update_handler(crt_rpc_t *rpc, int handler_version) { struct pool_tgt_update_in *in = crt_req_get(rpc); struct pool_tgt_update_out *out = crt_reply_get(rpc); @@ -7454,15 +7473,9 @@ ds_pool_update_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_update_handler_v6(crt_rpc_t *rpc) +ds_pool_update_handler(crt_rpc_t *rpc) { - ds_pool_update_handler(rpc, 6); -} - -void -ds_pool_update_handler_v5(crt_rpc_t *rpc) -{ - ds_pool_update_handler(rpc, 5); + pool_update_handler(rpc, DAOS_POOL_VERSION); } static int @@ -7960,7 +7973,7 @@ ds_pool_ranks_get_handler(crt_rpc_t *rpc) /* This RPC could be implemented by ds_rsvc. */ static void -ds_pool_svc_stop_handler(crt_rpc_t *rpc, int handler_version) +pool_svc_stop_handler(crt_rpc_t *rpc, int handler_version) { struct pool_svc_stop_in *in = crt_req_get(rpc); struct pool_svc_stop_out *out = crt_reply_get(rpc); @@ -7980,15 +7993,9 @@ ds_pool_svc_stop_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_svc_stop_handler_v6(crt_rpc_t *rpc) +ds_pool_svc_stop_handler(crt_rpc_t *rpc) { - ds_pool_svc_stop_handler(rpc, 6); -} - -void -ds_pool_svc_stop_handler_v5(crt_rpc_t *rpc) -{ - ds_pool_svc_stop_handler(rpc, 5); + pool_svc_stop_handler(rpc, DAOS_POOL_VERSION); } /** @@ -8071,7 +8078,7 @@ ds_pool_svc_term_get(uuid_t uuid, uint64_t *term) } static void -ds_pool_attr_set_handler(crt_rpc_t *rpc, int handler_version) +pool_attr_set_handler(crt_rpc_t *rpc, int handler_version) { struct pool_attr_set_in *in = crt_req_get(rpc); struct pool_op_out *out = crt_reply_get(rpc); @@ -8147,19 +8154,13 @@ ds_pool_attr_set_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_attr_set_handler_v6(crt_rpc_t *rpc) +ds_pool_attr_set_handler(crt_rpc_t *rpc) { - ds_pool_attr_set_handler(rpc, 6); -} - -void -ds_pool_attr_set_handler_v5(crt_rpc_t *rpc) -{ - ds_pool_attr_set_handler(rpc, 5); + pool_attr_set_handler(rpc, DAOS_POOL_VERSION); } static void -ds_pool_attr_del_handler(crt_rpc_t *rpc, int handler_version) +pool_attr_del_handler(crt_rpc_t *rpc, int handler_version) { struct pool_attr_del_in *in = crt_req_get(rpc); struct pool_op_out *out = crt_reply_get(rpc); @@ -8234,19 +8235,13 @@ ds_pool_attr_del_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_attr_del_handler_v6(crt_rpc_t *rpc) -{ - ds_pool_attr_del_handler(rpc, 6); -} - -void -ds_pool_attr_del_handler_v5(crt_rpc_t *rpc) +ds_pool_attr_del_handler(crt_rpc_t *rpc) { - ds_pool_attr_del_handler(rpc, 5); + pool_attr_del_handler(rpc, DAOS_POOL_VERSION); } static void -ds_pool_attr_get_handler(crt_rpc_t *rpc, int handler_version) +pool_attr_get_handler(crt_rpc_t *rpc, int handler_version) { struct pool_attr_get_in *in = crt_req_get(rpc); struct pool_op_out *out = crt_reply_get(rpc); @@ -8285,19 +8280,13 @@ ds_pool_attr_get_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_attr_get_handler_v6(crt_rpc_t *rpc) -{ - ds_pool_attr_get_handler(rpc, 6); -} - -void -ds_pool_attr_get_handler_v5(crt_rpc_t *rpc) +ds_pool_attr_get_handler(crt_rpc_t *rpc) { - ds_pool_attr_get_handler(rpc, 5); + pool_attr_get_handler(rpc, DAOS_POOL_VERSION); } static void -ds_pool_attr_list_handler(crt_rpc_t *rpc, int handler_version) +pool_attr_list_handler(crt_rpc_t *rpc, int handler_version) { struct pool_attr_list_in *in = crt_req_get(rpc); struct pool_attr_list_out *out = crt_reply_get(rpc); @@ -8335,15 +8324,9 @@ ds_pool_attr_list_handler(crt_rpc_t *rpc, int handler_version) } void -ds_pool_attr_list_handler_v6(crt_rpc_t *rpc) -{ - ds_pool_attr_list_handler(rpc, 6); -} - -void -ds_pool_attr_list_handler_v5(crt_rpc_t *rpc) +ds_pool_attr_list_handler(crt_rpc_t *rpc) { - ds_pool_attr_list_handler(rpc, 5); + pool_attr_list_handler(rpc, DAOS_POOL_VERSION); } void diff --git a/src/pool/srv_target.c b/src/pool/srv_target.c index bf64b7aacab..70f78765362 100644 --- a/src/pool/srv_target.c +++ b/src/pool/srv_target.c @@ -1495,6 +1495,7 @@ aggregate_pool_space(struct daos_pool_space *agg_ps, agg_ps->ps_free_mean[i] = agg_ps->ps_space.s_free[i] / agg_ps->ps_ntargets; } + agg_ps->ps_space.s_total_mem += ps->ps_space.s_total_mem; } struct pool_query_xs_arg { @@ -1561,6 +1562,7 @@ pool_query_space(uuid_t pool_uuid, struct daos_pool_space *x_ps) x_ps->ps_ntargets = 1; x_ps->ps_space.s_total[DAOS_MEDIA_SCM] = SCM_TOTAL(vps); x_ps->ps_space.s_total[DAOS_MEDIA_NVME] = NVME_TOTAL(vps); + x_ps->ps_space.s_total_mem = vps->vps_space.s_total_mem; /* Exclude the sys reserved space before reporting to user */ if (SCM_FREE(vps) > SCM_SYS(vps)) @@ -1943,17 +1945,39 @@ ds_pool_tgt_map_update(struct ds_pool *pool, struct pool_buf *buf, return rc; } -void -ds_pool_tgt_query_handler(crt_rpc_t *rpc) +static inline void +dps_to_dpsv6(struct daos_pool_space *ps, struct daos_pool_space_v6 *ps6) +{ + int i; + + ps6->ps_ntargets = ps->ps_ntargets; + for (i = DAOS_MEDIA_SCM; i < DAOS_MEDIA_MAX; i++) { + ps6->ps_space.s_total[i] = ps->ps_space.s_total[i]; + ps6->ps_space.s_free[i] = ps->ps_space.s_free[i]; + + ps6->ps_free_max[i] = ps->ps_free_max[i]; + ps6->ps_free_min[i] = ps->ps_free_min[i]; + ps6->ps_free_mean[i] = ps->ps_free_mean[i]; + } +} + +static void +pool_tgt_query_handler(crt_rpc_t *rpc, int handler_version) { struct pool_tgt_query_in *in = crt_req_get(rpc); struct pool_tgt_query_out *out = crt_reply_get(rpc); + struct daos_pool_space out_space = { 0 }, *ps; struct ds_pool *pool; int rc; + if (handler_version == 6) + ps = &out_space; + else + ps = &out->tqo_space; + /* Single target query */ if (dss_get_module_info()->dmi_xs_id != 0) { - rc = pool_query_space(in->tqi_op.pi_uuid, &out->tqo_space); + rc = pool_query_space(in->tqi_op.pi_uuid, ps); goto out; } @@ -1965,15 +1989,78 @@ ds_pool_tgt_query_handler(crt_rpc_t *rpc) D_GOTO(out, rc = -DER_NONEXIST); } - rc = pool_tgt_query(pool, &out->tqo_space); + rc = pool_tgt_query(pool, ps); if (rc != 0) rc = 1; /* For query aggregator */ ds_pool_put(pool); out: - out->tqo_rc = rc; + if (handler_version == 6) { + struct pool_tgt_query_v6_out *out6 = crt_reply_get(rpc); + + out6->tqo_rc = rc; + dps_to_dpsv6(ps, &out6->tqo_space); + } else { + out->tqo_rc = rc; + } crt_reply_send(rpc); } +void +ds_pool_tgt_query_handler_v6(crt_rpc_t *rpc) +{ + pool_tgt_query_handler(rpc, 6); +} + +void +ds_pool_tgt_query_handler(crt_rpc_t *rpc) +{ + pool_tgt_query_handler(rpc, DAOS_POOL_VERSION); +} + +static void +aggregate_pool_space_v6(struct daos_pool_space_v6 *agg_ps, struct daos_pool_space_v6 *ps) +{ + int i; + bool first; + + D_ASSERT(agg_ps && ps); + + if (ps->ps_ntargets == 0) { + D_DEBUG(DB_TRACE, "Skip empty space info\n"); + return; + } + + first = (agg_ps->ps_ntargets == 0); + agg_ps->ps_ntargets += ps->ps_ntargets; + + for (i = DAOS_MEDIA_SCM; i < DAOS_MEDIA_MAX; i++) { + agg_ps->ps_space.s_total[i] += ps->ps_space.s_total[i]; + agg_ps->ps_space.s_free[i] += ps->ps_space.s_free[i]; + + if (agg_ps->ps_free_max[i] < ps->ps_free_max[i]) + agg_ps->ps_free_max[i] = ps->ps_free_max[i]; + if (agg_ps->ps_free_min[i] > ps->ps_free_min[i] || first) + agg_ps->ps_free_min[i] = ps->ps_free_min[i]; + + agg_ps->ps_free_mean[i] = agg_ps->ps_space.s_free[i] / + agg_ps->ps_ntargets; + } +} + +int +ds_pool_tgt_query_aggregator_v6(crt_rpc_t *source, crt_rpc_t *result, void *priv) +{ + struct pool_tgt_query_v6_out *out_source = crt_reply_get(source); + struct pool_tgt_query_v6_out *out_result = crt_reply_get(result); + + out_result->tqo_rc += out_source->tqo_rc; + if (out_source->tqo_rc != 0) + return 0; + + aggregate_pool_space_v6(&out_result->tqo_space, &out_source->tqo_space); + return 0; +} + int ds_pool_tgt_query_aggregator(crt_rpc_t *source, crt_rpc_t *result, void *priv) { diff --git a/src/vos/vos_layout.h b/src/vos/vos_layout.h index 87d092bc882..88b6351d8f1 100644 --- a/src/vos/vos_layout.h +++ b/src/vos/vos_layout.h @@ -119,8 +119,10 @@ struct vos_gc_bkt_df { struct vos_pool_ext_df { /* Extension for GC bucket */ struct vos_gc_bkt_df ped_gc_bkt; + /* Memory file size for md-on-ssd phase2 pool */ + uint64_t ped_mem_sz; /* Paddings for other potential new feature */ - uint64_t ped_paddings[54]; + uint64_t ped_paddings[53]; /* Reserved for future extension */ uint64_t ped_reserve; }; diff --git a/src/vos/vos_pool.c b/src/vos/vos_pool.c index dcf11cfdcca..d108873ae42 100644 --- a/src/vos/vos_pool.c +++ b/src/vos/vos_pool.c @@ -1226,6 +1226,7 @@ vos_pool_create_ex(const char *path, uuid_t uuid, daos_size_t scm_sz, daos_size_ daos_handle_t hdl; struct d_uuid ukey; struct vos_pool *pool = NULL; + struct vos_pool_ext_df *pd_ext_df; int rc = 0; if (!path || uuid_is_null(uuid) || daos_file_is_dax(path)) @@ -1326,6 +1327,10 @@ vos_pool_create_ex(const char *path, uuid_t uuid, daos_size_t scm_sz, daos_size_ pool_df->pd_version = 0; else pool_df->pd_version = version; + + /* pd_ext is newly allocated, no need to call tx_add_ptr() */ + pd_ext_df = umem_off2ptr(&umem, pool_df->pd_ext); + pd_ext_df->ped_mem_sz = scm_sz; end: /** * The transaction can in reality be aborted diff --git a/src/vos/vos_space.c b/src/vos/vos_space.c index 35a407e2b3e..f87fc51b906 100644 --- a/src/vos/vos_space.c +++ b/src/vos/vos_space.c @@ -145,6 +145,11 @@ vos_space_query(struct vos_pool *pool, struct vos_pool_space *vps, bool slow) /* Query non-evictable zones usage when the phase2 pool is evictable */ if (vos_pool_is_evictable(pool)) { + struct vos_pool_ext_df *pd_ext_df = umem_off2ptr(vos_pool2umm(pool), df->pd_ext); + + D_ASSERT(pd_ext_df != NULL); + vps->vps_space.s_total_mem = pd_ext_df->ped_mem_sz; + rc = umempobj_get_mbusage(vos_pool2umm(pool)->umm_pool, UMEM_DEFAULT_MBKT_ID, &ne_used, &vps->vps_ne_total); if (rc) { @@ -160,6 +165,7 @@ vos_space_query(struct vos_pool *pool, struct vos_pool_space *vps, bool slow) } vps->vps_ne_free = vps->vps_ne_total - ne_used; } else { + vps->vps_space.s_total_mem = SCM_TOTAL(vps); vps->vps_ne_total = 0; vps->vps_ne_free = 0; }