31 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_HA 49 #include "ha/note_xc.h" 60 #define N(i) (note->nv_note[i]) 80 " note->nv_note[0].no_state=%u",
chan, note->
nv_nr,
98 " note->nv_note[0].no_state=%u", note->
nv_nr,
151 uint64_t ignore_same_state)
173 ") obj=%p obj->co_status=%d",
i,
178 prev_ha_state =
obj->co_ha_state;
180 if (!ignore_same_state ||
181 prev_ha_state !=
obj->co_ha_state)
190 bool ignore_same_state)
229 msg->
hm_data.
u.hed_nvec.hmnv_ignore_same_state);
230 if (msg->
hm_data.
u.hed_nvec.hmnv_id_of_get != 0) {
232 m0_get()->i_note_handler, &nvec,
233 msg->
hm_data.
u.hed_nvec.hmnv_id_of_get);
236 nvec_req = &msg->
hm_data.
u.hed_nvec;
245 msg->
hm_data.
u.hed_nvec.hmnv_id_of_get,
251 nvec_req = &msg->
hm_data.
u.hed_nvec;
265 .no_state =
obj->co_ha_state,
271 msg->
hm_data.
u.hed_nvec.hmnv_id_of_get,
281 bool ignore_same_state,
300 .hmnv_type = direction,
301 .hmnv_id_of_get = id_of_get,
302 .hmnv_ignore_same_state = ignore_same_state,
303 .hmnv_nr = nvec->
nv_nr,
372 ha_gets_tlink_del_fini(hsg);
392 .hsg_nvec = nvec_req,
395 ha_gets_tlink_init_at_tail(hsg, &hnh->
hnh_gets);
420 ha_gets_tlink_del_fini(hsg);
423 for (
i = 0;
i < nvec_rep->
nv_nr; ++
i) {
435 #define S_CASE(x) case x: return # x 451 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL int m0_ha_state_get(struct m0_ha_nvec *note, struct m0_chan *chan)
M0_INTERNAL uint64_t m0_ha_msg_nvec_send(const struct m0_ha_nvec *nvec, uint64_t id_of_get, bool ignore_same_state, int direction, struct m0_ha_link *hl)
static void ha_state_single_fop_data_free(struct m0_fop *fop)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
struct m0_tlink hsg_tlink
M0_INTERNAL void m0_chan_broadcast_lock(struct m0_chan *chan)
struct m0_ha_msg_nvec_array hmnv_arr
static uint64_t tag(uint8_t code, uint64_t id)
M0_INTERNAL struct m0_conf_obj * m0_conf_cache_lookup(const struct m0_conf_cache *cache, const struct m0_fid *id)
struct m0_ha_dispatcher * hnh_dispatcher
#define M0_LOG(level,...)
const struct m0_conf_obj_type * m0_conf_fid_type(const struct m0_fid *fid)
struct m0_ha_handler hnh_handler
const struct m0_conf_obj_type M0_CONF_SDEV_TYPE
M0_INTERNAL void m0_ha_note_handler_fini(struct m0_ha_note_handler *hnh)
struct m0_ha_msg_data hm_data
struct m0_ha_note hmna_arr[M0_HA_STATE_UPDATE_LIMIT]
const struct m0_conf_obj_type M0_CONF_POOL_TYPE
M0_INTERNAL struct m0 * m0_get(void)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
static bool note_invariant(const struct m0_ha_nvec *note, bool known)
M0_INTERNAL bool m0_fid_is_set(const struct m0_fid *fid)
M0_INTERNAL void m0_ha_clients_iterate(m0_ha_client_cb_t iter, const void *data, uint64_t data2)
static struct m0_rpc_item * item
M0_INTERNAL void m0_ha_state_set(const struct m0_ha_nvec *note)
struct m0_rpc_item_ops ha_ri_ops
M0_INTERNAL void m0_ha_link_send(struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
M0_INTERNAL int m0_ha_note_handler_init(struct m0_ha_note_handler *hnh, struct m0_ha_dispatcher *hd)
M0_INTERNAL uint64_t m0_ha_note_handler_add(struct m0_ha_note_handler *hnh, struct m0_ha_nvec *nvec_req, struct m0_chan *chan)
return M0_ERR(-EOPNOTSUPP)
struct m0_ha_link_cfg hln_cfg
static void ha_state_accept(struct m0_confc *confc, const struct m0_ha_nvec *note, uint64_t ignore_same_state)
#define M0_NVEC_PRINT(nvec_, label, level)
M0_INTERNAL struct m0_confc * m0_reqh2confc(struct m0_reqh *reqh)
static struct m0_confc * confc
static struct m0_chan chan
struct m0_conf_cache cc_cache
static void ha_state_single_replied(struct m0_rpc_item *item)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
M0_TL_DEFINE(ha_gets, static, struct ha_note_handler_request)
struct m0_chan * hsg_wait_chan
const struct m0_conf_obj_type M0_CONF_DRIVE_TYPE
M0_TL_DESCR_DEFINE(ha_gets, "m0_ha_note_handler::hmh_gets", static, struct ha_note_handler_request, hsg_tlink, hsg_magic, 20, 21)
M0_INTERNAL void m0_ha_dispatcher_attach(struct m0_ha_dispatcher *hd, struct m0_ha_handler *hh)
M0_INTERNAL bool m0_confc_is_inited(const struct m0_confc *confc)
bool m0_conf_fid_is_valid(const struct m0_fid *fid)
struct m0_ha_link * i_ha_link
void(* rio_replied)(struct m0_rpc_item *item)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
#define m0_forall(var, nr,...)
struct m0_fop_data f_data
struct m0_ha_nvec * hsg_nvec
union m0_ha_msg_data::@212 u
M0_INTERNAL void m0_ha_dispatcher_detach(struct m0_ha_dispatcher *hd, struct m0_ha_handler *hh)
struct m0_reqh * hlc_reqh
#define M0_FI_ENABLED(tag)
const struct m0_conf_obj_type M0_CONF_NODE_TYPE
#define M0_ALLOC_PTR(ptr)
static void ha_note_handler_msg(struct m0_ha_handler *hh, struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag, void *data)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static struct m0_fop * fop
#define M0_ASSERT_INFO(cond, fmt,...)
struct m0_ha_note_handler * i_note_handler
M0_INTERNAL void m0_ha_note_handler_signal(struct m0_ha_note_handler *hnh, struct m0_ha_nvec *nvec_rep, uint64_t id)
M0_INTERNAL const char * m0_ha_state2str(enum m0_ha_obj_state state)
struct m0_ha_note * nv_note
M0_INTERNAL void m0_ha_state_accept(const struct m0_ha_nvec *note, bool ignore_same_state)
M0_INTERNAL void m0_conf_cache_lock(struct m0_conf_cache *cache)
#define m0_tl_find(name, var, head,...)
M0_INTERNAL void m0_ha_state_single_post(struct m0_ha_nvec *nvec)
#define m0_tl_for(name, head, obj)
void m0_fop_put(struct m0_fop *fop)
struct m0_rpc_item f_item
M0_INTERNAL void m0_ha_msg_accept(const struct m0_ha_msg *msg, struct m0_ha_link *hl)
M0_INTERNAL void m0_chan_broadcast(struct m0_chan *chan)
void(* m0_ha_client_cb_t)(void *client, const void *data, uint64_t data2)
M0_INTERNAL void m0_conf_cache_unlock(struct m0_conf_cache *cache)
M0_INTERNAL void m0_ha_local_state_set(const struct m0_ha_nvec *nvec)
#define M0_IMPOSSIBLE(fmt,...)