23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_RM 36 #include "rm/rm_fops_xc.h" 109 if (outreq ==
NULL) {
182 req->rrq_owner.ow_cookie = *cookie;
184 &
req->rrq_owner.ow_resource) ?:
186 &
req->rrq_credit.cr_opaque);
202 M0_ENTRY(
"creating borrow fop for incoming: %p credit value: %llu",
203 in, (
long long unsigned) credit->
cr_datum);
214 bfop->bo_creditor.ow_cookie = rem ? rem->
rem_cookie :
230 M0_ENTRY(
"creating revoke fop for incoming: %p credit value: %llu",
231 in, (
long long unsigned) credit->
cr_datum);
238 rfop->fr_loan.lo_cookie = loan->
rl_cookie;
250 M0_ENTRY(
"creating cancel fop for credit value: %llu",
282 outreq =
M0_AMB(outreq, outgoing, ou_req);
363 M0_ENTRY(
"sending request type: %d for incoming: %p credit value: %llu",
364 otype, in, (
long long unsigned) credit->
cr_datum);
444 " failed: rc=%d", outreq,
rc);
449 M0_LOG(
M0_INFO,
"borrow request %p successful; credit value: %llu",
450 outreq, (
long long unsigned)credit->
cr_datum);
518 m0_rm_ur_tlist_del(credit);
564 .
name =
"Credit Borrow",
566 .
xt = m0_rm_fop_borrow_xc,
572 .
name =
"Credit Borrow Reply",
574 .
xt = m0_rm_fop_borrow_rep_xc,
578 .
name =
"Credit Revoke",
580 .
xt = m0_rm_fop_revoke_xc,
586 .
name =
"Credit Revoke Reply",
588 .
xt = m0_rm_fop_revoke_rep_xc,
592 .
name =
"Credit Return (Cancel)",
594 .
xt = m0_rm_fop_cancel_xc,
603 #undef M0_TRACE_SUBSYSTEM const struct m0_rm_credit_ops * cr_ops
M0_INTERNAL int m0_rm_outgoing_init(struct m0_rm_outgoing *out, enum m0_rm_outgoing_type req_type, struct m0_rm_remote *other, struct m0_rm_credit *credit)
M0_INTERNAL int m0_rm_request_out(enum m0_rm_outgoing_type otype, struct m0_rm_incoming *in, struct m0_rm_loan *loan, struct m0_rm_credit *credit, struct m0_rm_remote *other)
M0_INTERNAL int m0_rpc_post(struct m0_rpc_item *item)
struct m0_rm_fop_credit br_credit
static void rm_fop_release(struct m0_ref *ref)
struct m0_rm_fop_loan fc_loan
static void outreq_fini(struct rm_out *outreq, int rc)
M0_INTERNAL int m0_rm_owner_loan_debit(struct m0_rm_owner *owner, struct m0_rm_loan *paid_loan, struct m0_tl *list)
bool(* cro_intersects)(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
struct m0_clink rem_rev_sess_clink
struct m0_rm_remote * ro_creditor
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
#define M0_FOP_TYPE_INIT(ft,...)
M0_INTERNAL const struct m0_cookie M0_COOKIE_NULL
M0_INTERNAL int m0_rm_credit_decode(struct m0_rm_credit *credit, struct m0_buf *buf)
static struct io_request req
static struct m0_sm_group * grp
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
#define M0_LOG(level,...)
struct m0_cookie rl_cookie
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
enum m0_rm_incoming_policy rin_policy
M0_INTERNAL int m0_rm_credit_dup(const struct m0_rm_credit *src_credit, struct m0_rm_credit **dest_credit)
static void rm_out_release(struct rm_out *out)
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
static void rm_revoke_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
void * m0_fop_data(const struct m0_fop *fop)
void m0_fop_type_fini(struct m0_fop_type *fopt)
struct m0_fop_type m0_rm_fop_borrow_rep_fopt
const struct m0_fom_type_ops rm_cancel_fom_type_ops
M0_INTERNAL bool m0_clink_is_armed(const struct m0_clink *link)
static int borrow_fop_fill(struct rm_out *outreq, struct m0_rm_incoming *in, struct m0_rm_credit *credit)
const struct m0_fom_type_ops rm_borrow_fom_type_ops
#define container_of(ptr, type, member)
struct m0_rm_credit rin_want
struct m0_rpc_session * rem_session
static struct m0_xcode_type ** xt[]
static struct m0_rpc_item * item
M0_INTERNAL int m0_rm_credit_encode(struct m0_rm_credit *credit, struct m0_buf *buf)
struct m0_rm_owner * cr_owner
struct m0_cookie br_creditor_cookie
struct m0_cookie lo_cookie
M0_INTERNAL bool m0_cookie_is_null(const struct m0_cookie *cookie)
static struct m0_sm_ast ast[NR]
M0_INTERNAL int m0_rm_resource_encode(struct m0_rm_resource *res, struct m0_buf *buf)
struct m0_rm_credit rl_credit
M0_INTERNAL void m0_rm_outgoing_send(struct m0_rm_outgoing *outgoing)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL int m0_rm_loan_settle(struct m0_rm_owner *owner, struct m0_rm_loan *loan)
#define M0_AMB(obj, ptr, field)
static const struct m0_rpc_item_ops rm_request_rpc_ops
static int fop_common_fill(struct rm_out *outreq, struct m0_rm_incoming *in, struct m0_rm_credit *credit, struct m0_cookie *cookie, struct m0_fop_type *fopt, size_t offset, void **data)
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
static void rm_borrow_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
struct m0_tl ro_outgoing[OQS_NR]
struct m0_sm_state_descr rm_req_phases[]
static void rm_out_destroy(struct rm_out *out)
static int cancel_fop_fill(struct rm_out *outreq, struct m0_rm_loan *loan)
const struct m0_rpc_item_type * ri_type
struct m0_rpc_item * ri_reply
M0_INTERNAL int m0_rm_pin_add(struct m0_rm_incoming *in, struct m0_rm_credit *credit, uint32_t flags)
static struct m0_sm_group * owner_grp(const struct m0_rm_owner *owner)
M0_INTERNAL void m0_cookie_init(struct m0_cookie *cookie, const uint64_t *obj)
const struct m0_fom_type_ops rm_revoke_fom_type_ops
static m0_bindex_t offset
struct m0_rm_remote * rl_other
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
static struct m0_rm_resource * incoming_to_resource(struct m0_rm_incoming *in)
M0_INTERNAL int granted_maybe_reserve(struct m0_rm_credit *granted, struct m0_rm_credit *to_cache)
const struct m0_sm_conf borrow_sm_conf
void(* rio_replied)(struct m0_rpc_item *item)
struct m0_reqh_service_type m0_rms_type
int32_t m0_rpc_item_error(const struct m0_rpc_item *item)
struct m0_rm_fop_req bo_base
static int revoke_fop_fill(struct rm_out *outreq, struct m0_rm_incoming *in, struct m0_rm_loan *loan, struct m0_rm_remote *other, struct m0_rm_credit *credit)
static int rm_out_create(struct rm_out **out, enum m0_rm_outgoing_type otype, struct m0_rm_remote *other, struct m0_rm_credit *credit)
struct m0_reqh_service_type m0_rpc_service_type
M0_INTERNAL int m0_rm_fop_init(void)
#define M0_FI_ENABLED(tag)
struct m0_cookie fc_creditor_cookie
static void rm_reply_process(struct m0_rpc_item *item)
struct m0_rm_fop_loan br_loan
#define M0_ALLOC_PTR(ptr)
const struct m0_rpc_item_ops * ri_ops
M0_INTERNAL void m0_rm_outgoing_complete(struct m0_rm_outgoing *og)
struct m0_fop_type m0_rm_fop_cancel_fopt
struct m0_rpc_session * ri_session
M0_INTERNAL int m0_rm_loan_alloc(struct m0_rm_loan **loan, const struct m0_rm_credit *credit, struct m0_rm_remote *creditor)
struct m0_tl ro_owned[OWOS_NR]
void m0_fop_put_lock(struct m0_fop *fop)
static struct m0_fop * fop
struct m0_fop_type m0_rm_fop_revoke_fopt
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
static void rm_cancel_ast(struct m0_sm_group *grp, struct m0_sm_ast *ast)
const struct m0_sm_conf canoke_sm_conf
M0_INTERNAL void m0_sm_ast_cancel(struct m0_sm_group *grp, struct m0_sm_ast *ast)
struct m0_cookie rem_cookie
struct m0_uint128 cr_group_id
struct m0_fop_type m0_rm_fop_borrow_fopt
struct m0_fop_type m0_rm_fop_revoke_rep_fopt
#define m0_tl_for(name, head, obj)
struct m0_rm_fop_req fr_base
struct m0_rpc_item f_item
static void outgoing_queue(enum m0_rm_outgoing_type otype, struct m0_rm_owner *owner, struct rm_out *outreq, struct m0_rm_incoming *in, struct m0_rm_remote *other)
struct m0_rm_reserve_prio rin_reserve
enum m0_rm_outgoing_type rog_type
#define offsetof(typ, memb)
struct m0_rm_loan rog_want
struct m0_rm_outgoing ou_req
M0_INTERNAL void m0_rm_fop_fini(void)
M0_INTERNAL void m0_rm_outgoing_fini(struct m0_rm_outgoing *out)
#define M0_IMPOSSIBLE(fmt,...)