Motr
M0
|
#include <rm.h>
Data Fields | |
struct m0_sm | ro_sm |
struct m0_fid | ro_fid |
struct m0_rm_resource * | ro_resource |
struct m0_uint128 | ro_group_id |
struct m0_rm_remote * | ro_creditor |
struct m0_tl | ro_borrowed |
struct m0_tl | ro_sublet |
struct m0_tl | ro_owned [OWOS_NR] |
struct m0_tl | ro_incoming [M0_RM_REQUEST_PRIORITY_NR][OQS_NR] |
struct m0_tl | ro_outgoing [OQS_NR] |
struct m0_tlink | ro_owner_linkage |
uint64_t | ro_id |
bool | ro_user_windup |
uint64_t | ro_seq |
uint64_t | ro_magix |
Resource ownership is used for two purposes:
A resource owner possesses credits on a particular resource. Multiple owners within the same domain can possess credits on the same resource, but no two owners in the cluster can possess conflicting credits at the same time. The last statement requires some qualification:
m0_rm_owner is a generic structure, created and maintained by the generic resource manager code.
Off a m0_rm_owner, hang several lists and arrays of lists for credits book-keeping: m0_rm_owner::ro_borrowed, m0_rm_owner::ro_sublet and m0_rm_owner::ro_owned[], further subdivided by states.
As credits form a lattice (see m0_rm_credit_ops), it is always possible to represent the cumulative sum of all credits on a list as a single m0_rm_credit. The reason the lists are needed is that credits in the lists have some additional state associated with them (e.g., loans for m0_rm_owner::ro_borrowed, m0_rm_owner::ro_sublet or pins (m0_rm_credit::cr_pins) for m0_rm_owner::ro_owned[]) that can be manipulated independently.
Owner state diagram:
* * INITIAL * | * V * INITIALISING-------+ * | | * V | * ACTIVE | * | | * V | * QUIESCE | * | | * V V * INSOLVENT<----FINALISING---->FINAL * *
meet of (join of credits on ->ro_owned[]) and (join of credits on ->ro_sublet) is empty. }
invariant is checked by rm/rm.c:owner_invariant().
}
struct m0_tl ro_borrowed |
A list of loans, linked through m0_rm_loan::rl_credit:cr_linkage that this owner borrowed from other owners.
struct m0_rm_remote* ro_creditor |
struct m0_fid ro_fid |
struct m0_uint128 ro_group_id |
uint64_t ro_id |
struct m0_tl ro_incoming[M0_RM_REQUEST_PRIORITY_NR][OQS_NR] |
An array of lists, sorted by priority, of incoming requests. Requests are linked through m0_rm_incoming::rin_want::cr_linkage.
A list of credits, linked through m0_rm_credit::cr_linkage possessed by the owner.
struct m0_tlink ro_owner_linkage |
Linkage of an owner to a list m0_rm_resource::r_local.
struct m0_rm_resource* ro_resource |
uint64_t ro_seq |
Sequence number of the next local incoming request. Automatically increments inside incoming_queue() for local requests.
struct m0_tl ro_sublet |
A list of loans, linked through m0_rm_loan::rl_credit:cr_linkage that this owner extended to other owners. Credits on this list are not longer possessed by this owner: they are counted in m0_rm_owner::ro_borrowed, but not in m0_rm_owner::ro_owned.
bool ro_user_windup |