23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CM 66 struct m0_cm_cp, c_cm_proxy_linkage, c_magix,
85 return _0C(pxy !=
NULL) &&
_0C(m0_cm_proxy_bob_check(pxy)) &&
96 m0_cm_proxy_bob_init(proxy);
97 proxy_tlink_init(proxy);
98 proxy_fail_tlink_init(proxy);
101 proxy->
px_id = px_id;
114 M0_PRE(!proxy_tlink_is_in(pxy));
128 M0_PRE(proxy_tlink_is_in(pxy));
129 if (proxy_fail_tlink_is_in(pxy))
130 proxy_fail_tlist_del(pxy);
131 proxy_fail_tlink_fini(pxy);
132 proxy_tlink_del_fini(pxy);
144 M0_PRE(!proxy_cp_tlink_is_in(cp));
148 M0_POST(proxy_cp_tlink_is_in(cp));
156 M0_PRE(proxy_cp_tlink_is_in(cp));
157 proxy_cp_tlist_del(cp);
158 M0_POST(!proxy_cp_tlink_is_in(cp));
174 tm = &m0_reqh_rpc_mach_tlist_head
207 "current: %llu" "received: %llu",
209 (
unsigned long long)px_epoch);
237 struct m0_cm_sw *out_interval, uint32_t px_status)
261 p->px_epoch = px_epoch;
262 p->px_status = px_status;
286 _sw_update(
p, in_interval, out_interval, px_status);
300 _sw_update(
p, in_interval, out_interval, px_status);
310 p,
p->px_id,
p->px_endpoint, px_status);
311 _sw_update(
p, in_interval, out_interval, px_status);
319 uint32_t px_status) = {
346 if (px_status < pxy->px_status) {
348 return M0_RC(-EINVAL);
353 return M0_RC(-EINVAL);
374 rc =
px_action[px_status](pxy, in_interval, out_interval, px_epoch, px_status);
415 " pending updates: %u posted: %" PRIu64 " state=%u" 416 " px_update_rc=%d px_send_final_update=%d",
525 M0_ENTRY(
"fop: %p conn: %p to pxy %p (%s)",
618 "px_nr_updates_posted %" PRIu64 " onwire_ast.sa_next %p",
634 m0_cm_proxy_bob_fini(pxy);
681 if (!proxy_fail_tlink_is_in(pxy))
750 uint32_t nr_failed_proxies;
766 pcount->
p_nr = nr_proxies;
789 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL void m0_cm_ag_id_copy(struct m0_cm_ag_id *dst, const struct m0_cm_ag_id *src)
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
uint64_t cm_aggr_grps_in_nr
static void proxy_sw_onwire_release(struct m0_ref *ref)
M0_INTERNAL int m0_rpc_post(struct m0_rpc_item *item)
static const struct m0_bob_type proxy_bob
static struct m0_addb2_philter p
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)
static void px_fail_ast_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL void m0_fom_wakeup(struct m0_fom *fom)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
const struct m0_rpc_item_ops proxy_sw_onwire_item_ops
enum m0_rpc_item_priority ri_prio
M0_INTERNAL void m0_clink_init(struct m0_clink *link, m0_chan_cb_t cb)
#define ID_LOG(prefix, id)
struct m0_bitmap cm_proxy_update_map
M0_INTERNAL void m0_clink_del_lock(struct m0_clink *link)
M0_INTERNAL void m0_cm_proxy_lock(struct m0_cm_proxy *pxy)
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
bool m0_rpc_item_is_generic_reply_fop(const struct m0_rpc_item *item)
const struct m0_cm_ops * cm_ops
static void proxy_sw_onwire_ast_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
static struct m0_sm_group * grp
M0_TL_DEFINE(proxy, M0_INTERNAL, struct m0_cm_proxy)
#define M0_LOG(level,...)
struct m0_cm_sw px_last_sw_onwire_sent
const struct m0_conf_obj_type M0_CONF_SERVICE_TYPE
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL void m0_cm_proxy_unlock(struct m0_cm_proxy *pxy)
struct m0_tl px_pending_cps
static bool epoch_check(struct m0_cm_proxy *pxy, m0_time_t px_epoch)
M0_INTERNAL bool m0_cm_proxies_ready(const struct m0_cm *cm)
struct m0_cm_ag_id cag_id
void * m0_fop_data(const struct m0_fop *fop)
M0_INTERNAL bool m0_clink_is_armed(const struct m0_clink *link)
M0_INTERNAL void m0_cm_ag_in_interval(const struct m0_cm *cm, struct m0_cm_sw *in_interval)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL bool m0_cm_proxy_is_updated(struct m0_cm_proxy *proxy, struct m0_cm_sw *in_interval)
int(* cmo_sw_onwire_fop_setup)(struct m0_cm *cm, struct m0_fop *fop, void(*fop_release)(struct m0_ref *), uint64_t proxy_id, const char *local_ep, const struct m0_cm_sw *sw, const struct m0_cm_sw *out_interval)
M0_INTERNAL bool m0_cm_ag_id_is_set(const struct m0_cm_ag_id *id)
static struct m0_rpc_item * item
static int px_ready(struct m0_cm_proxy *p, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, m0_time_t px_epoch, uint32_t px_status)
struct m0_rpc_session * px_session
uint64_t cm_nr_proxy_updated
static struct m0_sm_ast ast[NR]
int32_t m0_rpc_item_generic_reply_rc(const struct m0_rpc_item *reply)
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_proxy_agid_is_in_sw(struct m0_cm_proxy *pxy, struct m0_cm_ag_id *id)
struct m0_rpc_machine * c_rpc_machine
static void proxy_done(struct m0_cm_proxy *proxy)
M0_INTERNAL void m0_cm_proxy_cp_add(struct m0_cm_proxy *pxy, struct m0_cm_cp *cp)
return M0_ERR(-EOPNOTSUPP)
struct m0_clink px_ha_link
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 void m0_cm_sw_copy(struct m0_cm_sw *dst, const struct m0_cm_sw *src)
#define M0_AMB(obj, ptr, field)
enum m0_proxy_state px_status
struct m0_sm_ast px_online_ast
static int px_active(struct m0_cm_proxy *p, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, m0_time_t px_epoch, uint32_t px_status)
static int px_complete(struct m0_cm_proxy *p, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, m0_time_t px_epoch, uint32_t px_status)
M0_INTERNAL int m0_cm_ag_id_cmp(const struct m0_cm_ag_id *id0, const struct m0_cm_ag_id *id1)
struct m0_net_transfer_mc rm_tm
static void px_online_ast_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_TL_DESCR_DEFINE(proxy, "copy machine proxy", M0_INTERNAL, struct m0_cm_proxy, px_linkage, px_magic, CM_PROXY_LINK_MAGIC, CM_PROXY_HEAD_MAGIC)
uint64_t px_nr_updates_posted
struct m0_rpc_conn * px_conn
enum m0_ha_obj_state co_ha_state
struct m0_tl rh_rpc_machines
static bool cm_proxy_invariant(const struct m0_cm_proxy *pxy)
struct m0_rpc_item * ri_reply
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
M0_INTERNAL void m0_cm_proxy_del(struct m0_cm *cm, struct m0_cm_proxy *pxy)
struct m0_chan co_ha_chan
M0_INTERNAL void m0_bitmap_set(struct m0_bitmap *map, size_t idx, bool val)
M0_INTERNAL bool m0_cm_proxy_is_locked(struct m0_cm_proxy *pxy)
struct m0_cm_aggr_group * c_ag
static bool proxy_clink_cb(struct m0_clink *clink)
struct m0_sm_ast * sa_next
M0_INTERNAL int m0_cm_proxy_update(struct m0_cm_proxy *pxy, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, uint32_t px_status, m0_time_t px_epoch)
static void proxy_sw_onwire_item_replied_cb(struct m0_rpc_item *req_item)
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
struct m0_sm_ast px_fail_ast
static struct m0_clink clink[RDWR_REQUEST_MAX]
M0_INTERNAL uint64_t m0_cm_proxy_nr(struct m0_cm *cm)
struct m0_chan cm_proxy_init_wait
struct m0_cm_proxy * pso_proxy
static int px_stop_fail(struct m0_cm_proxy *p, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, m0_time_t px_epoch, uint32_t px_status)
static void __wake_up_pending_cps(struct m0_cm_proxy *pxy)
bool px_send_final_update
M0_INTERNAL void m0_cm_proxy_in_count_free(struct m0_cm_proxy_in_count *pcount)
struct m0_sm_group cm_sm_group
void(* rio_replied)(struct m0_rpc_item *item)
void m0_clink_add_lock(struct m0_chan *chan, struct m0_clink *link)
void m0_net_end_point_put(struct m0_net_end_point *ep)
struct m0_cm_sw px_out_interval
#define M0_MAGIX_OFFSET(type, field)
M0_INTERNAL void m0_cm_notify(struct m0_cm *cm)
struct m0_net_end_point * ntm_ep
#define M0_ALLOC_PTR(ptr)
const struct m0_rpc_item_ops * ri_ops
M0_INTERNAL void m0_cm_ag_out_interval(const struct m0_cm *cm, struct m0_cm_sw *out_interval)
M0_INTERNAL void m0_cm_proxy_fini(struct m0_cm_proxy *pxy)
struct m0_reqh_service cm_service
static void cm_proxy_sw_onwire_post(struct m0_cm_proxy *proxy, struct m0_fop *fop, const struct m0_rpc_conn *conn)
uint64_t cm_proxy_active_nr
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 int m0_cm_proxy_in_count_alloc(struct m0_cm_proxy_in_count *pcount, uint32_t nr_proxies)
struct m0_rpc_session * ri_session
struct m0_rpc_item * m0_fop_to_rpc_item(const struct m0_fop *fop)
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
M0_BOB_DEFINE(static, &proxy_bob, m0_cm_proxy)
M0_INTERNAL struct m0_cm_proxy * m0_cm_proxy_locate(struct m0_cm *cm, const char *addr)
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)
M0_INTERNAL void m0_clink_fini(struct m0_clink *link)
static void cm_proxy_cp_del(struct m0_cm_proxy *pxy, struct m0_cm_cp *cp)
void m0_fop_put_lock(struct m0_fop *fop)
static struct m0_fop * fop
M0_INTERNAL void m0_cm_proxy_pending_cps_wakeup(struct m0_cm *cm)
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
static void _sw_update(struct m0_cm_proxy *pxy, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, uint32_t px_status)
M0_INTERNAL void m0_cm_abort(struct m0_cm *cm, int rc)
M0_INTERNAL bool m0_cm_is_locked(const struct m0_cm *cm)
static int scan(struct scanner *s)
struct m0_tl cm_failed_proxies
struct m0_sm_ast px_sw_onwire_ast
#define m0_tl_for(name, head, obj)
M0_INTERNAL bool m0_cm_sw_cmp(const struct m0_cm_sw *sw0, const struct m0_cm_sw *sw1)
M0_INTERNAL int m0_cm_proxy_remote_update(struct m0_cm_proxy *proxy, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval)
uint32_t px_updates_pending
M0_INTERNAL void m0_cm_proxy_add(struct m0_cm *cm, struct m0_cm_proxy *pxy)
M0_INTERNAL void m0_chan_broadcast(struct m0_chan *chan)
M0_INTERNAL int m0_net_end_point_create(struct m0_net_end_point **epp, struct m0_net_transfer_mc *tm, const char *addr)
struct m0_cm_ag_id cm_sw_last_updated_hi
static int(* px_action[])(struct m0_cm_proxy *px, struct m0_cm_sw *in_interval, struct m0_cm_sw *out_interval, m0_time_t px_epoch, uint32_t px_status)