Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

m0_confc_init_wait(): initialise bob earlier #1759

Merged
merged 4 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conf/confc.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ static const struct m0_bob_type confc_bob = {
.bt_magix = M0_CONFC_MAGIC,
.bt_check = _confc_check
};
M0_BOB_DEFINE(static, &confc_bob, m0_confc);
M0_BOB_DEFINE(M0_INTERNAL, &confc_bob, m0_confc);

static const struct m0_bob_type ctx_bob = {
.bt_name = "m0_confc_ctx",
Expand Down Expand Up @@ -524,6 +524,7 @@ M0_INTERNAL int m0_confc_init_wait(struct m0_confc *confc,
M0_LOG(M0_DEBUG, "confd=%s lconf=%s", confd_addr, local_conf);

m0_mutex_init(&confc->cc_lock);
m0_confc_bob_init(confc);
confc_lock(confc);
rc = confc_cache_create(confc, local_conf);
confc_unlock(confc);
Expand All @@ -539,7 +540,6 @@ M0_INTERNAL int m0_confc_init_wait(struct m0_confc *confc,
if (rc == 0) {
confc->cc_group = sm_group;
confc->cc_nr_ctx = 0;
m0_confc_bob_init(confc);
m0_mutex_init(&confc->cc_unatt_guard);
m0_chan_init(&confc->cc_unattached, &confc->cc_unatt_guard);
confc->cc_gops = NULL;
Expand Down
2 changes: 2 additions & 0 deletions conf/confc.h
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,7 @@ M0_INTERNAL bool m0_confc_is_online(const struct m0_confc *confc);
M0_INTERNAL struct m0_rpc_conn *m0_confc2conn(struct m0_confc *confc);
M0_INTERNAL struct m0_rpc_session *m0_confc2sess(struct m0_confc *confc);

M0_BOB_DECLARE(M0_INTERNAL, m0_confc);

/** @} confc_dfspec */
#endif /* __MOTR_CONF_CONFC_H__ */
1 change: 1 addition & 0 deletions conf/rconfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2907,6 +2907,7 @@ M0_INTERNAL int m0_rconfc_init(struct m0_rconfc *rconfc,
m0_mutex_init(&rconfc->rc_herd_lock);
m0_chan_init(&rconfc->rc_herd_chan, &rconfc->rc_herd_lock);
m0_sm_init(&rconfc->rc_sm, &rconfc_sm_conf, M0_RCS_INIT, sm_group);
m0_confc_bob_init(&rconfc->rc_confc);

/* Subscribe on ha entrypoint callbacks */
ha = m0_get()->i_ha;
Expand Down
1 change: 1 addition & 0 deletions spiel/ut/spiel_conf_ut.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static void spiel_conf_ut_init(void)
/* Use a copy of conf.xc file as confd path - file may have changed */
m0_spiel__ut_init(&spiel, "tmp-conf.xc", false);
m0_rconfc_lock(rconfc);
m0_confc_bob_init(&rconfc->rc_confc);
rconfc->rc_expired_cb = &m0_confc_expired_cb;
rconfc->rc_ready_cb = &m0_confc_ready_cb;
m0_rconfc_unlock(rconfc);
Expand Down