Motr
M0
|
#include <rm.h>
Data Fields | |
struct m0_rm_owner * | cr_owner |
const struct m0_rm_credit_ops * | cr_ops |
struct m0_uint128 | cr_group_id |
m0_time_t | cr_get_time |
uint64_t | cr_datum |
struct m0_tlink | cr_linkage |
struct m0_tl | cr_pins |
uint64_t | cr_magix |
A resource owner uses the resource via a usage credit (also called resource credit or simply credit as context permits). E.g., a client might have a credit of read-only, write-only, or read-write access to a certain extent in a file. An owner is granted a credit to use a resource.
The meaning of a resource credit is determined by the resource type. m0_rm_credit is allocated and managed by the generic code, but it has a scratchpad field (m0_rm_credit::cr_datum), where type specific code stores some additional information.
A credit can be something simple as a single bit (conveying, for example, an exclusive ownership of some datum) or a collection of extents tagged with access masks.
A credit is said to be "pinned" or "held" when it is necessary for some ongoing operation. A pinned credit has M0_RPF_PROTECT pins (m0_rm_pin) on its m0_rm_credit::cr_pins list. Otherwise a credit is simply "cached".
Credits are typically linked into one of m0_rm_owner lists. Pinned credits can only happen on m0_rm_owner::ro_owned[OWOS_HELD] list. They cannot be moved out of this list until unpinned.
uint64_t cr_datum |
m0_time_t cr_get_time |
struct m0_uint128 cr_group_id |
struct m0_tlink cr_linkage |
Linkage of a credit (and the corresponding loan, if applicable) to a list hanging off m0_rm_owner.
const struct m0_rm_credit_ops* cr_ops |
struct m0_rm_owner* cr_owner |
struct m0_tl cr_pins |
A list of pins, linked through m0_rm_pin::rp_credit, stuck into this credit.