23 #undef M0_TRACE_SUBSYSTEM 24 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_FILE 28 #include "fid/fid_xc.h" 220 #define R_F(resource) container_of(resource, struct m0_file, fi_res) 231 file0 =
R_F(resource0);
232 file1 =
R_F(resource1);
246 if (flock_len == 0) {
363 return self->cr_datum == c1->
cr_datum;
399 dest->cr_datum =
self->cr_datum;
400 dest->cr_owner =
self->cr_owner;
401 dest->cr_ops =
self->cr_ops;
413 self->cr_datum =
max64((int64_t)(self->cr_datum - c1->
cr_datum), 0);
425 return self->cr_datum & c1->
cr_datum;
433 return self->cr_datum <= c1->
cr_datum;
571 .ft_name =
"file fid" 587 #undef M0_TRACE_SUBSYSTEM const struct m0_rm_credit_ops * cr_ops
static void file_lock_cr_free(struct m0_rm_credit *self)
static int file_lock_cr_copy(struct m0_rm_credit *dest, const struct m0_rm_credit *self)
M0_INTERNAL int m0_xcode_encdec(struct m0_xcode_obj *obj, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
static int file_lock_cr_join(struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static m0_bcount_t file_lock_cr_len(const struct m0_rm_credit *c0)
static int file_lock_encode(struct m0_bufvec_cursor *cur, const struct m0_rm_resource *resource)
const struct m0_xcode_type * xo_type
const struct m0_rm_credit_ops file_lock_credit_ops
bool(* cro_intersects)(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static struct m0_rm_remote creditor
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
void(* rio_complete)(struct m0_rm_incoming *in, int32_t rc)
static struct io_request req
const struct m0_rm_resource_ops file_lock_ops
#define M0_LOG(level,...)
static void file_lock_credit_init(struct m0_rm_resource *resource, struct m0_rm_credit *credit)
const struct m0_fid * fi_fid
static bool file_lock_cr_intersects(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static void file_lock_resource_free(struct m0_rm_resource *resource)
bool(* rto_eq)(const struct m0_rm_resource *resource0, const struct m0_rm_resource *resource1)
static int file_lock_cr_decode(struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
const struct m0_fid_type m0_file_fid_type
M0_INTERNAL void m0_file_lock(struct m0_rm_owner *owner, struct m0_rm_incoming *req)
M0_INTERNAL void m0_xcode_free_obj(struct m0_xcode_obj *obj)
M0_INTERNAL void m0_file_mod_fini(void)
M0_INTERNAL void m0_file_lock_type_deregister(struct m0_rm_resource_type *flock_rt)
M0_INTERNAL int m0_xcode_length(struct m0_xcode_ctx *ctx)
const struct m0_rm_resource_ops * r_ops
M0_INTERNAL int m0_file_lock_type_register(struct m0_rm_domain *dom, struct m0_rm_resource_type *flock_rt)
static int file_lock_encdec(struct m0_file *file, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
static int64_t max64(int64_t a, int64_t b)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_fid_type_register(const struct m0_fid_type *fidt)
M0_INTERNAL void m0_rm_incoming_init(struct m0_rm_incoming *in, struct m0_rm_owner *owner, enum m0_rm_incoming_type type, enum m0_rm_incoming_policy policy, uint64_t flags)
M0_INTERNAL void m0_rm_owner_fini(struct m0_rm_owner *owner)
M0_INTERNAL void m0_rm_owner_init_rfid(struct m0_rm_owner *owner, const struct m0_uint128 *group, struct m0_rm_resource *res, struct m0_rm_remote *creditor)
static int file_lock_cr_diff(struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static struct m0_stob_domain * dom
static void file_lock_incoming_complete(struct m0_rm_incoming *in, int32_t rc)
static int file_lock_cr_disjoin(struct m0_rm_credit *self, const struct m0_rm_credit *c1, struct m0_rm_credit *intersection)
M0_INTERNAL void m0_file_owner_init(struct m0_rm_owner *owner, const struct m0_uint128 *grp_id, struct m0_file *file, struct m0_rm_remote *creditor)
void(* rop_credit_init)(struct m0_rm_resource *resource, struct m0_rm_credit *credit)
const struct m0_rm_incoming_ops file_lock_incoming_ops
static bool file_lock_credit_invariant(const struct m0_rm_credit *file_cr)
M0_INTERNAL void m0_fid_type_unregister(const struct m0_fid_type *fidt)
M0_INTERNAL int m0_file_mod_init(void)
static int file_lock_cr_encdec(struct m0_rm_credit *self, struct m0_bufvec_cursor *cur, enum m0_xcode_what what)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
M0_INTERNAL void m0_rm_credit_put(struct m0_rm_incoming *in)
M0_INTERNAL void m0_rm_resource_add(struct m0_rm_resource_type *rtype, struct m0_rm_resource *res)
M0_INTERNAL void m0_file_unlock(struct m0_rm_incoming *req)
#define M0_FI_ENABLED(tag)
M0_INTERNAL const struct m0_di_ops * m0_di_ops_get(enum m0_di_types di_type)
#define M0_ALLOC_PTR(ptr)
struct m0_rm_resource fi_res
static bool file_lock_cr_conflicts(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
M0_INTERNAL void m0_rm_incoming_fini(struct m0_rm_incoming *in)
const struct m0_rm_resource_type_ops * rt_ops
M0_INTERNAL int m0_rm_type_register(struct m0_rm_domain *dom, struct m0_rm_resource_type *rt)
M0_INTERNAL void m0_file_fini(struct m0_file *file)
#define M0_XCODE_OBJ(type, ptr)
static int file_lock_decode(struct m0_bufvec_cursor *cur, struct m0_rm_resource **resource)
static m0_bcount_t file_lock_len(const struct m0_rm_resource *resource)
M0_INTERNAL void m0_xcode_ctx_init(struct m0_xcode_ctx *ctx, const struct m0_xcode_obj *obj)
M0_INTERNAL void m0_file_owner_fini(struct m0_rm_owner *owner)
M0_INTERNAL void m0_rm_type_deregister(struct m0_rm_resource_type *rt)
static void file_lock_cr_initial_capital(struct m0_rm_credit *self)
static bool file_lock_cr_is_subset(const struct m0_rm_credit *self, const struct m0_rm_credit *c1)
static bool file_lock_equal(const struct m0_rm_resource *resource0, const struct m0_rm_resource *resource1)
static int file_lock_cr_encode(struct m0_rm_credit *self, struct m0_bufvec_cursor *cur)
const struct m0_xcode_type M0_XT_U64
const struct m0_rm_resource_type_ops file_lock_type_ops
M0_INTERNAL void m0_rm_resource_del(struct m0_rm_resource *res)
M0_INTERNAL void m0_rm_credit_get(struct m0_rm_incoming *in)
const struct m0_di_ops * fi_di_ops
M0_INTERNAL void m0_file_init(struct m0_file *file, const struct m0_fid *fid, struct m0_rm_domain *dom, enum m0_di_types di_type)
static void file_lock_incoming_conflict(struct m0_rm_incoming *in)