Motr
M0
|
#include <rm.h>
Data Fields | |
int(* | rop_credit_decode )(struct m0_rm_resource *resource, struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur) |
void(* | rop_policy )(struct m0_rm_resource *resource, struct m0_rm_incoming *in) |
void(* | rop_credit_init )(struct m0_rm_resource *resource, struct m0_rm_credit *credit) |
void(* | rop_resource_free )(struct m0_rm_resource *resource) |
int(* rop_credit_decode) (struct m0_rm_resource *resource, struct m0_rm_credit *credit, struct m0_bufvec_cursor *cur) |
Called when a new credit is allocated for the resource. The resource specific code should parse the credit description stored in the buffer and fill m0_rm_credit::cr_datum appropriately.
void(* rop_credit_init) (struct m0_rm_resource *resource, struct m0_rm_credit *credit) |
Called to initialise a usage credit for this resource. Sets up m0_rm_credit::cr_ops.
void(* rop_policy) (struct m0_rm_resource *resource, struct m0_rm_incoming *in) |
Decides which credit should be granted, sublet, or revoked.
"Policy" defines which credit to actually grant. E.g., a client doing a write to the first 4KB page in a file asks for [0, 4KB) extent lock. If nobody else accesses the file, RM would grant [0, ~0ULL) lock instead to avoid repeated lock requests in case of sequential IO. If there are other conflicting locks, already granted on the file, the policy might expand requested credit to the largest credit that doesn't overlap with conflicting credits. And so on, there are multiple options. So this is literally a "credit policy" as used by banks. The name stems all the way back to VAX VMS lock manager.
void(* rop_resource_free) (struct m0_rm_resource *resource) |