Motr  M0
Resource management
Collaboration diagram for Resource management:

Modules

 Distributed File Lock
 
 RWLock
 

Data Structures

struct  owner_invariant_state
 
struct  m0_rm_domain
 
struct  m0_rm_resource
 
struct  m0_rm_resource_ops
 
struct  m0_rm_resource_type
 
struct  m0_rm_resource_type_ops
 
struct  m0_rm_credit
 
struct  m0_rm_credit_ops
 
struct  m0_rm_remote
 
struct  m0_rm_owner
 
struct  m0_rm_loan
 
struct  m0_rm_reserve_prio
 
struct  m0_rm_incoming
 
struct  m0_rm_incoming_ops
 
struct  m0_rm_outgoing
 
struct  m0_rm_pin
 
struct  rm_request_fom
 

Macros

#define INCOMING_CREDIT(in)   in->rin_want.cr_datum
 
#define M0_RM_REMOTE_GET(remote)
 
#define M0_RM_REMOTE_PUT(remote)
 

Enumerations

enum  { CNT_NR, CNT_TIME, CNT_LAST }
 
enum  { M0_RM_RESOURCE_TYPE_ID_MAX = 64 }
 
enum  { M0_RM_OWNER_FT = 'O' }
 
enum  m0_rm_incoming_type { M0_RIT_LOCAL, M0_RIT_BORROW, M0_RIT_REVOKE, M0_RIT_NR }
 
enum  m0_res_type_id { M0_RM_FLOCK_RT = 1, M0_RM_RWLOCKABLE_RT = 2 }
 
enum  m0_rm_remote_state {
  REM_FREED = 0, REM_INITIALISED, REM_SERVICE_LOCATING, REM_SERVICE_LOCATED,
  REM_OWNER_LOCATING, REM_OWNER_LOCATED
}
 
enum  m0_rm_owner_state {
  ROS_INITIAL = 1, ROS_INITIALISING, ROS_ACTIVE, ROS_QUIESCE,
  ROS_FINALISING, ROS_DEAD_CREDITOR, ROS_INSOLVENT, ROS_FINAL
}
 
enum  { M0_RM_REQUEST_PRIORITY_MAX = 3, M0_RM_REQUEST_PRIORITY_NR }
 
enum  m0_rm_owner_owned_state { OWOS_HELD, OWOS_CACHED, OWOS_NR }
 
enum  m0_rm_owner_queue_state { OQS_GROUND, OQS_EXCITED, OQS_NR }
 
enum  { M0_RM_LOAN_SELF_ID = 1 }
 
enum  m0_rm_incoming_state {
  RI_INITIALISED = 1, RI_CHECK, RI_SUCCESS, RI_FAILURE,
  RI_WAIT, RI_RELEASED, RI_FINAL
}
 
enum  m0_rm_incoming_policy {
  RIP_NONE = 1, RIP_INPLACE, RIP_STRICT, RIP_JOIN,
  RIP_MAX, RIP_NR
}
 
enum  m0_rm_incoming_flags {
  RIF_MAY_REVOKE = (1 << 0), RIF_MAY_BORROW = (1 << 1), RIF_LOCAL_WAIT = (1 << 2), RIF_LOCAL_TRY = (1 << 3),
  RIF_RESERVE = (1 << 4)
}
 
enum  m0_rm_outgoing_type { M0_ROT_BORROW = 1, M0_ROT_CANCEL, M0_ROT_REVOKE }
 
enum  m0_rm_pin_flags { M0_RPF_TRACK = (1 << 0), M0_RPF_PROTECT = (1 << 1), M0_RPF_BARRIER = (1 << 2) }
 
enum  fop_request_type { FRT_BORROW = M0_RIT_BORROW, FRT_REVOKE = M0_RIT_REVOKE, FRT_CANCEL }
 
enum  m0_rm_fom_phases {
  FOPH_RM_REQ_START = M0_FOM_PHASE_INIT, FOPH_RM_REQ_FINISH = M0_FOM_PHASE_FINISH, FOPH_RM_REQ_CREDIT_GET, FOPH_RM_REQ_WAIT,
  FOPH_RM_REQ_DEBTOR_SUBSCRIBE
}
 

Functions

static void resource_get (struct m0_rm_resource *res)
 
static void resource_put (struct m0_rm_resource *res)
 
static struct m0_rm_incomingcr2in (const struct m0_rm_credit *cr)
 
static void windup_incoming_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void windup_incoming_conflict (struct m0_rm_incoming *in)
 
static void cached_credits_clear (struct m0_rm_owner *owner)
 
static bool owner_is_idle (const struct m0_rm_owner *o)
 
static bool owner_is_liquidated (const struct m0_rm_owner *o)
 
static int remnant_loan_get (const struct m0_rm_loan *loan, const struct m0_rm_credit *credit, struct m0_rm_loan **remnant_loan)
 
static int loan_dup (const struct m0_rm_loan *src_loan, struct m0_rm_loan **dest_loan)
 
static void owner_liquidate (struct m0_rm_owner *src_owner)
 
static void owner_cleanup (struct m0_rm_owner *owner)
 
static void credit_processor (struct m0_rm_resource_type *rt)
 
static bool owner_smgrp_is_locked (const struct m0_rm_owner *owner)
 
 M0_TL_DESCR_DEFINE (res, "resources",, struct m0_rm_resource, r_linkage, r_magix, M0_RM_RESOURCE_MAGIC, M0_RM_RESOURCE_HEAD_MAGIC)
 
 M0_TL_DEFINE (res, M0_INTERNAL, struct m0_rm_resource)
 
 M0_BOB_DEFINE (M0_INTERNAL, &resource_bob, m0_rm_resource)
 
 M0_TL_DESCR_DEFINE (m0_rm_ur, "usage credits",, struct m0_rm_credit, cr_linkage, cr_magix, M0_RM_CREDIT_MAGIC, M0_RM_USAGE_CREDIT_HEAD_MAGIC)
 
 M0_TL_DEFINE (m0_rm_ur, M0_INTERNAL, struct m0_rm_credit)
 
 M0_TL_DESCR_DEFINE (m0_remotes, "remote owners",, struct m0_rm_remote, rem_res_linkage, rem_magix, M0_RM_REMOTE_MAGIC, M0_RM_REMOTE_OWNER_HEAD_MAGIC)
 
 M0_TL_DEFINE (m0_remotes, M0_INTERNAL, struct m0_rm_remote)
 
 M0_TL_DESCR_DEFINE (m0_owners, "local owners",, struct m0_rm_owner, ro_owner_linkage, ro_magix, M0_RM_OWNER_LIST_MAGIC, M0_RM_OWNER_LIST_HEAD_MAGIC)
 
 M0_TL_DEFINE (m0_owners, M0_INTERNAL, struct m0_rm_owner)
 
 M0_BOB_DEFINE (M0_INTERNAL, &credit_bob, m0_rm_credit)
 
 M0_TL_DESCR_DEFINE (pr, "pins-of-credit",, struct m0_rm_pin, rp_credit_linkage, rp_magix, M0_RM_PIN_MAGIC, M0_RM_CREDIT_PIN_HEAD_MAGIC)
 
 M0_TL_DEFINE (pr, M0_INTERNAL, struct m0_rm_pin)
 
 M0_TL_DESCR_DEFINE (pi, "pins-of-incoming",, struct m0_rm_pin, rp_incoming_linkage, rp_magix, M0_RM_PIN_MAGIC, M0_RM_INCOMING_PIN_HEAD_MAGIC)
 
 M0_TL_DEFINE (pi, M0_INTERNAL, struct m0_rm_pin)
 
 M0_BOB_DEFINE (static, &pin_bob, m0_rm_pin)
 
 M0_BOB_DEFINE (, &loan_bob, m0_rm_loan)
 
 M0_BOB_DEFINE (static, &incoming_bob, m0_rm_incoming)
 
 M0_BOB_DEFINE (M0_INTERNAL, &outgoing_bob, m0_rm_outgoing)
 
 M0_BOB_DEFINE (M0_INTERNAL, &rem_bob, m0_rm_remote)
 
M0_INTERNAL void m0_rm_domain_init (struct m0_rm_domain *dom)
 
M0_INTERNAL void m0_rm_domain_fini (struct m0_rm_domain *dom)
 
M0_INTERNAL struct m0_rm_resourcem0_rm_resource_find (const struct m0_rm_resource_type *rt, const struct m0_rm_resource *res)
 
M0_INTERNAL int m0_rm_type_register (struct m0_rm_domain *dom, struct m0_rm_resource_type *rt)
 
M0_INTERNAL void m0_rm_type_deregister (struct m0_rm_resource_type *rt)
 
M0_INTERNAL struct m0_rm_resource_typem0_rm_resource_type_lookup (const struct m0_rm_domain *dom, const uint64_t rtype_id)
 
M0_INTERNAL void m0_rm_resource_add (struct m0_rm_resource_type *rtype, struct m0_rm_resource *res)
 
M0_INTERNAL void m0_rm_resource_del (struct m0_rm_resource *res)
 
M0_INTERNAL void m0_rm_resource_free (struct m0_rm_resource *res)
 
M0_INTERNAL int m0_rm_resource_encode (struct m0_rm_resource *res, struct m0_buf *buf)
 
static void owner_state_set (struct m0_rm_owner *owner, enum m0_rm_owner_state state)
 
static void owner_fail (struct m0_rm_owner *owner, enum m0_rm_owner_state state, int rc)
 
static bool owner_has_loans (struct m0_rm_owner *owner)
 
