Skip to content

Commit

Permalink
DAOS-16209 pool: return mem file size on pool query
Browse files Browse the repository at this point in the history
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 <yawei.niu@intel.com>
  • Loading branch information
NiuYawei committed Nov 19, 2024
1 parent 0b6ff63 commit ea78bbd
Show file tree
Hide file tree
Showing 11 changed files with 534 additions and 639 deletions.
24 changes: 24 additions & 0 deletions src/include/daos_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Check warning on line 77 in src/include/daos_pool.h

View workflow job for this annotation

GitHub Actions / Doxygen

Compound daos_space_v6 is not documented.
/** Total space in bytes */
uint64_t s_total[DAOS_MEDIA_MAX];
/** Free space in bytes */
uint64_t s_free[DAOS_MEDIA_MAX];
};

/** Target information */
Expand Down Expand Up @@ -100,6 +109,21 @@ struct daos_pool_space {
uint32_t ps_padding;
};

struct daos_pool_space_v6 {

Check warning on line 112 in src/include/daos_pool.h

View workflow job for this annotation

GitHub Actions / Doxygen

Compound daos_pool_space_v6 is not documented.
/** 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,
Expand Down
10 changes: 5 additions & 5 deletions src/pool/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
68 changes: 21 additions & 47 deletions src/pool/rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down
Loading

0 comments on commit ea78bbd

Please sign in to comment.