|
static bool | rwlockable_equal (const struct m0_rm_resource *resource0, const struct m0_rm_resource *resource1) |
|
static m0_bcount_t | rwlockable_len (const struct m0_rm_resource *resource) |
|
static int | rwlockable_encode (struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource) |
|
static int | rwlockable_decode (struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource) |
|
static void | rwlockable_credit_init (struct m0_rm_resource *resource, struct m0_rm_credit *credit) |
|
static void | rwlockable_resource_free (struct m0_rm_resource *resource) |
|
static bool | rwlock_cr_intersects (const struct m0_rm_credit *self, const struct m0_rm_credit *c1) |
|
static m0_bcount_t | rwlock_cr_len (const struct m0_rm_credit *c0) |
|
static int | rwlock_cr_join (struct m0_rm_credit *self, const struct m0_rm_credit *c1) |
|
static int | rwlock_cr_disjoin (struct m0_rm_credit *self, const struct m0_rm_credit *c1, struct m0_rm_credit *intersection) |
|
static int | rwlock_cr_copy (struct m0_rm_credit *dest, const struct m0_rm_credit *self) |
|
static int | rwlock_cr_diff (struct m0_rm_credit *self, const struct m0_rm_credit *c1) |
|
static bool | rwlock_cr_conflicts (const struct m0_rm_credit *self, const struct m0_rm_credit *c1) |
|
static bool | rwlock_cr_is_subset (const struct m0_rm_credit *self, const struct m0_rm_credit *c1) |
|
static int | rwlock_cr_encode (struct m0_rm_credit *self, struct m0_bufvec_cursor *cur) |
|
static int | rwlock_cr_decode (struct m0_rm_credit *self, struct m0_bufvec_cursor *cur) |
|
static void | rwlock_cr_free (struct m0_rm_credit *self) |
|
static void | rwlock_cr_initial_capital (struct m0_rm_credit *self) |
|
M0_INTERNAL int | m0_rwlockable_domain_type_init (struct m0_rm_domain *rwl_dom, struct m0_rm_resource_type *rwl_rt) |
|
M0_INTERNAL void | m0_rwlockable_domain_type_fini (struct m0_rm_domain *rwl_dom, struct m0_rm_resource_type *rwl_rt) |
|
static bool | rwlock_credit_invariant (const struct m0_rm_credit *rwlock_cr) |
|
This section contains the functions that are internal to the distributed RW lock. They implement various resource manager ops.
Credit structure
Credit for RW lock is represented by number of read locks permitted. Reader requires 1 such read lock, writer (exclusive access) requires all such read locks existing in the cluster.
Initial capacity of the credit owned by top-level creditor for RW lock resource type is ~0 read locks. It is assumed that number of read locks will be enough for any possible number of readers in the cluster.
If reader acquires RW lock then it requests credit for 0x01 read lock. Since number of read locks in the system is virtually infinite, all readers can hold RW lock simultaneously. If writer acquires RW lock then it requests credit for all (~0) read locks. So writer will exclusively own all the credits for RW lock and requests for this lock from other readers/writers won't be satisfied.
- See also
- Overview and Logical Specification
◆ CR_XO
◆ R_RW
◆ RW_XO
#define RW_XO |
( |
|
rw | ) |
(&M0_XCODE_OBJ(m0_fid_xc, (void *)(rw)->rwl_fid)) |
◆ m0_rwlockable_domain_type_fini()
RW lockable domain and type finaliser.
Definition at line 267 of file rm_rwlock.c.
◆ m0_rwlockable_domain_type_init()
RW lockable domain and type initialiser.
Definition at line 256 of file rm_rwlock.c.
◆ rwlock_cr_conflicts()
◆ rwlock_cr_copy()
◆ rwlock_cr_decode()
◆ rwlock_cr_diff()
◆ rwlock_cr_disjoin()
◆ rwlock_cr_encode()
◆ rwlock_cr_free()
◆ rwlock_cr_initial_capital()
static void rwlock_cr_initial_capital |
( |
struct m0_rm_credit * |
self | ) |
|
|
static |
◆ rwlock_cr_intersects()
◆ rwlock_cr_is_subset()
◆ rwlock_cr_join()
◆ rwlock_cr_len()
◆ rwlock_credit_invariant()
static bool rwlock_credit_invariant |
( |
const struct m0_rm_credit * |
rwlock_cr | ) |
|
|
static |
◆ rwlockable_credit_init()
◆ rwlockable_decode()
◆ rwlockable_encode()
Encode lockable resource. Actually sending only RW lock FID is sufficient to reconstruct it on remote side
Definition at line 316 of file rm_rwlock.c.
◆ rwlockable_equal()
Compare identifiers of two lockable resources
Definition at line 275 of file rm_rwlock.c.
◆ rwlockable_len()
◆ rwlockable_resource_free()
static void rwlockable_resource_free |
( |
struct m0_rm_resource * |
resource | ) |
|
|
static |
◆ rwlock_credit_ops
Initial value:= {
}
static int rwlock_cr_join(struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static bool rwlock_cr_intersects(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static int rwlock_cr_decode(struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
static int rwlock_cr_encode(struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
static bool rwlock_cr_is_subset(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static void rwlock_cr_initial_capital(struct m0_rm_credit *self)
static void rwlock_cr_free(struct m0_rm_credit *self)
static bool rwlock_cr_conflicts(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static int rwlock_cr_disjoin(struct m0_rm_credit *self, const struct m0_rm_credit *c1, struct m0_rm_credit *intersection)
static int rwlock_cr_copy(struct m0_rm_credit *dest, const struct m0_rm_credit *self)
static m0_bcount_t rwlock_cr_len(const struct m0_rm_credit *c0)
static int rwlock_cr_diff(struct m0_rm_credit *self, const struct m0_rm_credit *c1)
Definition at line 236 of file rm_rwlock.c.
◆ rwlockable_ops
Initial value:= {
}
static void rwlockable_resource_free(struct m0_rm_resource *resource)
static void rwlockable_credit_init(struct m0_rm_resource *resource, struct m0_rm_credit *credit)
Definition at line 231 of file rm_rwlock.c.
◆ rwlockable_type_ops
Initial value:= {
}
static m0_bcount_t rwlockable_len(const struct m0_rm_resource *resource)
static int rwlockable_decode(struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource)
static bool rwlockable_equal(const struct m0_rm_resource *resource0, const struct m0_rm_resource *resource1)
static int rwlockable_encode(struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource)
Definition at line 224 of file rm_rwlock.c.