static void owner_finalisation_check (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_owner_lock (struct m0_rm_owner *owner)
 
static int m0_rm_owner_trylock (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_owner_unlock (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_owner_init (struct m0_rm_owner *owner, struct m0_fid *fid, const struct m0_uint128 *group, struct m0_rm_resource *res, struct m0_rm_remote *creditor)
 
M0_INTERNAL void m0_rm_owner_init_rfid (struct m0_rm_owner *owner, const struct m0_uint128 *group, struct m0_rm_resource *res, struct m0_rm_remote *creditor)
 
static void ha_events_handle (struct m0_rm_resource_type *rt)
 
static void reserve_prio_set (struct m0_rm_reserve_prio *prio, m0_time_t timestamp, struct m0_rm_owner *owner)
 
static bool reserve_prio_is_set (struct m0_rm_reserve_prio *prio)
 
M0_INTERNAL int m0_rm_owner_selfadd (struct m0_rm_owner *owner, struct m0_rm_credit *r)
 
M0_INTERNAL int m0_rm_owner_timedwait (struct m0_rm_owner *owner, uint64_t state, const m0_time_t abs_timeout)
 
M0_INTERNAL void m0_rm_owner_creditor_reset (struct m0_rm_owner *owner, struct m0_rm_remote *creditor)
 
static void owner_windup_locked (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_owner_windup (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_owner_fini (struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_credit_init (struct m0_rm_credit *credit, struct m0_rm_owner *owner)
 
M0_INTERNAL void m0_rm_credit_fini (struct m0_rm_credit *credit)
 
static void incoming_state_set (struct m0_rm_incoming *in, enum m0_rm_incoming_state state)
 
M0_INTERNAL void m0_rm_incoming_init (struct m0_rm_incoming *in, struct m0_rm_owner *owner, enum m0_rm_incoming_type type, enum m0_rm_incoming_policy policy, uint64_t flags)
 
M0_INTERNAL void incoming_surrender (struct m0_rm_incoming *in)
 
M0_INTERNAL void internal_incoming_fini (struct m0_rm_incoming *in)
 
M0_INTERNAL void m0_rm_incoming_fini (struct m0_rm_incoming *in)
 
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 void m0_rm_outgoing_fini (struct m0_rm_outgoing *out)
 
M0_INTERNAL int m0_rm_loan_alloc (struct m0_rm_loan **loan, const struct m0_rm_credit *credit, struct m0_rm_remote *creditor)
 
M0_INTERNAL int m0_rm_loan_init (struct m0_rm_loan *loan, const struct m0_rm_credit *credit, struct m0_rm_remote *creditor)
 
M0_INTERNAL void m0_rm_loan_fini (struct m0_rm_loan *loan)
 
static void pending_outgoing_send (struct m0_rm_owner *owner, struct m0_clink *link)
 
static bool rev_session_clink_cb (struct m0_clink *link)
 
M0_INTERNAL struct m0_rm_remotem0_rm_remote_find (struct m0_rm_remote_incoming *rem_in)
 
static void rm_remote_free (struct m0_ref *ref)
 
M0_INTERNAL void m0_rm_remote_init (struct m0_rm_remote *rem, struct m0_rm_resource *res)
 
M0_INTERNAL void m0_rm_remote_fini (struct m0_rm_remote *rem)
 
static int cached_credits_remove (struct m0_rm_incoming *in)
 
static M0_UNUSED struct m0_rm_resource_typecredit_to_resource_type (struct m0_rm_credit *credit)
 
static M0_UNUSED struct m0_rm_resource_typerem_incoming_to_resource_type (struct m0_rm_remote_incoming *rem_in)
 
M0_INTERNAL int m0_rm_borrow_commit (struct m0_rm_remote_incoming *rem_in)
 
M0_INTERNAL int m0_rm_revoke_commit (struct m0_rm_remote_incoming *rem_in)
 
M0_INTERNAL void m0_rm_resource_initial_credit (const struct m0_rm_resource *resource, struct m0_rm_credit *credit)
 
static int borrow_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void borrow_fom_fini (struct m0_fom *fom)
 
static int revoke_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void revoke_fom_fini (struct m0_fom *fom)
 
static int cancel_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void cancel_fom_fini (struct m0_fom *fom)
 
static int borrow_fom_tick (struct m0_fom *)
 
static int revoke_fom_tick (struct m0_fom *)
 
static int cancel_process (struct m0_fom *fom)
 
static int cancel_fom_tick (struct m0_fom *)
 
static size_t locality (const struct m0_fom *fom)
 
static void remote_incoming_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void remote_incoming_conflict (struct m0_rm_incoming *in)
 
static int request_fom_create (enum m0_rm_incoming_type type, struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void request_fom_fini (struct m0_fom *fom)
 
static int reply_prepare (const enum m0_rm_incoming_type type, struct m0_fom *fom)
 
static void reply_err_set (enum m0_rm_incoming_type type, struct m0_fom *fom, int rc)
 
M0_INTERNAL int m0_rm_reverse_session_get (struct m0_rm_remote_incoming *rem_in, struct m0_rm_remote *remote)
 
static int incoming_prepare (enum m0_rm_incoming_type type, struct m0_fom *fom)
 
static int remote_create (struct m0_rm_remote **rem, struct m0_rm_remote_incoming *rem_in)
 
static int rfom_debtor_subscribe (struct rm_request_fom *rfom, struct m0_rm_remote *debtor)
 
static int request_pre_process (struct m0_fom *fom, enum m0_rm_incoming_type type)
 
static int request_post_process (struct m0_fom *fom)
 
static int request_fom_tick (struct m0_fom *fom, enum m0_rm_incoming_type type)
 
static int debtor_subscription_check (struct m0_fom *fom)
 

Variables

static struct m0_bob_type resource_bob
 
static const struct m0_bob_type credit_bob
 
static const struct m0_bob_type pin_bob
 
M0_INTERNAL const struct m0_bob_type loan_bob
 
static const struct m0_bob_type incoming_bob
 
static const struct m0_bob_type outgoing_bob
 
static const struct m0_bob_type rem_bob
 
const struct m0_uint128 m0_rm_no_group = M0_UINT128(0, 0)
 
static const struct m0_rm_incoming_ops windup_incoming_ops
 
static struct m0_sm_state_descr owner_states []
 
static const struct m0_sm_conf owner_conf
 
static struct m0_sm_state_descr inc_states []
 
static const struct m0_sm_conf inc_conf
 
const struct m0_uint128 m0_rm_no_group
 
static struct m0_rm_incoming_ops remote_incoming_ops
 
static struct m0_fom_ops rm_fom_borrow_ops
 
const struct m0_fom_type_ops rm_borrow_fom_type_ops
 
static struct m0_fom_ops rm_fom_revoke_ops
 
const struct m0_fom_type_ops rm_revoke_fom_type_ops
 
static struct m0_fom_ops rm_fom_cancel_ops
 
const struct m0_fom_type_ops rm_cancel_fom_type_ops
 
struct m0_sm_state_descr rm_req_phases []
 
const struct m0_sm_conf borrow_sm_conf
 
const struct m0_sm_conf canoke_sm_conf
 

Owner state machine

m0_rm_owner and m0_rm_incoming together form a state machine where basic resource management functionality is implemented.

This state machine reacts to the following external events:

  • an incoming request from a local user;
  • an incoming loan request from another domain;
  • an incoming revocation request from another domain;
  • local user releases a pin on a credit (as a by-product of destroying an incoming request);
  • completion of an outgoing request to another domain (including a timeout or a failure).

Any event is processed in a uniform manner:

  1. m0_rm_owner::ro_sm_grp Group lock is taken;
  2. m0_rm_owner lists are updated to reflect the event, see details below. This temporarily violates the owner_invariant();
  3. owner_balance() is called to restore the invariant, this might create new imbalances and go through several iterations;
  4. m0_rm_owner::ro_sm_grp Group lock is released.

Event handling is serialised by the owner lock. It is not legal to wait for networking or IO events under this lock.

static void owner_balance (struct m0_rm_owner *o)
 
static void incoming_check (struct m0_rm_incoming *in)
 
static int incoming_check_with (struct m0_rm_incoming *in, struct m0_rm_credit *credit)
 
static void incoming_complete (struct m0_rm_incoming *in, int32_t rc)
 
static void incoming_policy_apply (struct m0_rm_incoming *in)
 
static void incoming_policy_none (struct m0_rm_incoming *in)
 
static int outgoing_check (struct m0_rm_incoming *in, enum m0_rm_outgoing_type, struct m0_rm_credit *credit, struct m0_rm_remote *other)
 
static int revoke_send (struct m0_rm_incoming *in, struct m0_rm_loan *loan, struct m0_rm_credit *credit)
 
static int cancel_send (struct m0_rm_loan *loan)
 
static int borrow_send (struct m0_rm_incoming *in, struct m0_rm_credit *credit)
 
static void conflict_notify (struct m0_rm_credit *credit)
 
static int cached_credits_hold (struct m0_rm_incoming *in)
 
static bool incoming_is_complete (const struct m0_rm_incoming *in)
 
static bool credit_group_conflict (const struct m0_uint128 *g1, const struct m0_uint128 *g2)
 
static void incoming_queue (struct m0_rm_owner *owner, struct m0_rm_incoming *in)
 
M0_INTERNAL void m0_rm_credit_get (struct m0_rm_incoming *in)
 
M0_INTERNAL void m0_rm_credit_put (struct m0_rm_incoming *in)
 
static void incoming_pins_del (struct m0_rm_incoming *in, uint32_t flags)
 
static void barrier_pins_del (struct m0_rm_incoming *in)
 
static bool credit_is_reserved (const struct m0_rm_credit *cr)
 
static int credit_maybe_track (struct m0_rm_incoming *in, struct m0_rm_credit *cr, bool notify, int *wait)
 
static int incoming_check_held (struct m0_rm_incoming *in, struct m0_rm_credit *rest, struct m0_rm_credit *held, int *wait, bool *cr_used)
 
static bool has_reserve_priority (struct m0_rm_incoming *in1, struct m0_rm_incoming *in2)
 
static int credit_reservation_check (struct m0_rm_incoming *in, struct m0_rm_credit *cr, int *wait)
 
M0_INTERNAL void m0_rm_outgoing_complete (struct m0_rm_outgoing *og)
 
M0_INTERNAL int m0_rm_owner_loan_debit (struct m0_rm_owner *owner, struct m0_rm_loan *paid_loan, struct m0_tl *list)
 
M0_INTERNAL int granted_maybe_reserve (struct m0_rm_credit *granted, struct m0_rm_credit *to_cache)
 
static int loan_check (struct m0_rm_owner *owner, struct m0_tl *list, struct m0_rm_credit *rest)
 
M0_INTERNAL int m0_rm_loan_settle (struct m0_rm_owner *owner, struct m0_rm_loan *loan)
 

Invariants group

Resource manager maintains a number of interrelated data-structures in memory. Invariant checking functions, defined in this section assert internal consistency of these structures.

enum  credit_queue {
  OIS_BORROWED = 0, OIS_SUBLET, OIS_OUTGOING, OIS_OWNED,
  OIS_INCOMING, OIS_NR
}
 
static bool resource_list_check (const struct m0_rm_resource *res, void *datum)
 
static bool resource_type_invariant (const struct m0_rm_resource_type *rt)
 
static bool owner_invariant (struct m0_rm_owner *owner)
 
static bool owner_invariant_state (const struct m0_rm_owner *owner, struct owner_invariant_state *is)
 
static bool incoming_invariant (const struct m0_rm_incoming *in)
 
static bool pin_check (const void *bob)
 
static bool credit_invariant (const struct m0_rm_credit *credit, void *data)
 
static bool conflict_exists (const struct m0_rm_credit *cr, const struct m0_rm_owner *owner)
 

Pin helpers

static void pin_del (struct m0_rm_pin *pin)
 
static int incoming_pin_nr (const struct m0_rm_incoming *in, uint32_t flags)
 
static void incoming_release (struct m0_rm_incoming *in)
 
static int credit_pin_nr (const struct m0_rm_credit *credit, uint32_t flags)
 
M0_INTERNAL int m0_rm_pin_add (struct m0_rm_incoming *in, struct m0_rm_credit *credit, uint32_t flags)
 

Credit helpers

static bool credit_eq (const struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static bool credit_is_empty (const struct m0_rm_credit *credit)
 
static bool credit_intersects (const struct m0_rm_credit *A, const struct m0_rm_credit *B)
 
static bool credit_conflicts (const struct m0_rm_credit *A, const struct m0_rm_credit *B)
 
static int credit_diff (struct m0_rm_credit *c0, const struct m0_rm_credit *c1)
 
static int remnant_credit_get (const struct m0_rm_credit *src, const struct m0_rm_credit *diff, struct m0_rm_credit **remnant_credit)
 
M0_INTERNAL int m0_rm_credit_dup (const struct m0_rm_credit *src_credit, struct m0_rm_credit **dest_credit)
 
M0_INTERNAL int m0_rm_credit_copy (struct m0_rm_credit *dst, const struct m0_rm_credit *src)
 
M0_INTERNAL int m0_rm_credit_encode (struct m0_rm_credit *credit, struct m0_buf *buf)
 
M0_INTERNAL int m0_rm_credit_decode (struct m0_rm_credit *credit, struct m0_buf *buf)
 

remote Code to deal with remote owners

static int service_locate (struct m0_rm_resource_type *rtype, struct m0_rm_remote *rem)
 
static int resource_locate (struct m0_rm_resource_type *rtype, struct m0_rm_remote *rem)
 
M0_INTERNAL int m0_rm_db_service_query (const char *name, struct m0_rm_remote *rem)
 
M0_INTERNAL int m0_rm_remote_resource_locate (struct m0_rm_remote *rem)
 
M0_INTERNAL int m0_rm_net_locate (struct m0_rm_credit *credit, struct m0_rm_remote *other)
 

HA-notification Code to deal with HA notifications on creditors/debtors

death

static bool rm_on_remote_death_cb (struct m0_clink *link)
 
static void rm_remote_online_handler (struct m0_rm_remote *remote)
 
static void rm_remote_death_handler (struct m0_rm_remote *remote)
 
static struct m0_queueremote_to_queue (struct m0_rm_remote *remote)
 

RM FOP interface.

Functions and data-structures used for interaction between RM core and RM fops (and fom)s.

M0_INTERNAL int m0_rm_borrow_done (struct m0_rm_outgoing *out, struct m0_rm_loan *loan)
 
int m0_rm_revoke_done (struct m0_rm_outgoing *out)
 
int m0_rm_resource_owner_find (const struct m0_rm_resource *resource, struct m0_rm_owner **owner)
 
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 *remote)
 
M0_INTERNAL void m0_rm_outgoing_send (struct m0_rm_outgoing *outgoing)
 

Detailed Description

A resource is an entity in Motr for which a notion of ownership can be well-defined. See the HLD referenced below for more details.

In Motr almost everything is a resource, except for the low-level types that are used to implement the resource framework.

Resource management is split into two parts:

  1. generic functionality, implemented by the code in rm/ directory and
  2. resource type specific functionality.

These parts interact through the operation vectors (m0_rm_resource_ops, m0_rm_resource_type_ops and m0_rm_credit_ops) provided by a resource type and called by the generic code. Type specific code, in turn, calls generic entry-points described in the Resource type interface section.

In the documentation below, responsibilities of generic and type specific parts of the resource manager are delineated.

Overview

A resource (m0_rm_resource) is associated with various file system entities:

A resource owner (m0_rm_owner) represents a collection of credits to use a particular resource.

RM-data-structs.svg

To use a resource, a user of the resource manager creates an incoming resource request (m0_rm_incoming), that describes a wanted usage credit (m0_rm_credit_get()). Sometimes the request can be fulfilled immediately, sometimes it requires changes in the credit ownership. In the latter case outgoing requests are directed to the remote resource owners (which typically means a network communication) to collect the wanted usage credit at the owner. When an outgoing request reaches its target remote domain, an incoming request is created and processed (which in turn might result in sending further outgoing requests). Eventually, a reply is received for the outgoing request. When incoming request processing is complete, it "pins" the wanted credit. This credit can be used until the incoming request structure is destroyed (m0_rm_credit_put()) and the pin is released.

See the documentation for individual resource management data-types and interfaces for more detailed description of their behaviour.

Terminology.

Various terms are used to described credit flow of the resources in a cluster.

Owners of credits for a particular resource are arranged in a cluster-wide hierarchy. This hierarchical arrangement depends on system structure (e.g., where devices are connected, how network topology looks like) and dynamic system behaviour (how accesses to a resource are distributed).

Originally, all credits on the resource belong to a single owner or a set of owners, residing on some well-known servers. Proxy servers request and cache credits from there. Lower level proxies and clients request credits in turn. According to the order in this hierarchy, one distinguishes "upward" and "downward" owners relative to a given one.

In a given ownership transfer operation, a downward owner is "debtor" and upward owner is "creditor". The credit being transferred is called a "loan" (note that this word is used only as a noun). When a credit is transferred from a creditor to a debtor, the latter "borrows" and the former "sub-lets" the loan. When a credit is transferred in the other direction, the creditor "revokes" and debtor "returns" the loan.

A debtor can voluntarily return a loan. This is called a "cancel" operation.

Concurrency control.

Generic resource manager makes no assumptions about threading model used by its callers. Generic resource data-structures and code are thread safe.

3 types of locks protect all generic resource manager states:

None of these locks are ever held while waiting for a network communication to complete.

Lock ordering:

  1. m0_rm_owner::ro_lock
  2. m0_rm_resource_type::rt_lock

A group of cooperating owners.

The owners in a group coordinate their activities internally (by means outside of resource manager control) as far as resource management is concerned.

Resource manager assumes that credits granted to the owners from the same group never conflict.

Typical usage is to assign all owners from the same distributed transaction (or from the same network client) to a group. The decision about a group scope has concurrency related implications, because the owners within a group must coordinate access between themselves to maintain whatever scheduling properties are desired, like serialisability.

Liveness.

None of the resource manager structures, except for m0_rm_resource, require reference counting, because their liveness is strictly determined by the liveness of an "owning" structure into which they are logically embedded.

The resource structure (m0_rm_resource) can be shared between multiple resource owners (m0_rm_owner) and its liveness is determined by the reference counting (m0_rm_resource::r_ref).

As in many other places in Motr, liveness of "global" long-living structures (m0_rm_domain, m0_rm_resource_type) is managed by the upper layers which are responsible for determining when it is safe to finalise the structures. Typically, an upper layer would achieve this by first stopping and finalising all possible resource manager users.

Similarly, a resource owner (m0_rm_owner) liveness is not explicitly determined by the resource manager. It is up to the user to determine when an owner (which can be associated with a file, or a client, or a similar entity) is safe to be finalised.

When a resource owner is finalised (ROS_FINALISING) it tears down the credit network by revoking the loans it sublet to and by retuning the loans it borrowed from other owners.

Resource identification and location.

See also
m0_rm_remote

Persistent state.

Network protocol.

See also
doc/PDF/HLD_of_RM_interfaces.pdf

This file includes data structures and function used by RM:fop layer.

This file includes data structures used by RM:fop layer.

Macro Definition Documentation

◆ INCOMING_CREDIT

#define INCOMING_CREDIT (   in)    in->rin_want.cr_datum

Definition at line 126 of file rm.c.

◆ M0_RM_REMOTE_GET

#define M0_RM_REMOTE_GET (   remote)
Value:
({ \
struct m0_rm_remote *_r = (remote); \
int _c = m0_ref_read(&_r->rem_refcnt); \
M0_LOG(M0_DEBUG, "rm_remote=%p ref: %d -> %d", _r, _c, _c + 1); \
m0_ref_get(&_r->rem_refcnt); \
})
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
Definition: refs.c:44
static struct m0_rm_remote * remote
Definition: rm_fops.c:35

M0_RM_REMOTE_GET() increments remote's reference counter. Why macro? Because we want logs from the caller.

Definition at line 1957 of file rm.h.

◆ M0_RM_REMOTE_PUT

#define M0_RM_REMOTE_PUT (   remote)
Value:
({ \
int _c; \
struct m0_rm_remote *_r = (remote); \
struct m0_mutex *_m = &_r->rem_resource->r_mutex; \
m0_mutex_lock(_m); \
_c = m0_ref_read(&_r->rem_refcnt); \
M0_LOG(M0_DEBUG, "rm_remote=%p ref: %d -> %d", _r, _c, _c - 1); \
m0_ref_put(&_r->rem_refcnt); \
m0_mutex_unlock(_m); \
})
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
Definition: refs.c:44
static struct m0_rm_remote * remote
Definition: rm_fops.c:35
Definition: mutex.h:47

M0_RM_REMOTE_PUT() decrements remote's reference counter. rm_remote_free() is called if counter reaches zero, that's why resource->r_mutex is taken here.

See also
->rem_refcnt for more info about it.

Definition at line 1971 of file rm.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CNT_NR 
CNT_TIME 
CNT_LAST 

Definition at line 213 of file rm.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_RM_RESOURCE_TYPE_ID_MAX 

Definition at line 233 of file rm.h.

◆ anonymous enum

anonymous enum

RM owner fid type id.

Enumerator
M0_RM_OWNER_FT 

Definition at line 240 of file rm.h.

◆ anonymous enum

anonymous enum
Enumerator
M0_RM_REQUEST_PRIORITY_MAX 

Incoming requests are assigned a priority (greater numerical value is higher). When multiple requests are ready to be fulfilled, higher priority ones have a preference.

M0_RM_REQUEST_PRIORITY_NR 

Definition at line 866 of file rm.h.

◆ anonymous enum

anonymous enum
Enumerator
M0_RM_LOAN_SELF_ID 

Value of m0_rm_loan::rl_id for a self-loan. This value is invalid for any other type of loan.

Definition at line 1081 of file rm.h.

◆ credit_queue

Enumerator
OIS_BORROWED 
OIS_SUBLET 
OIS_OUTGOING 
OIS_OWNED 
OIS_INCOMING 
OIS_NR 

Definition at line 2939 of file rm.c.

◆ fop_request_type

Enumerator
FRT_BORROW 
FRT_REVOKE 
FRT_CANCEL 

Definition at line 70 of file rm_foms.c.

◆ m0_res_type_id

Enumerator
M0_RM_FLOCK_RT 
M0_RM_RWLOCKABLE_RT 

Definition at line 371 of file rm.h.

◆ m0_rm_fom_phases

Enumerator
FOPH_RM_REQ_START 
FOPH_RM_REQ_FINISH 
FOPH_RM_REQ_CREDIT_GET 
FOPH_RM_REQ_WAIT 
FOPH_RM_REQ_DEBTOR_SUBSCRIBE 

Definition at line 42 of file rm_foms.h.

◆ m0_rm_incoming_flags

Flags controlling incoming usage credit request processing. These flags are stored in m0_rm_incoming::rin_flags and analysed in m0_rm_credit_get().

Enumerator
RIF_MAY_REVOKE 

Previously sub-let credits may be revoked, if necessary, to fulfill this request.

RIF_MAY_BORROW 

More credits may be borrowed, if necessary, to fulfill this request.

RIF_LOCAL_WAIT 

The interaction between the request and locally possessed credits is the following:

  • by default, locally possessed credits are ignored. This scenario is typical for a local request (M0_RIT_LOCAL), because local users resolve conflicts by some other means (usually some form of concurrency control, like locking);
  • if RIF_LOCAL_WAIT is set, the request will wait until there is no locally possessed credits conflicting with the wanted credit. This is typical for a remote request (M0_RIT_BORROW or M0_RIT_REVOKE);
  • if RIF_LOCAL_TRY is set, the request will be immediately denied, if there are conflicting local credits. This allows to implement a "try-lock" like functionality.

RIF_LOCAL_WAIT and RIF_LOCAL_TRY flags are mutually exclusive.

RIF_LOCAL_TRY 

Fail the request if it cannot be fulfilled because of the local conflicts.

See also
RIF_LOCAL_WAIT
RIF_RESERVE 

Reserve credits that fulfill incoming request by putting M0_RPF_BARRIER pins. Reserved credit can't be granted to other incoming request until request which made reservation is granted. The only exception is when incoming request also has RIF_RESERVE flag and has bigger reserve priority (see m0_rm_incoming documentation).

Definition at line 1183 of file rm.h.

◆ m0_rm_incoming_policy

Some universal (i.e., not depending on a resource type) granting policies.

Enumerator
RIP_NONE 
RIP_INPLACE 

If possible, don't insert a new credit into the list of possessed credits. Instead, pin possessed credits overlapping with the requested credit.

RIP_STRICT 

Insert a new credit into the list of possessed credits, equal to the requested credit.

RIP_JOIN 

...

RIP_MAX 

Grant maximal possible credit, not conflicting with others.

RIP_NR 

Definition at line 1155 of file rm.h.

◆ m0_rm_incoming_state

States of incoming request. See m0_rm_incoming for description.

dot_inline_dotgraph_34.png
Enumerator
RI_INITIALISED 
RI_CHECK 

Ready to check whether the request can be fulfilled.

RI_SUCCESS 

Request has been fulfilled.

RI_FAILURE 

Request cannot be fulfilled.

RI_WAIT 

Has to wait for some future event, like outgoing request completion or release of a locally held or reserved usage credit.

RI_RELEASED 

Credit has been released (possibly by m0_rm_credit_put()).

RI_FINAL 

Request finalised.

Definition at line 1134 of file rm.h.

◆ m0_rm_incoming_type

Types of an incoming usage credit request.

Enumerator
M0_RIT_LOCAL 

A request for a usage credit from a local user. When the request succeeds, the credit is held by the owner.

M0_RIT_BORROW 

A request to loan a usage (credit) to a remote owner. Fulfillment of this request might cause further outgoing requests to be sent, e.g., to revoke credits sub-let to remote owner.

M0_RIT_REVOKE 

A request to return a usage credit previously sub-let to this owner.

M0_RIT_NR 

Definition at line 247 of file rm.h.

◆ m0_rm_outgoing_type

Types of outgoing requests sent by the request manager.

Enumerator
M0_ROT_BORROW 

A request to borrow a credit from an upward resource owner. This translates into a M0_RIT_BORROW incoming request.

M0_ROT_CANCEL 

A request returning a previously borrowed credit. Cancel is voluntary.

M0_ROT_REVOKE 

A request to return previously granted credit. This translates into a M0_RIT_REVOKE incoming request on the remote owner.

Definition at line 1504 of file rm.h.

◆ m0_rm_owner_owned_state

m0_rm_owner::ro_owned[] list of usage credits possessed by the owner is split into sub-lists enumerated by this enum.

Enumerator
OWOS_HELD 

Sub-list of pinned credits.

See also
m0_rm_credit
OWOS_CACHED 

Not-pinned credit is "cached". Such credit can be returned to an upward owner from which it was previously borrowed (i.e., credit can be "cancelled") or sub-let to downward owners.

OWOS_NR 

Definition at line 880 of file rm.h.

◆ m0_rm_owner_queue_state

Lists of incoming and outgoing requests are subdivided into sub-lists.

Enumerator
OQS_GROUND 

"Ground" request is not excited.

OQS_EXCITED 

Excited requests are those for which something has to be done. An outgoing request is excited when it completes (or times out). An incoming request is excited when it's ready to go from RI_WAIT to RI_CHECK state.

Resource owner state machine goes through lists of excited requests processing them. This processing can result in more excitement somewhere, but eventually terminates.

See also
http://en.wikipedia.org/wiki/Excited_state
OQS_NR 

Definition at line 899 of file rm.h.

◆ m0_rm_owner_state

m0_rm_owner state machine states.

dot_inline_dotgraph_35.png
Enumerator
ROS_INITIAL 

Initial state.

In this state owner credits lists are empty (including incoming and outgoing request lists).

ROS_INITIALISING 

Initial network setup state:

  • registering with the resource data-base;
  • &c.
ROS_ACTIVE 

Active request processing state. Once an owner reached this state it must pass through the finalising state.

ROS_QUIESCE 

No new requests are allowed in this state. Existing incoming requests are drained in this state.

ROS_FINALISING 

Flushes all the loans. The owner collects from debtors and repays creditors.

ROS_DEAD_CREDITOR 

Failure state.

Creditor was considered dead by HA. Owner made credits cleanup and is not able to satisfy any new incoming requests. Owner can recover from this state back to ROS_ACTIVE after HA notification saying RM creditor is online again or if user provides another creditor via m0_rm_owner_creditor_reset().

ROS_INSOLVENT 

Final state.

During finalisation, if owner fails to clear the loans, it enters INSOLVENT state.

ROS_FINAL 

Final state.

In this state owner credits lists are empty (including incoming and outgoing request lists).

Definition at line 810 of file rm.h.

◆ m0_rm_pin_flags

Enumerator
M0_RPF_TRACK 
M0_RPF_PROTECT 
M0_RPF_BARRIER 

Definition at line 1556 of file rm.h.

◆ m0_rm_remote_state

Enumerator
REM_FREED 
REM_INITIALISED 
REM_SERVICE_LOCATING 
REM_SERVICE_LOCATED 
REM_OWNER_LOCATING 
REM_OWNER_LOCATED 

Definition at line 675 of file rm.h.

Function Documentation

◆ barrier_pins_del()

static void barrier_pins_del ( struct m0_rm_incoming in)
static

Deletes all M0_RPF_BARRIER pins set by a given incoming request.

In other words, function cancels all credit reservations made by incoming request. Also it deletes pins set to track reserved credits. It is guaranteed that if M0_RPF_TRACK pin exists for reserved credit, then it was stuck to track reservation cancel, because reserved credit is cached. In some rare cases credit can also be held (if M0_RIF_LOCAL_WAIT was not set for 'in'), but logic works fine in this case too.

Definition at line 2016 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ borrow_fom_create()

static int borrow_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Forward declaration

Definition at line 807 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ borrow_fom_fini()

static void borrow_fom_fini ( struct m0_fom fom)
static

Definition at line 816 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ borrow_fom_tick()

static int borrow_fom_tick ( struct m0_fom fom)
static

This function handles the request to borrow a credit to a resource on a server ("creditor").

Prior to borrowing credit remote object (debtor) has to be subscribed to HA notifications about conf object status change to handle debtor death properly. This is done in FOPH_RM_REQ_DEBTOR_SUBSCRIBE phase.

Parameters
fom-> fom processing the CREDIT_BORROW request on the server

Definition at line 730 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ borrow_send()

static int borrow_send ( struct m0_rm_incoming in,
struct m0_rm_credit credit 
)
static

Sends an outgoing borrow request to the upward creditor. The request will borrow the credit "credit".

Definition at line 2644 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cached_credits_clear()

static void cached_credits_clear ( struct m0_rm_owner owner)
static

Definition at line 1467 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cached_credits_hold()

static int cached_credits_hold ( struct m0_rm_incoming in)
static

Definition at line 1820 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cached_credits_remove()

static int cached_credits_remove ( struct m0_rm_incoming in)
static

Definition at line 1485 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_fom_create()

static int cancel_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 841 of file rm_foms.c.

Here is the call graph for this function:

◆ cancel_fom_fini()

static void cancel_fom_fini ( struct m0_fom fom)
static

Definition at line 850 of file rm_foms.c.

Here is the call graph for this function:

◆ cancel_fom_tick()

static int cancel_fom_tick ( struct m0_fom fom)
static

Definition at line 799 of file rm_foms.c.

Here is the call graph for this function:

◆ cancel_process()

static int cancel_process ( struct m0_fom fom)
static

Definition at line 759 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancel_send()

static int cancel_send ( struct m0_rm_loan loan)
static

Returns the loan to the creditor

Definition at line 2672 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ conflict_exists()

static bool conflict_exists ( const struct m0_rm_credit cr,
const struct m0_rm_owner owner 
)
static

Definition at line 2973 of file rm.c.

Here is the caller graph for this function:

◆ conflict_notify()

static void conflict_notify ( struct m0_rm_credit credit)
static

Call m0_rm_incoming_ops::rio_conflict() for all incoming requests which pinned the given credit. Function is called when a request arrives which conflicts with a held credit.

Parameters
creditCredit which conflicts with incoming request.

Definition at line 2147 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cr2in()

static struct m0_rm_incoming * cr2in ( const struct m0_rm_credit cr)
static

Definition at line 1037 of file rm.c.

Here is the caller graph for this function:

◆ credit_conflicts()

static bool credit_conflicts ( const struct m0_rm_credit A,
const struct m0_rm_credit B 
)
static

Definition at line 3239 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_diff()

static int credit_diff ( struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 3250 of file rm.c.

Here is the caller graph for this function:

◆ credit_eq()

static bool credit_eq ( const struct m0_rm_credit c0,
const struct m0_rm_credit c1 
)
static

Definition at line 3258 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_group_conflict()

static bool credit_group_conflict ( const struct m0_uint128 g1,
const struct m0_uint128 g2 
)
static

Definition at line 1730 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_intersects()

static bool credit_intersects ( const struct m0_rm_credit A,
const struct m0_rm_credit B 
)
static

Definition at line 3230 of file rm.c.

Here is the caller graph for this function:

◆ credit_invariant()

static bool credit_invariant ( const struct m0_rm_credit credit,
void *  data 
)
static

Definition at line 2956 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_is_empty()

static bool credit_is_empty ( const struct m0_rm_credit credit)
static

Returns true when cr_datum is 0, else returns false.

Definition at line 3345 of file rm.c.

Here is the caller graph for this function:

◆ credit_is_reserved()

static bool credit_is_reserved ( const struct m0_rm_credit cr)
static

Definition at line 2134 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_maybe_track()

static int credit_maybe_track ( struct m0_rm_incoming in,
struct m0_rm_credit cr,
bool  notify,
int *  wait 
)
static

Add M0_RPF_TRACK pin from incoming request to credit if flag RIF_LOCAL_TRY is not set in request.

Definition at line 2178 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_pin_nr()

static int credit_pin_nr ( const struct m0_rm_credit credit,
uint32_t  flags 
)
static

Number of pins with a given flag combination, stuck in a given credit.

Definition at line 3084 of file rm.c.

Here is the caller graph for this function:

◆ credit_processor()

static void credit_processor ( struct m0_rm_resource_type rt)
static

Definition at line 697 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_reservation_check()

static int credit_reservation_check ( struct m0_rm_incoming in,
struct m0_rm_credit cr,
int *  wait 
)
static

Checks whether barrier currently set for credit (if any) is overcome by a given incoming request. If yes, then barrier is replaced, otherwise tracking pin is added.

Definition at line 2286 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ credit_to_resource_type()

static M0_UNUSED struct m0_rm_resource_type* credit_to_resource_type ( struct m0_rm_credit credit)
inlinestatic

Definition at line 1555 of file rm.c.

Here is the caller graph for this function:

◆ debtor_subscription_check()

static int debtor_subscription_check ( struct m0_fom fom)
static

Definition at line 689 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ granted_maybe_reserve()

M0_INTERNAL int granted_maybe_reserve ( struct m0_rm_credit granted,
struct m0_rm_credit to_cache 
)

Check if credit that was granted by remote owner should be reserved by some incoming request that waits for outgoing request completion. If yes, then reserve 'to_cache' credit and force other requests to wait for reservation cancel.

Definition at line 2750 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ha_events_handle()

static void ha_events_handle ( struct m0_rm_resource_type rt)
static

Definition at line 661 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_reserve_priority()

static bool has_reserve_priority ( struct m0_rm_incoming in1,
struct m0_rm_incoming in2 
)
static

Checks whether 'in1' has higher reserve priority than 'in2'.

Definition at line 2261 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_check()

static void incoming_check ( struct m0_rm_incoming in)
static

Takes an incoming request in RI_CHECK state and attempts to perform a non-blocking state transition.

This function leaves the request either in RI_WAIT, RI_SUCCESS or RI_FAILURE state.

Todo:
Here we introduce "thundering herd" problem, potentially waking up all requests waiting for reserved credit. It is necessary, because rio_conflict() won't be called for 'in' if waiting requests are not woken up.

Definition at line 2043 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_check_held()

static int incoming_check_held ( struct m0_rm_incoming in,
struct m0_rm_credit rest,
struct m0_rm_credit held,
int *  wait,
bool *  cr_used 
)
static

Try to use held credit to satisfy incoming request. Function doesn't reduce 'rest'.

Parameters
inIncoming request.
restNot yet satisfied part of originally requested credit.
heldCredit to check against incoming request.
waitCounter that is increased if held credit can't be used immediately and incoming request has to wait until held credit is released.
cr_usedOutput parameter. Set to true if credit fulfills request.
Todo:
Ignore borrow requests for held non-conflicting credits. If it is the only credit that can satisfy incoming request, then eventually creditor will revoke it.

Ideally, non-conflicting credits should be borrowed unconditionally. But that means that copy of credit is borrowed, so the same credit is held by two RM owners and the total number of credits in cluster increases. Currently, there is no way in RM framework to link credit and its borrowed copy.

Definition at line 2210 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_check_with()

static int incoming_check_with ( struct m0_rm_incoming in,
struct m0_rm_credit rest 
)
static

Main helper function to incoming_check(), which starts with "rest" set to the wanted credit and goes though the sequence of checks, reducing "rest".

CHECK logic can be described by means of "wait conditions". A wait condition is something that prevents immediate fulfillment of the request.

- A request with RIF_LOCAL_WAIT bit set can be fulfilled iff the credits
  on ->ro_owned[OWOS_CACHED] list together imply the wanted credit;

- a request without RIF_LOCAL_WAIT bit can be fulfilled iff the credits
  on all ->ro_owned[] lists together imply the wanted credit.

If there is not enough credits on ->ro_owned[] lists, an incoming request has to wait until some additional credits are borrowed from the upward creditor or revoked from downward debtors.

A RIF_LOCAL_WAIT request, in addition, can wait until a credit moves from ->ro_owned[OWOS_HELD] to ->ro_owned[OWOS_CACHED].

This function performs no state transitions by itself. Instead its return value indicates the target state:

- 0: the request is fulfilled, the target state is RI_SUCCESS,
- +ve: more waiting is needed, the target state is RI_WAIT,
- -ve: error, the target state is RI_FAILURE.
Todo:
Will be deleted once borrowing held non-conflicting credits is allowed.

Definition at line 2341 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_complete()

static void incoming_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Helper function called when an incoming request processing completes.

Sets m0_rm_incoming::rin_sm.sm_rc, updates request state, invokes completion call-back, broadcasts request channel and releases request pins.

Definition at line 2486 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_invariant()

static bool incoming_invariant ( const struct m0_rm_incoming in)
static

Invariant for m0_rm_incoming.

Definition at line 2901 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_is_complete()

static bool incoming_is_complete ( const struct m0_rm_incoming in)
static

Definition at line 2129 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_pin_nr()

static int incoming_pin_nr ( const struct m0_rm_incoming in,
uint32_t  flags 
)
static

Number of pins with a given flag combination, issued by a given incoming request.

Definition at line 3101 of file rm.c.

Here is the caller graph for this function:

◆ incoming_pins_del()

static void incoming_pins_del ( struct m0_rm_incoming in,
uint32_t  flags 
)
static

Deletes all pins set by a given incoming request with given pin flags.

Definition at line 1921 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_policy_apply()

static void incoming_policy_apply ( struct m0_rm_incoming in)
static

Definition at line 2521 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_policy_none()

static void incoming_policy_none ( struct m0_rm_incoming in)
static

Definition at line 2517 of file rm.c.

Here is the caller graph for this function:

◆ incoming_prepare()

static int incoming_prepare ( enum m0_rm_incoming_type  type,
struct m0_fom fom 
)
static

Definition at line 388 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_queue()

static void incoming_queue ( struct m0_rm_owner owner,
struct m0_rm_incoming in 
)
static

Definition at line 1737 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_release()

static void incoming_release ( struct m0_rm_incoming in)
static

Releases credits pinned by an incoming request, waking up other pending incoming requests if necessary.

Definition at line 3119 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_state_set()

static void incoming_state_set ( struct m0_rm_incoming in,
enum m0_rm_incoming_state  state 
)
inlinestatic

Definition at line 1042 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ incoming_surrender()

M0_INTERNAL void incoming_surrender ( struct m0_rm_incoming in)

Definition at line 1082 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ internal_incoming_fini()

M0_INTERNAL void internal_incoming_fini ( struct m0_rm_incoming in)

Definition at line 1089 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loan_check()

static int loan_check ( struct m0_rm_owner owner,
struct m0_tl list,
struct m0_rm_credit rest 
)
static

Definition at line 2789 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loan_dup()

static int loan_dup ( const struct m0_rm_loan src_loan,
struct m0_rm_loan **  dest_loan 
)
static

Definition at line 1176 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ locality()

static size_t locality ( const struct m0_fom fom)
static

Definition at line 269 of file rm_foms.c.

Here is the caller graph for this function:

◆ M0_BOB_DEFINE() [1/7]

M0_BOB_DEFINE ( M0_INTERNAL  ,
resource_bob,
m0_rm_resource   
)

◆ M0_BOB_DEFINE() [2/7]

M0_BOB_DEFINE ( M0_INTERNAL  ,
credit_bob,
m0_rm_credit   
)

◆ M0_BOB_DEFINE() [3/7]

M0_BOB_DEFINE ( static  ,
pin_bob,
m0_rm_pin   
)

◆ M0_BOB_DEFINE() [4/7]

M0_BOB_DEFINE ( loan_bob,
m0_rm_loan   
)

◆ M0_BOB_DEFINE() [5/7]

M0_BOB_DEFINE ( static  ,
incoming_bob,
m0_rm_incoming   
)

◆ M0_BOB_DEFINE() [6/7]

M0_BOB_DEFINE ( M0_INTERNAL  ,
outgoing_bob,
m0_rm_outgoing   
)

◆ M0_BOB_DEFINE() [7/7]

M0_BOB_DEFINE ( M0_INTERNAL  ,
rem_bob,
m0_rm_remote   
)

◆ m0_rm_borrow_commit()

M0_INTERNAL int m0_rm_borrow_commit ( struct m0_rm_remote_incoming bor)

Moves credited credits from "owned" to "sublet" list.

This is called by borrow fom code after successful processing of bor->bi_incoming.

On success, this call transfers ownership of bor->bi_loan to the owner.

Precondition
bor->bi_loan is initialised.
m0_mutex_is_locked(&owner->ro_lock)
in->rin_state == RI_SUCCESS
in->rin_type == RIT_BORROW
loan->rl_credit.ri_owner == owner

where "owner", "loan" and "in" are respective attributes of "bor".

Definition at line 1564 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_borrow_done()

M0_INTERNAL int m0_rm_borrow_done ( struct m0_rm_outgoing out,
struct m0_rm_loan loan 
)

Adds borrowed credit to the "borrowed" and "owned" lists.

This is called on receiving a reply to an outgoing BORROW fop.

This function transfers ownership of the supplied "loan" structure to the owner.

◆ m0_rm_credit_copy()

M0_INTERNAL int m0_rm_credit_copy ( struct m0_rm_credit dst,
const struct m0_rm_credit src 
)

Definition at line 3333 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_decode()

M0_INTERNAL int m0_rm_credit_decode ( struct m0_rm_credit credit,
struct m0_buf buf 
)

Decodes a credit from its serialised presentation.

Definition at line 3376 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_dup()

M0_INTERNAL int m0_rm_credit_dup ( const struct m0_rm_credit src_credit,
struct m0_rm_credit **  dest_credit 
)

Allocates memory and makes another copy of credit struct.

Parameters
src_credit- A source credit which is to be duplicated.
dest_credit- A destination credit. This credit will be allocated, initialised and then filled with src_credit. Allocates and duplicates a credit.

Definition at line 3308 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_encode()

M0_INTERNAL int m0_rm_credit_encode ( struct m0_rm_credit credit,
struct m0_buf buf 
)

Allocates suitably sized buffer and encode it into that buffer.

Definition at line 3350 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_fini()

M0_INTERNAL void m0_rm_credit_fini ( struct m0_rm_credit credit)

Finalised generic fields in struct m0_rm_credit. Dual to m0_rm_credit_init().

Definition at line 985 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_get()

M0_INTERNAL void m0_rm_credit_get ( struct m0_rm_incoming in)

External resource manager entry point: request a credit from the resource owner.

Starts a state machine for a resource usage credit request. Adds pins for this request. Asynchronous operation - the credit will not generally be held at exit.

Precondition
IS_IN_ARRAY(in->rin_priority, owner->ro_incoming)
in->rin_state == RI_INITIALISED
m0_tlist_is_empty(&in->rin_want.cr_linkage)

Definition at line 1758 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_init()

M0_INTERNAL void m0_rm_credit_init ( struct m0_rm_credit credit,
struct m0_rm_owner owner 
)

Initialises generic fields in struct m0_rm_credit.

This is called by generic RM code to initialise an empty credit of any resource type and by resource type specific code to initialise generic fields of a struct m0_rm_credit.

This function calls m0_rm_resource_ops::rop_credit_init().

Definition at line 964 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_credit_put()

M0_INTERNAL void m0_rm_credit_put ( struct m0_rm_incoming in)

Releases the credit pinned by struct m0_rm_incoming.

Precondition
in->rin_state == RI_SUCCESS
Postcondition
m0_tlist_empty(&in->rin_pins)

Definition at line 1797 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_db_service_query()

M0_INTERNAL int m0_rm_db_service_query ( const char *  name,
struct m0_rm_remote rem 
)

Definition at line 3400 of file rm.c.

Here is the caller graph for this function:

◆ m0_rm_domain_fini()

M0_INTERNAL void m0_rm_domain_fini ( struct m0_rm_domain dom)

Definition at line 227 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_domain_init()

M0_INTERNAL void m0_rm_domain_init ( struct m0_rm_domain dom)

Definition at line 215 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_incoming_fini()

M0_INTERNAL void m0_rm_incoming_fini ( struct m0_rm_incoming in)

Finalises the fields of

Parameters
in
See also
Dual to m0_rm_incoming_init().

Definition at line 1099 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_incoming_init()

M0_INTERNAL void m0_rm_incoming_init ( struct m0_rm_incoming in,
struct m0_rm_owner owner,
enum m0_rm_incoming_type  type,
enum m0_rm_incoming_policy  policy,
uint64_t  flags 
)

Initialises the fields of incoming structure. This creates an incoming request with an empty m0_rm_incoming::rin_want credit.

Parameters
in- incoming credit request structure
owner- for which incoming request is intended.
type- incoming request type
policy- applicable policy
flags- type of request (borrow, revoke, local)
See also
m0_rm_incoming_fini

Definition at line 1060 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_loan_alloc()

M0_INTERNAL int m0_rm_loan_alloc ( struct m0_rm_loan **  loan,
const struct m0_rm_credit credit,
struct m0_rm_remote creditor 
)

Allocates and initialises the loan

Parameters
loan- On success, this will contain an allocated and initialised loan strucutre
credit- the credits for which loan is being allocated/created.

Definition at line 1183 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_loan_fini()

M0_INTERNAL void m0_rm_loan_fini ( struct m0_rm_loan loan)

Finalise the lona. Release ref count of remote owner.

Definition at line 1257 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_loan_init()

M0_INTERNAL int m0_rm_loan_init ( struct m0_rm_loan loan,
const struct m0_rm_credit credit,
struct m0_rm_remote creditor 
)

Initialises the loan

Definition at line 1235 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_loan_settle()

M0_INTERNAL int m0_rm_loan_settle ( struct m0_rm_owner owner,
struct m0_rm_loan loan 
)

Pays back the loan. Removes the sublet loan and refreshes the credit cache.

Definition at line 2818 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_net_locate()

M0_INTERNAL int m0_rm_net_locate ( struct m0_rm_credit credit,
struct m0_rm_remote other 
)

Constructs a remote owner associated with "credit".

After this function returns, "other" is in the process of locating the remote service and remote owner, as described in the comment on m0_rm_remote.

Definition at line 3487 of file rm.c.

Here is the call graph for this function:

◆ m0_rm_outgoing_complete()

M0_INTERNAL void m0_rm_outgoing_complete ( struct m0_rm_outgoing og)

Called when an outgoing request completes (possibly with an error, like a timeout).

Definition at line 2465 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_outgoing_fini()

M0_INTERNAL void m0_rm_outgoing_fini ( struct m0_rm_outgoing out)

Finalises the fields of

Parameters
out
See also
m0_rm_outgoing_init

Definition at line 1166 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_outgoing_init()

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 
)

Initialises the fields of for incoming structure. This creates an incoming request with an empty m0_rm_incoming::rin_want credit.

Parameters
out- outgoing (remote) credit request structure
req_type- outgoing request type
See also
m0_rm_outgoing_fini

Definition at line 1150 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_outgoing_send()

M0_INTERNAL void m0_rm_outgoing_send ( struct m0_rm_outgoing outgoing)

Definition at line 273 of file rm_fops.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_creditor_reset()

M0_INTERNAL void m0_rm_owner_creditor_reset ( struct m0_rm_owner owner,
struct m0_rm_remote creditor 
)

Set new creditor for the owner. User is not allowed to change the creditor at the arbitrary point in time. It's possible in two cases:

  • Creditor is not set (owner->ro_creditor == NULL);
  • Previous creditor is considered dead by HA and owner made internal cleanup of all credits and changed its state to ROS_DEAD_CREDITOR.
Precondition
owner->ro_state == ROS_DEAD_CREDITOR || owner->ro_creditor == NULL

Definition at line 904 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_fini()

M0_INTERNAL void m0_rm_owner_fini ( struct m0_rm_owner owner)

Finalises the owner. Dual to m0_rm_owner_init().

Precondition
M0_IN(owner->ro_state, (ROS_FINAL, ROS_INSOLVENT, ROS_DEAD_CREDITOR))
m0_tlist_is_empty(owner->ro_borrowed) && m0_tlist_is_empty(owner->ro_sublet) && m0_tlist_is_empty(owner->ro_owned[*]) && m0_tlist_is_empty(owner->ro_incoming[*][*]) && m0_tlist_is_empty(owner->ro_outgoing[*]) &&
See also
m0_rm_owner_timedwait()

Definition at line 943 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_init()

M0_INTERNAL void m0_rm_owner_init ( struct m0_rm_owner owner,
struct m0_fid fid,
const struct m0_uint128 group,
struct m0_rm_resource res,
struct m0_rm_remote creditor 
)

Initialises owner fields and increments resource reference counter.

The owner's credit lists are initially empty.

Precondition
creditor->rem_state >= REM_SERVICE_LOCATED
fid != NULL && m0_fid_tget(fid) == M0_RM_OWNER_FT
Postcondition
M0_IN(owner->ro_state, (ROS_INITIALISING, ROS_ACTIVE)) && owner->ro_resource == res)

Definition at line 609 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_init_rfid()

M0_INTERNAL void m0_rm_owner_init_rfid ( struct m0_rm_owner owner,
const struct m0_uint128 group,
struct m0_rm_resource res,
struct m0_rm_remote creditor 
)

The same as m0_rm_owner_init, but owner FID is generated randomly.

See also
m0_rm_owner_init

Definition at line 649 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_loan_debit()

M0_INTERNAL int m0_rm_owner_loan_debit ( struct m0_rm_owner owner,
struct m0_rm_loan paid_loan,
struct m0_tl list 
)

Debit the paid_loan from the list. Add the remnants (if any) back to the list.

Definition at line 2690 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_lock()

M0_INTERNAL void m0_rm_owner_lock ( struct m0_rm_owner owner)

Locks state machine group of an owner

Definition at line 592 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_selfadd()

M0_INTERNAL int m0_rm_owner_selfadd ( struct m0_rm_owner owner,
struct m0_rm_credit r 
)

Loans a credit to an owner from itself.

This is used to initialise a "top-most" resource owner that has no upward creditor.

This call doesn't copy "r": user supplied credit is linked into owner lists.

See also
m0_rm_owner_init()
Precondition
owner->ro_state == ROS_INITIALISING
Postcondition
owner->ro_state == ROS_ACTIVE
m0_tlist_contains(&owner->ro_owned[OWOS_CACHED], &r->cr_linkage))

Definition at line 732 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_timedwait()

M0_INTERNAL int m0_rm_owner_timedwait ( struct m0_rm_owner owner,
uint64_t  state,
const m0_time_t  abs_timeout 
)

Wait for owner to get to a particular state. Once the winding up process on owner has started, it can take a while. The following function will typically used to check if the owner has reached ROS_FINAL state. The user can then safely call m0_rm_owner_fini(). Calling m0_rm_owner_fini() immediately after m0_rm_owner_windup() may cause unexpected behaviour.

Definition at line 892 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_trylock()

static int m0_rm_owner_trylock ( struct m0_rm_owner owner)
static

Definition at line 598 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_unlock()

M0_INTERNAL void m0_rm_owner_unlock ( struct m0_rm_owner owner)

Unlocks state machine group of an owner

Definition at line 603 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_owner_windup()

M0_INTERNAL void m0_rm_owner_windup ( struct m0_rm_owner owner)

Wind up the owner before finalising it. This function will revoke sublets and give up loans.

Precondition
M0_IN(owner->ro_state, (ROS_ACTIVE, ROS_QUIESCE))
See also
m0_rm_owner_fini

Definition at line 930 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_pin_add()

M0_INTERNAL int m0_rm_pin_add ( struct m0_rm_incoming in,
struct m0_rm_credit credit,
uint32_t  flags 
)

Sticks a tracking pin on credit. When credit is released, the all incoming requests that stuck pins into it are notified.

Definition at line 3198 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_remote_find()

M0_INTERNAL struct m0_rm_remote* m0_rm_remote_find ( struct m0_rm_remote_incoming rem_in)

m0_rm_remote_find() takes the reference on rm_remote, make sure to put it afterwards to avoid the leakage.

Definition at line 1366 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_remote_fini()

M0_INTERNAL void m0_rm_remote_fini ( struct m0_rm_remote rem)

Finalises the fields of remote owner.

Parameters
rem
See also
m0_rm_remote_init
Precondition
rem->rem_state == REM_INITIALISED || rem->rem_state == REM_SERVICE_LOCATED || rem->rem_state == REM_OWNER_LOCATED

Definition at line 1431 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_remote_init()

M0_INTERNAL void m0_rm_remote_init ( struct m0_rm_remote rem,
struct m0_rm_resource res 
)

Initialises the fields of remote owner.

Parameters
rem
res- Resource for which proxy is obtained.
See also
m0_rm_remote_fini

Definition at line 1411 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_remote_resource_locate()

M0_INTERNAL int m0_rm_remote_resource_locate ( struct m0_rm_remote rem)

Definition at line 3409 of file rm.c.

Here is the caller graph for this function:

◆ m0_rm_request_out()

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 remote 
)

Constructs and sends out an outgoing request.

Allocates m0_rm_outgoing, adds a pin from "in" to the outgoing request. Constructs and sends an outgoing request fop. Arranges m0_rm_outgoing_complete() to be called on fop reply or timeout.

Definition at line 354 of file rm_fops.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_resource_add()

M0_INTERNAL void m0_rm_resource_add ( struct m0_rm_resource_type rtype,
struct m0_rm_resource res 
)

Adds a resource to the list of resources and increments resource type reference count.

Precondition
m0_tlist_is_empty(res->r_linkage) && res->r_ref == 0
rtype->rt_resources does not contain a resource equal (in the m0_rm_resource_type_ops::rto_eq() sense) to res
Postcondition
res->r_ref > 0
res->r_type == rtype
m0_tlist_contains(&rtype->rt_resources, &res->r_linkage)

Definition at line 337 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_resource_del()

M0_INTERNAL void m0_rm_resource_del ( struct m0_rm_resource res)

Removes a resource from the list of resources. Dual to m0_rm_resource_add().

Precondition
res->r_type->rt_nr_resources > 0
m0_tlist_contains(&rtype->rt_resources, &res->r_linkage)
Postcondition
!m0_tlist_contains(&rtype->rt_resources, &res->r_linkage)

Definition at line 361 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_resource_encode()

M0_INTERNAL int m0_rm_resource_encode ( struct m0_rm_resource res,
struct m0_buf buf 
)

Encode resource onto a buffer.

Precondition
res->r_type != 0
res->r_type->rt_ops != NULL

Definition at line 393 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_resource_find()

M0_INTERNAL struct m0_rm_resource * m0_rm_resource_find ( const struct m0_rm_resource_type rt,
const struct m0_rm_resource res 
)

Returns a resource equal to a given one from a resource type's resource list or NULL if none.

Definition at line 243 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_resource_free()

M0_INTERNAL void m0_rm_resource_free ( struct m0_rm_resource res)

Frees the resource. A motr resource may be embedded in some structure. This function calls resource operation, rop_resource_free.

Precondition
res->r_ops->rop_resource_free != NULL

Definition at line 386 of file rm.c.

Here is the caller graph for this function:

◆ m0_rm_resource_initial_credit()

M0_INTERNAL void m0_rm_resource_initial_credit ( const struct m0_rm_resource resource,
struct m0_rm_credit credit 
)

Assign initial value to credit

◆ m0_rm_resource_owner_find()

int m0_rm_resource_owner_find ( const struct m0_rm_resource resource,
struct m0_rm_owner **  owner 
)

Returns the owner locally managing the credits for a given resource.

This is used on the creditor side to identify an owner against which an incoming BORROW request is to be processed.

◆ m0_rm_resource_type_lookup()

M0_INTERNAL struct m0_rm_resource_type * m0_rm_resource_type_lookup ( const struct m0_rm_domain dom,
const uint64_t  rtype_id 
)

Lookup registered resource type from given domain.

Definition at line 327 of file rm.c.

Here is the caller graph for this function:

◆ m0_rm_reverse_session_get()

M0_INTERNAL int m0_rm_reverse_session_get ( struct m0_rm_remote_incoming rem_in,
struct m0_rm_remote remote 
)

Establish a reverse session to facilitate sending revoke requests

Definition at line 355 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_revoke_commit()

M0_INTERNAL int m0_rm_revoke_commit ( struct m0_rm_remote_incoming rvk)

Removes revoked credits from "owned" and borrowed lists.

Called by revoke fom code to complete processing of revoke.

Precondition
m0_mutex_is_locked(&owner->ro_lock)
in->rin_state == RI_SUCCESS
in->rin_type == RIT_REVOKE

Definition at line 1615 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_revoke_done()

int m0_rm_revoke_done ( struct m0_rm_outgoing out)

Moves revoked credit from "sublet" to "owned" list.

This is called on receiving a reply to an outgoing REVOKE fop.

◆ m0_rm_type_deregister()

M0_INTERNAL void m0_rm_type_deregister ( struct m0_rm_resource_type rtype)

Deregisters a resource type.

Precondition
IS_IN_ARRAY(rtype->rt_id, dom->rd_types) && rtype->rt_dom != NULL
Postcondition
rtype->rt_dom == NULL

Definition at line 288 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_rm_type_register()

M0_INTERNAL int m0_rm_type_register ( struct m0_rm_domain dom,
struct m0_rm_resource_type rt 
)

Registers a resource type with a domain.

Precondition
rtype->rt_dom == NULL
Postcondition
IS_IN_ARRAY(rtype->rt_id, dom->rd_types) && rtype->rt_dom == dom

Definition at line 252 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_TL_DEFINE() [1/6]

M0_TL_DEFINE ( res  ,
M0_INTERNAL  ,
struct m0_rm_resource   
)

◆ M0_TL_DEFINE() [2/6]

M0_TL_DEFINE ( m0_rm_ur  ,
M0_INTERNAL  ,
struct m0_rm_credit   
)

◆ M0_TL_DEFINE() [3/6]

M0_TL_DEFINE ( m0_remotes  ,
M0_INTERNAL  ,
struct m0_rm_remote   
)

◆ M0_TL_DEFINE() [4/6]

M0_TL_DEFINE ( m0_owners  ,
M0_INTERNAL  ,
struct m0_rm_owner   
)

◆ M0_TL_DEFINE() [5/6]

M0_TL_DEFINE ( pr  ,
M0_INTERNAL  ,
struct m0_rm_pin   
)

◆ M0_TL_DEFINE() [6/6]

M0_TL_DEFINE ( pi  ,
M0_INTERNAL  ,
struct m0_rm_pin   
)

◆ M0_TL_DESCR_DEFINE() [1/6]

M0_TL_DESCR_DEFINE ( res  ,
"resources"  ,
struct m0_rm_resource  ,
r_linkage  ,
r_magix  ,
M0_RM_RESOURCE_MAGIC  ,
M0_RM_RESOURCE_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [2/6]

M0_TL_DESCR_DEFINE ( m0_rm_ur  ,
"usage credits"  ,
struct m0_rm_credit  ,
cr_linkage  ,
cr_magix  ,
M0_RM_CREDIT_MAGIC  ,
M0_RM_USAGE_CREDIT_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [3/6]

M0_TL_DESCR_DEFINE ( m0_remotes  ,
"remote owners"  ,
struct m0_rm_remote  ,
rem_res_linkage  ,
rem_magix  ,
M0_RM_REMOTE_MAGIC  ,
M0_RM_REMOTE_OWNER_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [4/6]

M0_TL_DESCR_DEFINE ( m0_owners  ,
"local owners"  ,
struct m0_rm_owner  ,
ro_owner_linkage  ,
ro_magix  ,
M0_RM_OWNER_LIST_MAGIC  ,
M0_RM_OWNER_LIST_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [5/6]

M0_TL_DESCR_DEFINE ( pr  ,
"pins-of-credit"  ,
struct m0_rm_pin  ,
rp_credit_linkage  ,
rp_magix  ,
M0_RM_PIN_MAGIC  ,
M0_RM_CREDIT_PIN_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [6/6]

M0_TL_DESCR_DEFINE ( pi  ,
"pins-of-incoming"  ,
struct m0_rm_pin  ,
rp_incoming_linkage  ,
rp_magix  ,
M0_RM_PIN_MAGIC  ,
M0_RM_INCOMING_PIN_HEAD_MAGIC   
)

◆ outgoing_check()

static int outgoing_check ( struct m0_rm_incoming in,
enum m0_rm_outgoing_type  otype,
struct m0_rm_credit credit,
struct m0_rm_remote other 
)
static

Check if the outgoing request for requested credit is already pending. If yes, attach a tracking pin.

Todo:
adjust outgoing requests priority (priority inheritance)

Definition at line 2544 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_balance()

static void owner_balance ( struct m0_rm_owner o)
static

Main owner state machine function.

Goes through the lists of excited incoming and outgoing requests until all the excitement is gone.

Definition at line 1938 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_cleanup()

static void owner_cleanup ( struct m0_rm_owner owner)
static

Definition at line 868 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_fail()

static void owner_fail ( struct m0_rm_owner owner,
enum m0_rm_owner_state  state,
int  rc 
)
inlinestatic

Definition at line 517 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_finalisation_check()

static void owner_finalisation_check ( struct m0_rm_owner owner)
static

Definition at line 533 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_has_loans()

static bool owner_has_loans ( struct m0_rm_owner owner)
static

Definition at line 527 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_invariant()

static bool owner_invariant ( struct m0_rm_owner owner)
static

Checks internal consistency of a resource owner.

Definition at line 3052 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_invariant_state()

static bool owner_invariant_state ( const struct m0_rm_owner owner,
struct owner_invariant_state is 
)
static

Checks internal consistency of a resource owner.

Definition at line 2984 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_is_idle()

static bool owner_is_idle ( const struct m0_rm_owner o)
static

Definition at line 776 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_is_liquidated()

static bool owner_is_liquidated ( const struct m0_rm_owner o)
static

Definition at line 790 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_liquidate()

static void owner_liquidate ( struct m0_rm_owner src_owner)
static

Definition at line 804 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_smgrp_is_locked()

static bool owner_smgrp_is_locked ( const struct m0_rm_owner owner)
static

Definition at line 583 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_state_set()

static void owner_state_set ( struct m0_rm_owner owner,
enum m0_rm_owner_state  state 
)
inlinestatic

Definition at line 508 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ owner_windup_locked()

static void owner_windup_locked ( struct m0_rm_owner owner)
static

Definition at line 919 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pending_outgoing_send()

static void pending_outgoing_send ( struct m0_rm_owner owner,
struct m0_clink link 
)
static

Definition at line 1273 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pin_check()

static bool pin_check ( const void *  bob)
static

Definition at line 2888 of file rm.c.

◆ pin_del()

static void pin_del ( struct m0_rm_pin pin)
static

Removes a pin on a resource usage credit.

If this was a last tracking pin issued by the request—excite the latter. The function returns true if it excited an incoming request.

Definition at line 3165 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rem_incoming_to_resource_type()

static M0_UNUSED struct m0_rm_resource_type* rem_incoming_to_resource_type ( struct m0_rm_remote_incoming rem_in)
inlinestatic

Definition at line 1560 of file rm.c.

Here is the call graph for this function:

◆ remnant_credit_get()

static int remnant_credit_get ( const struct m0_rm_credit src,
const struct m0_rm_credit diff,
struct m0_rm_credit **  remnant_credit 
)
static

Definition at line 3281 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remnant_loan_get()

static int remnant_loan_get ( const struct m0_rm_loan loan,
const struct m0_rm_credit credit,
struct m0_rm_loan **  remnant_loan 
)
static

Definition at line 1210 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_create()

static int remote_create ( struct m0_rm_remote **  rem,
struct m0_rm_remote_incoming rem_in 
)
static

Definition at line 484 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remote_incoming_complete()

static void remote_incoming_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 163 of file rm_foms.c.

Here is the call graph for this function:

◆ remote_incoming_conflict()

static void remote_incoming_conflict ( struct m0_rm_incoming in)
static

Definition at line 196 of file rm_foms.c.

◆ remote_to_queue()

static struct m0_queue* remote_to_queue ( struct m0_rm_remote remote)
static

Definition at line 3613 of file rm.c.

Here is the caller graph for this function:

◆ reply_err_set()

static void reply_err_set ( enum m0_rm_incoming_type  type,
struct m0_fom fom,
int  rc 
)
static

Definition at line 330 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reply_prepare()

static int reply_prepare ( const enum m0_rm_incoming_type  type,
struct m0_fom fom 
)
static

Definition at line 283 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_fom_create()

static int request_fom_create ( enum m0_rm_incoming_type  type,
struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 204 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_fom_fini()

static void request_fom_fini ( struct m0_fom fom)
static

Definition at line 258 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_fom_tick()

static int request_fom_tick ( struct m0_fom fom,
enum m0_rm_incoming_type  type 
)
static

Definition at line 657 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_post_process()

static int request_post_process ( struct m0_fom fom)
static

Definition at line 618 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ request_pre_process()

static int request_pre_process ( struct m0_fom fom,
enum m0_rm_incoming_type  type 
)
static

Definition at line 551 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reserve_prio_is_set()

static bool reserve_prio_is_set ( struct m0_rm_reserve_prio prio)
static

Definition at line 727 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reserve_prio_set()

static void reserve_prio_set ( struct m0_rm_reserve_prio prio,
m0_time_t  timestamp,
struct m0_rm_owner owner 
)
static

Definition at line 715 of file rm.c.

Here is the caller graph for this function:

◆ resource_get()

static void resource_get ( struct m0_rm_resource res)
static

Definition at line 433 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resource_list_check()

static bool resource_list_check ( const struct m0_rm_resource res,
void *  datum 
)
static

Helper function used by resource_type_invariant() to check all elements of m0_rm_resource_type::rt_resources.

Definition at line 2868 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resource_locate()

static int resource_locate ( struct m0_rm_resource_type rtype,
struct m0_rm_remote rem 
)
static

Sends a resource management fop to the service. The service responds with the remote owner identifier (m0_rm_remote::rem_id) used for further communications.

Definition at line 3456 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resource_put()

static void resource_put ( struct m0_rm_resource res)
static

Definition at line 447 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resource_type_invariant()

static bool resource_type_invariant ( const struct m0_rm_resource_type rt)
static

Definition at line 2875 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rev_session_clink_cb()

static bool rev_session_clink_cb ( struct m0_clink link)
static

rev_session_clink_cb() sends all revoke requests pending on the reverse session establishment.

Todo:
This would be fixed, when RM will be using normal locality sm groups, rather than per-resource-type groups

Definition at line 1299 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_fom_create()

static int revoke_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 824 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_fom_fini()

static void revoke_fom_fini ( struct m0_fom fom)
static

Definition at line 833 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_fom_tick()

static int revoke_fom_tick ( struct m0_fom fom)
static

This function handles the request to revoke a credit to a resource on a server ("debtor"). REVOKE is typically issued to the client. In Motr, resources are arranged in hierarchy (chain). Hence a server can receive REVOKE from another server.

Parameters
fom-> fom processing the CREDIT_REVOKE request on the server

Definition at line 754 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ revoke_send()

static int revoke_send ( struct m0_rm_incoming in,
struct m0_rm_loan loan,
struct m0_rm_credit credit 
)
static

Sends an outgoing revoke request to remote owner specified by the "loan". The request will revoke the credit "credit", which might be a part of original loan.

Definition at line 2611 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rfom_debtor_subscribe()

static int rfom_debtor_subscribe ( struct rm_request_fom rfom,
struct m0_rm_remote debtor 
)
static

Asynchronously starts subscribing debtor to HA notification. This call makes remote request FOM sm route to diverge and first locate conf object corresponding to the remote object and install clink into the object's channel, and only then continue dealing with credit processing.

Definition at line 517 of file rm_foms.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_on_remote_death_cb()

static bool rm_on_remote_death_cb ( struct m0_clink link)
static

Callback that is associated with remote RM service configuration object state change. If HA notification about service failure is accepted, then post AST to resource type sm group to process remote failure under group lock.

Note
RM service can recover from failure in the feature. HA will send notification with M0_NC_ONLINE ha state, so keep tracking RM service state.

Definition at line 3626 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_remote_death_handler()

static void rm_remote_death_handler ( struct m0_rm_remote remote)
static

Processes remote RM service failure. Corresponding remote instance of type m0_rm_remote played one of two exclusive roles for local owners: debtor or creditor. Both roles are handled in this function to make it generic.

If remote instance was created to represent debtor part in the loans, then these loans are instantly settled to cached list. If there are outgoing revoke requests in progress to this remote, then they will eventually be completed with successful return code (

See also
revoke_ast()).

If remote instance was created to represent creditor of some local owner, then further functioning of this owner is impossible, because all borrowed credits should be dropped. The potential problem is that borrowed credits could be sub-let to other owners or could be in active use ("held"). In order to gracefully drop these credits owner does "self-windup" process. Eventually this owner will transit to ROS_FINAL state.

Note
Remote structures (m0_rm_remote) are not destroyed until rm resource finalisation, because there can be outgoing requests to them in progress. Also remote can recover from failed state and become online again.
Todo:
if rc != 0, then credits remain in sub-let list and can't be revoked anymore. Also we can't return error code to user. Maybe we should notify HA about error?

Definition at line 3552 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_remote_free()

static void rm_remote_free ( struct m0_ref ref)
static

Definition at line 1384 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_remote_online_handler()

static void rm_remote_online_handler ( struct m0_rm_remote remote)
static

Processes HA notification saying remote is ONLINE. We are interested only in the case when remote recovered from a failure. If remote is a debtor, then local owner will accept requests from it again. If remote is a creditor, then local owner regain an opportunity to satisfy incoming requests.

Note
It is assumed that all RPC sessions to remote are still valid and operational.

Definition at line 3599 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ service_locate()

static int service_locate ( struct m0_rm_resource_type rtype,
struct m0_rm_remote rem 
)
static

A distributed resource location data-base is consulted to locate the service.

Definition at line 3419 of file rm.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ windup_incoming_complete()

static void windup_incoming_complete ( struct m0_rm_incoming in,
int32_t  rc 
)
static

Definition at line 1133 of file rm.c.

Here is the call graph for this function:

◆ windup_incoming_conflict()

static void windup_incoming_conflict ( struct m0_rm_incoming in)
static

Definition at line 1128 of file rm.c.

Variable Documentation

◆ borrow_sm_conf

const struct m0_sm_conf borrow_sm_conf
Initial value:
= {
.scf_name = "Borrow fom",
.scf_nr_states = ARRAY_SIZE(rm_req_phases),
.scf_state = rm_req_phases
}
struct m0_sm_state_descr rm_req_phases[]
Definition: rm_foms.c:124
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 151 of file rm_foms.c.

◆ canoke_sm_conf

const struct m0_sm_conf canoke_sm_conf
Initial value:
= {
.scf_name = "Canoke fom",
.scf_nr_states = ARRAY_SIZE(rm_req_phases),
.scf_state = rm_req_phases
}
struct m0_sm_state_descr rm_req_phases[]
Definition: rm_foms.c:124
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 157 of file rm_foms.c.

◆ credit_bob

const struct m0_bob_type credit_bob
static
Initial value:
= {
.bt_name = "credit",
.bt_magix_offset = offsetof(struct m0_rm_credit, cr_magix),
.bt_magix = M0_RM_CREDIT_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 151 of file rm.c.

◆ inc_conf

const struct m0_sm_conf inc_conf
static
Initial value:
= {
.scf_name = "Incoming Request",
.scf_nr_states = ARRAY_SIZE(inc_states),
.scf_state = inc_states
}
static struct m0_sm_state_descr inc_states[]
Definition: rm.c:998
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 1031 of file rm.c.

◆ inc_states

struct m0_sm_state_descr inc_states[]
static

Definition at line 998 of file rm.c.

◆ incoming_bob

const struct m0_bob_type incoming_bob
static
Initial value:
= {
.bt_name = "incoming request",
.bt_magix_offset = offsetof(struct m0_rm_incoming, rin_magix),
.bt_magix = M0_RM_INCOMING_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 187 of file rm.c.

◆ loan_bob

M0_INTERNAL const struct m0_bob_type loan_bob
Initial value:
= {
.bt_name = "loan",
.bt_magix_offset = offsetof(struct m0_rm_loan, rl_magix),
.bt_magix = M0_RM_LOAN_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 179 of file rm.c.

◆ m0_rm_no_group [1/2]

const struct m0_uint128 m0_rm_no_group = M0_UINT128(0, 0)

Definition at line 211 of file rm.c.

◆ m0_rm_no_group [2/2]

const struct m0_uint128 m0_rm_no_group

Definition at line 211 of file rm.c.

◆ outgoing_bob

const struct m0_bob_type outgoing_bob
static
Initial value:
= {
.bt_name = "outgoing request ",
.bt_magix_offset = offsetof(struct m0_rm_outgoing, rog_magix),
.bt_magix = M0_RM_OUTGOING_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 195 of file rm.c.

◆ owner_conf

const struct m0_sm_conf owner_conf
static
Initial value:
= {
.scf_name = "Resource Owner",
.scf_nr_states = ARRAY_SIZE(owner_states),
.scf_state = owner_states
}
static struct m0_sm_state_descr owner_states[]
Definition: rm.c:461
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 499 of file rm.c.

◆ owner_states

struct m0_sm_state_descr owner_states[]
static

Definition at line 461 of file rm.c.

◆ pin_bob

const struct m0_bob_type pin_bob
static
Initial value:
= {
.bt_name = "pin",
.bt_magix_offset = offsetof(struct m0_rm_pin, rp_magix),
.bt_magix = M0_RM_PIN_MAGIC,
.bt_check = pin_check
}
static bool pin_check(const void *bob)
Definition: rm.c:2888
Definition: rm.h:1675
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 171 of file rm.c.

◆ rem_bob

const struct m0_bob_type rem_bob
static
Initial value:
= {
.bt_name = "proxy for remote owner ",
.bt_magix_offset = offsetof(struct m0_rm_remote, rem_magix),
.bt_magix = M0_RM_REMOTE_MAGIC,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 203 of file rm.c.

◆ remote_incoming_ops

struct m0_rm_incoming_ops remote_incoming_ops
static
Initial value:
= {
.rio_complete = remote_incoming_complete,
.rio_conflict = remote_incoming_conflict,
}
static void remote_incoming_conflict(struct m0_rm_incoming *in)
Definition: rm_foms.c:196
static void remote_incoming_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rm_foms.c:163

Definition at line 80 of file rm_foms.c.

◆ resource_bob

struct m0_bob_type resource_bob
static

Definition at line 133 of file rm.c.

◆ rm_borrow_fom_type_ops

const struct m0_fom_type_ops rm_borrow_fom_type_ops
Initial value:
= {
.fto_create = borrow_fom_create,
}
static int borrow_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: rm_foms.c:807

Definition at line 94 of file rm_foms.c.

◆ rm_cancel_fom_type_ops

const struct m0_fom_type_ops rm_cancel_fom_type_ops
Initial value:
= {
.fto_create = cancel_fom_create,
}
static int cancel_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: rm_foms.c:841

Definition at line 120 of file rm_foms.c.

◆ rm_fom_borrow_ops

struct m0_fom_ops rm_fom_borrow_ops
static
Initial value:
= {
.fo_fini = borrow_fom_fini,
.fo_tick = borrow_fom_tick,
.fo_home_locality = locality,
}
static size_t locality(const struct m0_fom *fom)
Definition: rm_foms.c:269
static void borrow_fom_fini(struct m0_fom *fom)
Definition: rm_foms.c:816
static int borrow_fom_tick(struct m0_fom *)
Definition: rm_foms.c:730

Definition at line 88 of file rm_foms.c.

◆ rm_fom_cancel_ops

struct m0_fom_ops rm_fom_cancel_ops
static
Initial value:
= {
.fo_fini = cancel_fom_fini,
.fo_tick = cancel_fom_tick,
.fo_home_locality = locality,
}
static size_t locality(const struct m0_fom *fom)
Definition: rm_foms.c:269
static int cancel_fom_tick(struct m0_fom *)
Definition: rm_foms.c:799
static void cancel_fom_fini(struct m0_fom *fom)
Definition: rm_foms.c:850

Definition at line 114 of file rm_foms.c.

◆ rm_fom_revoke_ops

struct m0_fom_ops rm_fom_revoke_ops
static
Initial value:
= {
.fo_fini = revoke_fom_fini,
.fo_tick = revoke_fom_tick,
.fo_home_locality = locality,
}
static int revoke_fom_tick(struct m0_fom *)
Definition: rm_foms.c:754
static size_t locality(const struct m0_fom *fom)
Definition: rm_foms.c:269
static void revoke_fom_fini(struct m0_fom *fom)
Definition: rm_foms.c:833

Definition at line 101 of file rm_foms.c.

◆ rm_req_phases

struct m0_sm_state_descr rm_req_phases[]
Initial value:
= {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "RM_Request_Begin",
},
.sd_name = "RM_Credit_Get",
.sd_allowed = M0_BITS(FOPH_RM_REQ_WAIT)
},
.sd_name = "RM_Request_Wait",
.sd_allowed = M0_BITS(FOPH_RM_REQ_FINISH)
},
.sd_flags = M0_SDF_FINAL,
.sd_name = "RM_Request_Completion",
.sd_allowed = 0
},
.sd_name = "Debtor_Subscribe",
},
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 124 of file rm_foms.c.

◆ rm_revoke_fom_type_ops

const struct m0_fom_type_ops rm_revoke_fom_type_ops
Initial value:
= {
.fto_create = revoke_fom_create,
}
static int revoke_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: rm_foms.c:824

Definition at line 107 of file rm_foms.c.

◆ windup_incoming_ops

const struct m0_rm_incoming_ops windup_incoming_ops
static
Initial value:
= {
.rio_complete = windup_incoming_complete,
.rio_conflict = windup_incoming_conflict,
}
static void windup_incoming_complete(struct m0_rm_incoming *in, int32_t rc)
Definition: rm.c:1133
static void windup_incoming_conflict(struct m0_rm_incoming *in)
Definition: rm.c:1128

Definition at line 237 of file rm.c.