Motr  M0
m0_rm_owner Struct Reference

#include <rm.h>

Collaboration diagram for m0_rm_owner:
Collaboration graph

Data Fields

struct m0_sm ro_sm
 
struct m0_fid ro_fid
 
struct m0_rm_resourcero_resource
 
struct m0_uint128 ro_group_id
 
struct m0_rm_remotero_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
 

Detailed Description

Resource ownership is used for two purposes:

  • concurrency control. Only resource owner can manipulate the resource and ownership transfer protocol assures that owners do not step on each other. That is, resources provide traditional distributed locking mechanism;
  • replication control. Resource owner can create a (local) copy of a resource. The ownership transfer protocol with the help of version numbers guarantees that multiple replicas are re-integrated correctly. That is, resources provide a cache coherency mechanism. Global cluster-wide cache management policy can be implemented on top of resources.

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:

  • "time" here means the logical time in an observable history of the file system. It might so happen, that at a certain moment in physical time, data-structures (on different nodes, typically) would look as if conflicting credits were granted, but this is only possible when such credits will never affect visible system behaviour (e.g., a consensual decision has been made by that time to evict one of the nodes);
  • in a case of optimistic conflict resolution, "no conflicting credits" means "no credits on which conflicts cannot be resolved afterwards by the optimistic conflict resolution policy".

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
*
* 
Invariant
under ->ro_lock { // keep books balanced at all times join of credits on ->ro_owned[] and credits on ->ro_sublet equals to join of credits on ->ro_borrowed &&

meet of (join of credits on ->ro_owned[]) and (join of credits on ->ro_sublet) is empty. }

Invariant
under ->ro_lock { ->ro_owned[OWOS_HELD] is exactly the list of all held credits (ones with elevated user count)

invariant is checked by rm/rm.c:owner_invariant().

}

Definition at line 1004 of file rm.h.

Field Documentation

◆ ro_borrowed

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.

See also
m0_rm_loan

Definition at line 1033 of file rm.h.

◆ ro_creditor

struct m0_rm_remote* ro_creditor

An upward creditor, from where this owner borrows credits.

Definition at line 1026 of file rm.h.

◆ ro_fid

struct m0_fid ro_fid

Owner non-zero FID unique through the cluster. Provided by user or generated randomly. Used to avoid dead-locks for requests with RIF_RESERVE flag.

Definition at line 1011 of file rm.h.

◆ ro_group_id

struct m0_uint128 ro_group_id

A group this owner is part of.

If this is m0_rm_no_group (0), the owner is not a member of any group (a "standalone" owner).

Definition at line 1022 of file rm.h.

◆ ro_id

uint64_t ro_id

Generation count associated with an owner cookie.

Definition at line 1066 of file rm.h.

◆ ro_incoming

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.

See also
m0_rm_incoming

Definition at line 1054 of file rm.h.

◆ ro_magix

uint64_t ro_magix

Definition at line 1078 of file rm.h.

◆ ro_outgoing

struct m0_tl ro_outgoing[OQS_NR]

An array of lists, of outgoing, not yet completed, requests.

Definition at line 1058 of file rm.h.

◆ ro_owned

struct m0_tl ro_owned[OWOS_NR]

A list of credits, linked through m0_rm_credit::cr_linkage possessed by the owner.

Definition at line 1047 of file rm.h.

◆ ro_owner_linkage

struct m0_tlink ro_owner_linkage

Linkage of an owner to a list m0_rm_resource::r_local.

Definition at line 1062 of file rm.h.

◆ ro_resource

struct m0_rm_resource* ro_resource

Resource this owner possesses the credits on.

Definition at line 1015 of file rm.h.

◆ ro_seq

uint64_t ro_seq

Sequence number of the next local incoming request. Automatically increments inside incoming_queue() for local requests.

Definition at line 1077 of file rm.h.

◆ ro_sm

struct m0_sm ro_sm

Definition at line 1005 of file rm.h.

◆ ro_sublet

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.

See also
m0_rm_loan

Definition at line 1042 of file rm.h.

◆ ro_user_windup

bool ro_user_windup

True if user requested owner to windup. It is used to distinguish the reason of windup: self windup on creditor death or by request.

Definition at line 1071 of file rm.h.


The documentation for this struct was generated from the following file: