351 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LAYOUT 373 pair->dp_key.db_buf.b_addr = lid;
374 pair->dp_key.db_buf.b_nob =
sizeof *lid;
375 pair->dp_rec.db_buf.b_addr = area;
376 pair->dp_rec.db_buf.b_nob = num_bytes;
385 void *key_buf =
pair->dp_key.db_buf.b_addr;
386 void *rec_buf =
pair->dp_rec.db_buf.b_addr;
393 M0_PRE(
pair->dp_key.db_buf.b_nob ==
sizeof l->l_id);
399 *(uint64_t *)key_buf =
l->l_id;
400 memset(
pair->dp_rec.db_buf.b_addr, 0,
pair->dp_rec.db_buf.b_nob);
401 m0_db_pair_setup(
pair, &
l->l_dom->ld_layouts,
402 key_buf,
sizeof l->l_id,
408 &
pair->dp_rec.db_buf.b_nob);
415 m0_db_pair_fini(
pair);
432 struct m0_db_pair *
pair,
450 M0_ENTRY(
"lid %llu", (
unsigned long long)lid);
451 if (
dom->ld_type[lt->
lt_id] != lt) {
467 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)lid, 0);
493 l->l_ops->lo_delete(
l);
502 M0_LEAVE(
"lid %llu, ghost found, rc %d",
503 (
unsigned long long)lid, 0);
509 recsize =
pair->dp_rec.db_buf.b_nob <= max_recsize ?
510 pair->dp_rec.db_buf.b_nob : max_recsize;
513 rc = m0_table_lookup(tx,
pair);
516 l->l_ops->lo_delete(
l);
528 l->l_ops->lo_delete(
l);
537 m0_db_pair_fini(
pair);
538 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)lid,
rc);
543 struct m0_db_tx *tx,
struct m0_db_pair *
pair)
552 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
554 recsize =
l->l_ops->lo_recsize(
l);
557 rc = m0_table_insert(tx,
pair);
560 "m0_table_insert() failed",
l->l_id,
rc);
561 m0_db_pair_fini(
pair);
566 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)
l->l_id,
rc);
571 struct m0_db_tx *tx,
struct m0_db_pair *
pair)
580 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
582 recsize =
l->l_ops->lo_recsize(
l);
587 rc = m0_table_update(tx,
pair);
591 "m0_table_update() failed",
l->l_id,
rc);
592 m0_db_pair_fini(
pair);
595 "pair_init() failed",
l->l_id,
rc);
597 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)
l->l_id,
rc);
602 struct m0_db_tx *tx,
struct m0_db_pair *
pair)
611 M0_ENTRY(
"lid %llu", (
unsigned long long)
l->l_id);
613 if (
l->l_user_count > 0) {
615 "user_count, rc %d", (
unsigned long long)
l->l_id,
616 (
unsigned long)
l->l_user_count, -EPROTO);
621 recsize =
l->l_ops->lo_recsize(
l);
624 rc = m0_table_delete(tx,
pair);
627 "m0_table_delete() failed",
l->l_id,
rc);
628 m0_db_pair_fini(
pair);
631 "pair_init() failed",
l->l_id,
rc);
633 M0_LEAVE(
"lid %llu, rc %d", (
unsigned long long)
l->l_id,
rc);
637 #undef M0_TRACE_SUBSYSTEM #define M0_BUFVEC_INIT_BUF(addr_ptr, count_ptr)
M0_INTERNAL m0_bcount_t m0_layout_max_recsize(const struct m0_layout_domain *dom)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
M0_INTERNAL int m0_layout_update(struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair)
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
M0_INTERNAL int m0_layout_add(struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair)
#define M0_LOG(level,...)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL void m0_layout_pair_set(struct m0_db_pair *pair, uint64_t *lid, void *area, m0_bcount_t num_bytes)
M0_INTERNAL int m0_layout_delete(struct m0_layout *l, struct m0_db_tx *tx, struct m0_db_pair *pair)
return M0_ERR(-EOPNOTSUPP)
int(* lto_allocate)(struct m0_layout_domain *dom, uint64_t lid, struct m0_layout **out)
M0_INTERNAL int m0_layout_lookup(struct m0_layout_domain *dom, uint64_t lid, struct m0_layout_type *lt, struct m0_db_tx *tx, struct m0_db_pair *pair, struct m0_layout **out)
static int pair_init(struct m0_db_pair *pair, struct m0_layout *l, struct m0_db_tx *tx, enum m0_layout_xcode_op op, m0_bcount_t recsize)
M0_INTERNAL int m0_layout_encode(struct m0_layout *l, enum m0_layout_xcode_op op, struct m0_be_tx *tx, struct m0_bufvec_cursor *out)
static struct m0_stob_domain * dom
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
M0_INTERNAL bool m0_layout__domain_invariant(const struct m0_layout_domain *dom)
M0_INTERNAL void m0_layout__log(const char *fn_name, const char *err_msg, uint64_t lid, int rc)
M0_INTERNAL int m0_layout_decode(struct m0_layout *l, struct m0_bufvec_cursor *cur, enum m0_layout_xcode_op op, struct m0_be_tx *tx)
static struct m0_clink l[NR]
const struct m0_layout_type_ops * lt_ops
M0_INTERNAL int64_t m0_ref_read(const struct m0_ref *ref)
#define M0_FI_ENABLED(tag)
M0_INTERNAL bool m0_layout__invariant(const struct m0_layout *l)
M0_INTERNAL struct m0_layout * m0_layout__list_lookup(const struct m0_layout_domain *dom, uint64_t lid, bool ref_increment)