23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CM 52 #include "cm/cp_onwire_xc.h" 449 .sd_name =
"cm_init",
454 .sd_name =
"cm_idle",
460 .sd_name =
"cm_prepare",
465 .sd_name =
"cm_ready",
470 .sd_name =
"cm_active",
475 .sd_name =
"cm_fail",
480 .sd_name =
"cm_stop",
486 .sd_name =
"cm_fini",
636 uint32_t proxy_cnt = 0;
650 if ((strcmp(lep, dep) == 0 ||
654 &
ctx->sc_fid, &svc_obj);
672 proxy_fail_tlist_add_tail(
682 M0_LOG(
M0_DEBUG,
"Connected to its proxies from local ep %s", lep);
921 static uint64_t
id = 0;
930 cmtypes_tlist_contains(&
cmtypes, cm_type));
1005 m0_cm_type_bob_init(cmtype);
1010 cmtypes_tlink_init_at_tail(cmtype, &
cmtypes);
1022 M0_PRE(cmtype !=
NULL && m0_cm_type_bob_check(cmtype));
1026 cmtypes_tlink_del_fini(cmtype);
1028 m0_cm_type_bob_fini(cmtype);
1058 *
bp, uint64_t colour)
1067 for (
i = 0;
i <
bp->nbp_seg_nr; ++
i)
1068 memset(
buf->nb_buffer.ov_buf[
i], 0,
bp->nbp_seg_size);
1126 return M0_RC(-EAGAIN);
1231 #undef M0_TRACE_SUBSYSTEM
static struct m0_bob_type cmtypes_bob
M0_INTERNAL int m0_mutex_trylock(struct m0_mutex *mutex)
M0_INTERNAL void m0_cm_ag_unlock(struct m0_cm_aggr_group *ag)
M0_INTERNAL int m0_cm_ast_run_thread_init(struct m0_cm *cm)
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
M0_INTERNAL bool m0_cm_proxy_is_done(const struct m0_cm_proxy *pxy)
M0_INTERNAL void m0_cm_frozen_ag_cleanup(struct m0_cm *cm, struct m0_cm_proxy *proxy)
M0_INTERNAL void m0_cm_lock(struct m0_cm *cm)
M0_INTERNAL const char * m0_rpc_link_end_point(const struct m0_rpc_link *rlink)
static struct m0_sm_state_descr cm_state_descr[M0_CMS_NR]
const struct m0_cm_type * cm_type
static uint64_t cm_id_generate(void)
M0_INTERNAL void m0_sm_fail(struct m0_sm *mach, int fail_state, int32_t rc)
M0_INTERNAL void m0_cm_fail(struct m0_cm *cm, int rc)
M0_INTERNAL int m0_bitmap_init(struct m0_bitmap *map, size_t nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL struct m0_rpc_machine * m0_cm_rpc_machine_find(struct m0_reqh *reqh)
M0_INTERNAL bool m0_cm_is_dirty(struct m0_cm *cm)
bool(* cago_is_frozen_on)(struct m0_cm_aggr_group *ag, struct m0_cm_proxy *proxy)
M0_INTERNAL bool m0_cm_ag_can_fini(struct m0_cm_aggr_group *ag)
M0_INTERNAL void m0_bitmap_fini(struct m0_bitmap *map)
#define ID_LOG(prefix, id)
struct m0_bitmap cm_proxy_update_map
M0_INTERNAL bool m0_cm_is_ready(struct m0_cm *cm)
M0_INTERNAL void m0_cm_proxy_lock(struct m0_cm_proxy *pxy)
int m0_thread_join(struct m0_thread *q)
M0_INTERNAL bool m0_cm_is_active(struct m0_cm *cm)
const struct m0_cm_ops * cm_ops
static void cm_replicas_destroy(struct m0_cm *cm)
static uint64_t tag(uint8_t code, uint64_t id)
M0_INTERNAL void m0_cm_type_deregister(struct m0_cm_type *cmtype)
#define M0_LOG(level,...)
M0_INTERNAL struct m0_net_buffer * m0_net_buffer_pool_get(struct m0_net_buffer_pool *pool, uint32_t colour)
void(* cago_fini)(struct m0_cm_aggr_group *ag)
M0_INTERNAL int m0_cm_stop(struct m0_cm *cm)
void(* cmo_stop)(struct m0_cm *cm)
M0_INTERNAL bool m0_cm_has_more_data(const struct m0_cm *cm)
M0_INTERNAL int m0_cm_trylock(struct m0_cm *cm)
M0_INTERNAL void m0_cm_proxy_unlock(struct m0_cm_proxy *pxy)
M0_INTERNAL void m0_cm_wait_cancel(struct m0_cm *cm, struct m0_fom *fom)
M0_INTERNAL int m0_ha_cm_err_send(struct m0_cm *cm, int rc)
M0_BOB_DEFINE(static, &cmtypes_bob, m0_cm_type)
M0_INTERNAL void m0_ha_send(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
struct m0_cm_ag_id cag_id
M0_INTERNAL void m0_cm_sw_update_complete(struct m0_cm *cm)
static int cm_rc(struct m0_cm *cm)
M0_INTERNAL void m0_cm_ast_run_thread_fini(struct m0_cm *cm)
M0_INTERNAL void m0_fom_wait_on(struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
M0_INTERNAL struct m0 * m0_get(void)
M0_INTERNAL int m0_cm_start(struct m0_cm *cm)
#define container_of(ptr, type, member)
M0_INTERNAL int m0_cm_module_init(void)
M0_INTERNAL void m0_cm_fini(struct m0_cm *cm)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL const char * m0_rpc_machine_ep(const struct m0_rpc_machine *rmach)
M0_INTERNAL void m0_cm_state_set(struct m0_cm *cm, enum m0_cm_state state)
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
int m0_reqh_service_type_register(struct m0_reqh_service_type *rstype)
struct m0_rpc_session * px_session
int(* cmo_data_next)(struct m0_cm *cm, struct m0_cm_cp *cp)
static struct m0_pools_common pc
M0_INTERNAL struct m0_reqh_service_type * m0_reqh_service_type_find(const char *sname)
M0_INTERNAL void m0_cm_cp_pump_init(struct m0_cm_type *cmtype)
M0_INTERNAL int m0_cm_init(struct m0_cm *cm, struct m0_cm_type *cm_type, const struct m0_cm_ops *cm_ops)
M0_INTERNAL void m0_cm_ag_store_fini(struct m0_cm_ag_store *store)
M0_INTERNAL int m0_cm_data_next(struct m0_cm *cm, struct m0_cm_cp *cp)
M0_INTERNAL void m0_cm_unlock(struct m0_cm *cm)
uint64_t cm_nr_proxy_updated
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
M0_INTERNAL void m0_cm_complete_notify(struct m0_cm *cm)
M0_INTERNAL void m0_chan_signal(struct m0_chan *chan)
M0_INTERNAL bool m0_cm_proxies_updated(struct m0_cm *cm)
M0_INTERNAL void m0_cm_cp_pump_prepare(struct m0_cm *cm)
return M0_ERR(-EOPNOTSUPP)
struct m0_mutex cm_wait_mutex
M0_INTERNAL void m0_cm_proxies_sent_reset(struct m0_cm *cm)
M0_INTERNAL void m0_cm_proxy_event_handle_register(struct m0_cm_proxy *pxy, struct m0_conf_obj *svc_obj)
M0_INTERNAL struct m0_net_buffer * m0_cm_buffer_get(struct m0_net_buffer_pool *bp, uint64_t colour)
M0_INTERNAL void m0_cm_ag_lock(struct m0_cm_aggr_group *ag)
enum m0_proxy_state px_status
int(* cmo_prepare)(struct m0_cm *cm)
M0_INTERNAL bool m0_net_buffer_pool_invariant(const struct m0_net_buffer_pool *pool)
M0_TL_DEFINE(cmtypes, static, struct m0_cm_type)
M0_INTERNAL void m0_chan_init(struct m0_chan *chan, struct m0_mutex *ch_guard)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_cm_wait(struct m0_cm *cm, struct m0_fom *fom)
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
struct m0_rpc_conn * px_conn
m0_time_t m0_time_now(void)
void m0_sm_state_set(struct m0_sm *mach, int state)
enum m0_ha_obj_state co_ha_state
struct m0_tl rh_rpc_machines
M0_INTERNAL bool m0_reqh_service_invariant(const struct m0_reqh_service *svc)
struct m0_conf_cache cc_cache
M0_INTERNAL void m0_cm_module_fini(void)
M0_INTERNAL void m0_cm_cp_pump_start(struct m0_cm *cm)
M0_INTERNAL void m0_clink_signal(struct m0_clink *clink)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static void cm_ast_run_thread(struct m0_cm *cm)
M0_INTERNAL int m0_conf_obj_find_lock(struct m0_conf_cache *cache, const struct m0_fid *id, struct m0_conf_obj **out)
M0_INTERNAL void m0_cm_proxy_del(struct m0_cm *cm, struct m0_cm_proxy *pxy)
static int cm_replicas_connect(struct m0_cm *cm, struct m0_rpc_machine *rmach, struct m0_reqh *reqh)
struct m0_sm_ast * sa_next
struct m0_confc * pc_confc
struct m0_sm_ast cag_fini_ast
static struct fdmi_ctx ctx
struct m0_chan cm_complete
M0_INTERNAL int m0_cm_setup(struct m0_cm *cm)
M0_INTERNAL int m0_cm_ready(struct m0_cm *cm)
void(* cmo_ha_msg)(struct m0_cm *cm, struct m0_ha_msg *msg, int rc)
struct m0_chan cm_proxy_init_wait
M0_INTERNAL void m0_chan_signal_lock(struct m0_chan *chan)
M0_INTERNAL void m0_cm_buffer_put(struct m0_net_buffer_pool *bp, struct m0_net_buffer *buf, uint64_t colour)
static struct m0_mutex cmtypes_mutex
M0_INTERNAL struct m0_cm * m0_cmsvc2cm(struct m0_reqh_service *cmsvc)
struct m0_sm_group cm_sm_group
void(* cmo_fini)(struct m0_cm *cm)
struct m0_tl cm_aggr_grps_out
M0_INTERNAL int m0_cm_prepare(struct m0_cm *cm)
bool m0_cm_cp_pump_is_complete(const struct m0_cm_cp_pump *cp_pump)
M0_INTERNAL void m0_cm_ag_store_init(struct m0_cm_type *cmtype)
M0_INTERNAL void m0_cm_notify(struct m0_cm *cm)
#define M0_FI_ENABLED(tag)
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
#define M0_ALLOC_PTR(ptr)
M0_TL_DESCR_DEFINE(cmtypes, "copy machine types", static, struct m0_cm_type, ct_linkage, ct_magix, CM_TYPE_LINK_MAGIX, CM_TYPE_HEAD_MAGIX)
const struct m0_cm_aggr_group_ops * cag_ops
M0_INTERNAL void m0_cm_proxy_fini(struct m0_cm_proxy *pxy)
M0_INTERNAL int m0_cm_sw_remote_update(struct m0_cm *cm)
static struct m0_tl cmtypes
static int cm_pre_start_cleanup(struct m0_cm *cm)
struct m0_reqh_service cm_service
M0_INTERNAL int m0_cm_proxy_init(struct m0_cm_proxy *proxy, uint64_t px_id, struct m0_cm_ag_id *lo, struct m0_cm_ag_id *hi, const char *endpoint)
M0_INTERNAL void m0_cm_proxies_init_wait(struct m0_cm *cm, struct m0_fom *fom)
M0_INTERNAL bool m0_cm_ag_store_is_complete(struct m0_cm_ag_store *store)
static const struct m0_sm_conf cm_sm_conf
M0_INTERNAL enum m0_cm_state m0_cm_state_get(const struct m0_cm *cm)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
int(* cmo_setup)(struct m0_cm *cm)
struct m0_pools_common * rh_pools
M0_INTERNAL void m0_fom_callback_cancel(struct m0_fom_callback *cb)
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
struct m0_reqh_service_type ct_stype
M0_INTERNAL void m0_cm_sw_update_init(struct m0_cm_type *cmtype)
M0_INTERNAL void m0_chan_fini(struct m0_chan *chan)
M0_INTERNAL void m0_net_buffer_pool_put(struct m0_net_buffer_pool *pool, struct m0_net_buffer *buf, uint32_t colour)
struct m0_cm_cp_pump cm_cp_pump
bool(* cmo_is_peer)(struct m0_cm *cm, struct m0_reqh_service_ctx *ctx)
#define m0_tlist_for(descr, head, obj)
static struct bulkio_params * bp
int(* cmo_start)(struct m0_cm *cm)
M0_INTERNAL void m0_cm_abort(struct m0_cm *cm, int rc)
M0_INTERNAL void m0_cm_ag_store_complete(struct m0_cm_ag_store *store)
M0_INTERNAL bool m0_cm_invariant(const struct m0_cm *cm)
struct m0_tl cm_aggr_grps_in
M0_INTERNAL bool m0_cm_is_locked(const struct m0_cm *cm)
M0_INTERNAL void m0_sm_asts_run(struct m0_sm_group *grp)
struct m0_tl cm_failed_proxies
#define m0_tl_for(name, head, obj)
M0_INTERNAL void m0_chan_fini_lock(struct m0_chan *chan)
M0_INTERNAL int m0_cm_complete(struct m0_cm *cm)
M0_INTERNAL void m0_cm_ag_store_fom_start(struct m0_cm *cm)
void m0_reqh_service_type_unregister(struct m0_reqh_service_type *rstype)
struct m0_cm_ast_run cm_asts_run
M0_INTERNAL void m0_cm_proxy_add(struct m0_cm *cm, struct m0_cm_proxy *pxy)
M0_INTERNAL void m0_bob_type_tlist_init(struct m0_bob_type *bt, const struct m0_tl_descr *td)
M0_INTERNAL int m0_cm_proxies_fini(struct m0_cm *cm)
M0_INTERNAL void m0_cm_proxy_failed_cleanup(struct m0_cm *cm)
struct m0_cm_ag_store cm_ag_store
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)
M0_INTERNAL int m0_cm_type_register(struct m0_cm_type *cmtype)
M0_INTERNAL bool m0_sm_invariant(const struct m0_sm *mach)