Skip to content

Commit

Permalink
DAOS-14535 pool: start/stop ds_pool_child individually (#13347) (#14431)
Browse files Browse the repository at this point in the history
Reorganize ds_pool_child start/stop code to make it able to be
started/stopped individually:

- Introduced four states for ds_pool_child: NEW, STARTING, STARTED
  and STOPPING.
- ds_pool_child is added/removed to/from cache through the collective
  call of pool_child_add/delete_one(), now the cache doesn't hold the
  ds_pool_child reference anymore.
- Introduced ds_pool_child_start/stop() for callers to start/stop
  ds_pool_child individually, ds_pool_child_state() to query the state
  of ds_pool_child.
- Removed ds_pool_child_get();

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
  • Loading branch information
jolivier23 authored May 24, 2024
1 parent 7687853 commit 28d189a
Show file tree
Hide file tree
Showing 3 changed files with 285 additions and 113 deletions.
2 changes: 1 addition & 1 deletion src/container/srv_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ ds_cont_local_open(uuid_t pool_uuid, uuid_t cont_hdl_uuid, uuid_t cont_uuid,
if (ddra == NULL)
D_GOTO(err_dtx, rc = -DER_NOMEM);

ddra->pool = ds_pool_child_get(hdl->sch_cont->sc_pool);
ddra->pool = ds_pool_child_lookup(hdl->sch_cont->sc_pool->spc_uuid);
uuid_copy(ddra->co_uuid, cont_uuid);
rc = dss_ult_create(ds_dtx_resync, ddra, DSS_XS_SELF,
0, 0, NULL);
Expand Down
22 changes: 19 additions & 3 deletions src/include/daos_srv/pool.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -57,6 +57,7 @@ struct ds_pool {
ABT_cond sp_fetch_hdls_cond;
ABT_cond sp_fetch_hdls_done_cond;
struct ds_iv_ns *sp_iv_ns;
uint32_t *sp_states; /* pool child state array */

/* structure related to EC aggregate epoch query */
d_list_t sp_ec_ephs_list;
Expand Down Expand Up @@ -127,6 +128,13 @@ struct ds_pool_hdl {
struct ds_pool_hdl *ds_pool_hdl_lookup(const uuid_t uuid);
void ds_pool_hdl_put(struct ds_pool_hdl *hdl);

enum pool_child_state {
POOL_CHILD_NEW = 0,
POOL_CHILD_STARTING,
POOL_CHILD_STARTED,
POOL_CHILD_STOPPING,
};

/*
* Per-thread pool object
*
Expand Down Expand Up @@ -159,8 +167,9 @@ struct ds_pool_child {
int spc_ref;
ABT_eventual spc_ref_eventual;

uint64_t spc_discard_done:1;
uint32_t spc_discard_done:1;
uint32_t spc_reint_mode;
uint32_t *spc_state; /* Pointer to ds_pool->sp_states[i] */
/**
* Per-pool per-module metrics, see ${modname}_pool_metrics for the
* actual structure. Initialized only for modules that specified a
Expand All @@ -170,9 +179,16 @@ struct ds_pool_child {
void *spc_metrics[DAOS_NR_MODULE];
};

/* Find ds_pool_child in cache, hold one reference */
struct ds_pool_child *ds_pool_child_lookup(const uuid_t uuid);
struct ds_pool_child *ds_pool_child_get(struct ds_pool_child *child);
/* Put the reference held by ds_pool_child_lookup() */
void ds_pool_child_put(struct ds_pool_child *child);
/* Start ds_pool child */
int ds_pool_child_start(uuid_t pool_uuid);
/* Stop ds_pool_child */
int ds_pool_child_stop(uuid_t pool_uuid);
/* Query pool child state */
uint32_t ds_pool_child_state(struct ds_pool *pool, uint32_t tgt_id);

int ds_pool_bcast_create(crt_context_t ctx, struct ds_pool *pool,
enum daos_module_id module, crt_opcode_t opcode,
Expand Down
Loading

0 comments on commit 28d189a

Please sign in to comment.