37 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_HA 41 #include "ha/entrypoint_xc.h" 136 .
rst_name =
"ha-entrypoint-service",
139 .rst_keep_alive =
true,
152 if (he_service ==
NULL)
153 return M0_RC(-ENOMEM);
173 .sd_name =
"M0_HES_INIT",
178 .sd_name =
"M0_HES_REPLY_WAIT",
183 .sd_name =
"M0_HES_FINI",
189 .
scf_name =
"entrypoint server fom",
275 hes, server_fom,
U128_P(req_id));
283 M0_ENTRY(
"hes=%p server_fom=%p", hes, server_fom);
300 hes_req_tlist_del(server_fom);
302 M0_LEAVE(
"hes=%p server_fom=%p", hes, server_fom);
331 .sd_name =
"M0_HEC_INIT",
336 .sd_name =
"M0_HEC_STOPPED",
341 .sd_name =
"M0_HEC_UNAVAILABLE",
347 .sd_name =
"M0_HEC_CONNECT",
352 .sd_name =
"M0_HEC_CONNECT_WAIT",
357 .sd_name =
"M0_HEC_FILL",
362 .sd_name =
"M0_HEC_SEND",
367 .sd_name =
"M0_HEC_SEND_WAIT",
372 .sd_name =
"M0_HEC_DISCONNECT",
377 .sd_name =
"M0_HEC_DISCONNECT_WAIT",
382 .sd_name =
"M0_HEC_AVAILABLE",
387 .sd_name =
"M0_HEC_FINI",
393 .
scf_name =
"m0_ha_entrypoint_client::ecl_sm",
406 .sd_name =
"HEC_FOM_INIT",
411 .sd_name =
"HEC_FOM_FINI",
417 .
scf_name =
"entrypoint client fom",
867 hes_req_tlink_fini(server_fom);
907 &
fom->fo_rep_fop->f_item);
932 if (server_fom ==
NULL)
953 hes_req_tlink_init(server_fom);
963 #undef M0_TRACE_SUBSYSTEM
struct m0_fid heq_process_fid
M0_INTERNAL uint64_t m0_process(void)
static int ha_entrypoint_service_start(struct m0_reqh_service *service)
M0_INTERNAL int m0_rpc_post(struct m0_rpc_item *item)
struct m0_mutex ecl_fom_running_lock
static void ha_entrypoint_service_stop(struct m0_reqh_service *service)
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
struct m0_reqh_service hsv_service
M0_INTERNAL void m0_fom_wakeup(struct m0_fom *fom)
M0_INTERNAL const struct m0_ha_entrypoint_req * m0_ha_entrypoint_server_request_find(struct m0_ha_entrypoint_server *hes, const struct m0_uint128 *req_id)
static int ha_entrypoint_get_fom_tick(struct m0_fom *fom)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
int(* rso_start)(struct m0_reqh_service *service)
M0_TL_DEFINE(hes_req, static, struct ha_entrypoint_server_fom)
enum m0_rpc_item_priority ri_prio
struct m0_ha_entrypoint_req_fop ecl_req_fop_data
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
static struct m0_addb2_mach * m
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
struct m0_tlink esf_tlink
int(* fo_tick)(struct m0_fom *fom)
M0_INTERNAL bool m0_uint128_eq(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
M0_INTERNAL int m0_rpc_link_init(struct m0_rpc_link *rlink, struct m0_rpc_machine *mach, struct m0_fid *svc_fid, const char *ep, uint64_t max_rpcs_in_flight)
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
void m0_rpc_item_put(struct m0_rpc_item *item)
#define M0_LOG(level,...)
M0_INTERNAL void m0_ha_entrypoint_server_start(struct m0_ha_entrypoint_server *hes)
struct m0_fid hecc_process_fid
static struct m0_sm_state_descr ha_entrypoint_server_fom_states[]
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
void m0_rpc_item_get(struct m0_rpc_item *item)
M0_INTERNAL void m0_ha_entrypoint_mod_fini(void)
struct m0_ha_entrypoint_server * hsv_server
M0_INTERNAL void m0_ha_entrypoint_client_stop(struct m0_ha_entrypoint_client *ecl)
struct m0_ha_entrypoint_client_cfg ecl_cfg
static bool ha_entrypoint_client_rlink_cb(struct m0_clink *clink)
void * m0_fop_data(const struct m0_fop *fop)
M0_INTERNAL int m0_ha_entrypoint_fop2req(const struct m0_ha_entrypoint_req_fop *req_fop, const char *rpc_endpoint, struct m0_ha_entrypoint_req *req)
M0_INTERNAL enum m0_ha_entrypoint_client_state m0_ha_entrypoint_client_state_get(struct m0_ha_entrypoint_client *ecl)
M0_INTERNAL const char * m0_sm_state_name(const struct m0_sm *mach, int state)
static struct m0_fom_type ha_entrypoint_client_fom_type
static struct m0_sm_state_descr ha_entrypoint_client_fom_states[]
M0_INTERNAL void m0_rpc_link_fini(struct m0_rpc_link *rlink)
static bool ha_entrypoint_client_stop_check(struct m0_clink *clink)
const struct m0_fom_ops ha_entrypoint_get_fom_ops
static const struct m0_reqh_service_type_ops ha_entrypoint_stype_ops
static int ha_entrypoint_service_fop_accept(struct m0_reqh_service *service, struct m0_fop *fop)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL void m0_ha_entrypoint_client_request(struct m0_ha_entrypoint_client *ecl)
M0_INTERNAL void m0_ha_entrypoint_service_fini(struct m0_reqh_service *he_service)
static struct m0_rpc_item_ops ha_entrypoint_client_item_ops
#define M0_MEMBER_PTR(ptr, member)
M0_INTERNAL void m0_ha_entrypoint_server_reply(struct m0_ha_entrypoint_server *hes, const struct m0_uint128 *req_id, const struct m0_ha_entrypoint_rep *rep)
static bool ha_entrypoint_client_start_check(struct m0_clink *clink)
static struct m0_rpc_item * item
struct m0_fop_getxattr_rep * rep
static size_t ha_entrypoint_home_locality(const struct m0_fom *fom)
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
int m0_reqh_service_type_register(struct m0_reqh_service_type *rstype)
static struct m0_sm_state_descr ha_entrypoint_client_states[]
struct m0_fom_type ft_fom_type
struct m0_fop_type m0_ha_entrypoint_rep_fopt
struct m0_reqh * hecc_reqh
static struct m0_sm_conf ha_entrypoint_client_fom_states_conf
struct m0_fop_type m0_ha_entrypoint_req_fopt
#define M0_ASSERT_EX(cond)
struct m0_fop ecl_req_fop
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
void m0_fom_init(struct m0_fom *fom, const struct m0_fom_type *fom_type, const struct m0_fom_ops *ops, struct m0_fop *fop, struct m0_fop *reply, struct m0_reqh *reqh)
struct m0_fop_type * f_type
M0_INTERNAL int m0_ha_entrypoint_mod_init(void)
struct m0_rpc_machine * m0_fop_rpc_machine(const struct m0_fop *fop)
return M0_ERR(-EOPNOTSUPP)
const struct m0_build_info * m0_build_info_get(void)
M0_INTERNAL int m0_ha_entrypoint_req2fop(const struct m0_ha_entrypoint_req *req, struct m0_ha_entrypoint_req_fop *req_fop)
static void ha_entrypoint_fom_fini(struct m0_fom *fom)
M0_INTERNAL int m0_ha_entrypoint_server_init(struct m0_ha_entrypoint_server *hes, struct m0_ha_entrypoint_server_cfg *hes_cfg)
#define M0_AMB(obj, ptr, field)
static const struct socktype stype[]
M0_INTERNAL void m0_ha_entrypoint_fops_init(void)
void m0_fom_fini(struct m0_fom *fom)
struct m0_rpc_item * ecl_reply
static const struct m0_reqh_service_ops ha_entrypoint_service_ops
M0_INTERNAL void m0_reqh_service_quit(struct m0_reqh_service *svc)
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
M0_INTERNAL void m0_ha_entrypoint_server_fini(struct m0_ha_entrypoint_server *hes)
M0_INTERNAL int m0_ha_entrypoint_client_init(struct m0_ha_entrypoint_client *ecl, const char *ep, struct m0_ha_entrypoint_client_cfg *ecl_cfg)
void m0_sm_state_set(struct m0_sm *mach, int state)
struct m0_sm_group ecl_sm_group
void m0_fom_phase_move(struct m0_fom *fom, int32_t rc, int phase)
struct m0_ha_entrypoint_req ecl_req
M0_INTERNAL void m0_fom_type_init(struct m0_fom_type *type, uint64_t id, const struct m0_fom_type_ops *ops, const struct m0_reqh_service_type *svc_type, const struct m0_sm_conf *sm)
static int ha_entrypoint_client_fom_tick(struct m0_fom *fom)
struct m0_rpc_item * ri_reply
struct m0_tl hes_requests
static void ha_entrypoint_client_replied(struct m0_rpc_item *item)
M0_INTERNAL void m0_rpc_link_reset(struct m0_rpc_link *rlink)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
static void ha_entrypoint_client_fom_fini(struct m0_fom *fom)
const char * bi_git_rev_id
struct m0_reqh * hesc_reqh
static const struct m0_fom_ops ha_entrypoint_client_fom_ops
M0_INTERNAL int m0_ha_entrypoint_rep2fop(const struct m0_ha_entrypoint_rep *rep, struct m0_ha_entrypoint_rep_fop *rep_fop)
static size_t ha_entrypoint_client_fom_locality(const struct m0_fom *fom)
void m0_rpc_reply_post(struct m0_rpc_item *request, struct m0_rpc_item *reply)
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
struct m0_reqh_service * hes_he_service
static struct m0_clink clink[RDWR_REQUEST_MAX]
M0_INTERNAL int m0_reqh_service_setup(struct m0_reqh_service **out, struct m0_reqh_service_type *stype, struct m0_reqh *reqh, struct m0_reqh_context *rctx, const struct m0_fid *fid)
struct m0_clink ecl_rlink_wait
void(* hesc_request_received)(struct m0_ha_entrypoint_server *hes, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
M0_INTERNAL int m0_ha_entrypoint_fop2rep(const struct m0_ha_entrypoint_rep_fop *rep_fop, struct m0_ha_entrypoint_rep *rep)
struct m0_reqh_service_type m0_ha_entrypoint_service_type
struct m0_ha_entrypoint_server_cfg hes_cfg
void(* rio_replied)(struct m0_rpc_item *item)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
static int ha_entrypoint_fom_create(struct m0_fop *fop, struct m0_fom **m, struct m0_reqh *reqh)
struct m0_fop_data f_data
int32_t m0_rpc_item_error(const struct m0_rpc_item *item)
struct m0_clink ecl_clink
static void ha_entrypoint_server_register(struct m0_ha_entrypoint_server *hes, struct ha_entrypoint_server_fom *server_fom)
static struct ha_entrypoint_server_fom * ha_entrypoint_server_find(struct m0_ha_entrypoint_server *hes, const struct m0_uint128 *req_id)
M0_INTERNAL void m0_rpc_link_connect_async(struct m0_rpc_link *rlink, m0_time_t abs_timeout, struct m0_clink *wait_clink)
M0_INTERNAL void m0_ha_entrypoint_client_start_sync(struct m0_ha_entrypoint_client *ecl)
int(* rsto_service_allocate)(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
m0_ha_entrypoint_client_state
M0_INTERNAL void m0_ha_entrypoint_req_free(struct m0_ha_entrypoint_req *req)
struct m0_rpc_link ecl_rlink
void m0_rpc_item_put_lock(struct m0_rpc_item *item)
M0_INTERNAL int m0_ha_entrypoint_service_init(struct m0_reqh_service **service, struct m0_reqh *reqh)
static int ha_entrypoint_service_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
static struct ha_entrypoint_service * ha_entrypoint_service_container(struct m0_reqh_service *service)
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
M0_INTERNAL void m0_ha_entrypoint_client_fini(struct m0_ha_entrypoint_client *ecl)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_clink_add(struct m0_chan *chan, struct m0_clink *link)
struct m0_ha_entrypoint_req esf_req
const struct m0_rpc_item_ops * ri_ops
m0_time_t m0_time_from_now(uint64_t secs, long ns)
struct m0_reqh * hsv_reqh
struct m0_rpc_session * ri_session
M0_INTERNAL void m0_ha_entrypoint_rep_free(struct m0_ha_entrypoint_rep *rep)
static void ha_entrypoint_server_deregister(struct m0_ha_entrypoint_server *hes, struct ha_entrypoint_server_fom *server_fom)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
M0_INTERNAL void m0_ha_entrypoint_fops_fini(void)
static struct m0_fop * fop
M0_INTERNAL void m0_ha_entrypoint_server_stop(struct m0_ha_entrypoint_server *hes)
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
M0_INTERNAL struct m0_chan * m0_ha_entrypoint_client_chan(struct m0_ha_entrypoint_client *ecl)
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
M0_INTERNAL void m0_fom_queue(struct m0_fom *fom)
static void ha_entrypoint_service_fini(struct m0_reqh_service *service)
void(* fo_fini)(struct m0_fom *fom)
#define M0_ASSERT_INFO(cond, fmt,...)
M0_TL_DESCR_DEFINE(hes_req, "m0_ha_entrypoint_server::hes_requests", static, struct ha_entrypoint_server_fom, esf_tlink, esf_magic, 10, 11)
struct m0_rpc_session rlk_sess
struct m0_uint128 esf_req_id
const struct m0_fom_type_ops m0_ha_entrypoint_fom_type_ops
static void ha_entrypoint_client_fop_release(struct m0_ref *ref)
void m0_fom_phase_set(struct m0_fom *fom, int phase)
struct m0_rpc_machine * hecc_rpc_machine
const char * heq_git_rev_id
struct m0_rpc_machine * ri_rmachine
static struct m0_dtm_oper_descr reply
#define m0_tl_find(name, var, head,...)
M0_INTERNAL void m0_rpc_link_disconnect_async(struct m0_rpc_link *rlink, m0_time_t abs_timeout, struct m0_clink *wait_clink)
M0_INTERNAL void m0_ha_entrypoint_client_start(struct m0_ha_entrypoint_client *ecl)
struct m0_rpc_item f_item
void m0_reqh_service_type_unregister(struct m0_reqh_service_type *rstype)
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
struct m0_ha_entrypoint_rep ecl_rep
struct m0_sm_conf m0_ha_entrypoint_server_fom_states_conf
static void ha_entrypoint_service_init(struct m0_reqh_service *service)
static struct m0_sm_conf ha_entrypoint_client_states_conf
M0_INTERNAL bool m0_sm_group_is_locked(const struct m0_sm_group *grp)
static const struct m0_fom_type_ops ha_entrypoint_client_fom_type_ops
const m0_time_t M0_TIME_IMMEDIATELY
struct m0_uint128 hes_next_id
M0_INTERNAL const char * m0_rpc_item_remote_ep_addr(const struct m0_rpc_item *item)
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
const struct m0_reqh_service_ops * rs_ops
#define M0_IMPOSSIBLE(fmt,...)
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)