23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_EXTMAP 177 .ot_version = M0_BE_EMAP_KEY_FORMAT_VERSION,
178 .ot_type = M0_FORMAT_TYPE_BE_EMAP_KEY,
179 .ot_footer_offset = offsetof(struct m0_be_emap_key, ek_footer)
187 .ot_version = M0_BE_EMAP_REC_FORMAT_VERSION,
188 .ot_type = M0_FORMAT_TYPE_BE_EMAP_REC,
192 .ot_footer_offset = offsetof(struct m0_be_emap_rec,
231 }
while (
rc == 0 ||
rc == -ESRCH);
240 (
unsigned long)nr_segs);
261 .ot_version = M0_BE_EMAP_FORMAT_VERSION,
262 .ot_type = M0_FORMAT_TYPE_BE_EMAP,
263 .ot_footer_offset = offsetof(struct m0_be_emap, em_footer)
296 op->bo_u.u_emap.e_rc = 0;
341 return map->em_seg->bs_domain;
436 bool inserted =
false;
527 const struct m0_ext ext0 = *ext;
530 typeof(
val) bstart[3] = {};
583 (
unsigned long)length[1], (
unsigned long)length[2]);
602 cut_left(
seg, &clip, val_orig);
614 cut_right(
seg, &clip, val_orig);
627 if (length[0] == 0 && length[2] == 0 &&
del)
756 map->em_rec.er_start = 0;
757 map->em_rec.er_value =
val;
758 map->em_rec.er_cksum_nob = 0;
763 map->em_key_buf.b_nob,
map->em_val_buf.b_nob );
767 &
map->em_key_buf, &
map->em_val_buf),
812 op->bo_u.u_emap.e_rc =
rc;
891 uint64_t emap_rec_size;
910 sizeof map->em_key, emap_rec_size, accum);
914 sizeof map->em_key, emap_rec_size, accum);
918 emap_rec_size, accum);
922 sizeof map->em_key, emap_rec_size, accum);
924 sizeof map->em_key, emap_rec_size, accum);
926 emap_rec_size, accum);
930 sizeof map->em_key, emap_rec_size, accum);
932 sizeof map->em_key, emap_rec_size, accum);
934 emap_rec_size, accum);
982 struct m0_buf rec_buf = {};
1009 *rec_buf_ptr = *rec;
1013 memcpy( (
void *)&rec_buf_ptr->
er_footer,
1048 rc =
op->bo_u.u_btree.t_rc;
1220 bool is_good =
true;
1234 scan->ec_recbuf.b_nob = 0;
1290 for (
i = 0;
i <
vec->iv_vec.v_nr; ++
i) {
1342 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL int m0_uint128_cmp(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
M0_INTERNAL struct m0_be_domain * m0_be_emap_seg_domain(const struct m0_be_emap *map)
struct m0_format_header er_header
static int emap_it_open(struct m0_be_emap_cursor *it)
M0_INTERNAL void m0_be_btree_cursor_next(struct m0_be_btree_cursor *cur)
M0_INTERNAL void m0_be_btree_delete_credit(const struct m0_be_btree *tree, m0_bcount_t nr, m0_bcount_t ksize, m0_bcount_t vsize, struct m0_be_tx_credit *accum)
M0_INTERNAL m0_bcount_t m0_ext_length(const struct m0_ext *ext)
static m0_bcount_t be_emap_ksize(const void *k)
M0_INTERNAL void m0_be_emap_next(struct m0_be_emap_cursor *it)
M0_INTERNAL m0_bcount_t m0_be_emap_caret_step(const struct m0_be_emap_caret *car)
static m0_bcount_t be_emap_vsize(const void *d)
union m0_be_rwlock::@198 bl_u
struct m0_be_rwlock em_lock
M0_INTERNAL int m0_be_emap_dump(struct m0_be_emap *map)
M0_INTERNAL bool m0_uint128_eq(const struct m0_uint128 *u0, const struct m0_uint128 *u1)
#define M0_LOG(level,...)
M0_INTERNAL int m0_be_emap_caret_move(struct m0_be_emap_caret *car, m0_bcount_t count)
struct m0_be_emap_key ec_key
static struct m0_uint128 prefix
#define M0_BE_OP_SYNC(op_obj, action)
static m0_bcount_t segs[NR *IT]
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
M0_INTERNAL void m0_rwlock_write_lock(struct m0_rwlock *lock)
M0_INTERNAL void m0_be_emap_destroy(struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op)
M0_INTERNAL void m0_be_emap_obj_insert(struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_uint128 *prefix, uint64_t val)
static int emap_extent_update(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, const struct m0_be_emap_seg *es)
M0_INTERNAL void m0_be_emap_prev(struct m0_be_emap_cursor *it)
M0_INTERNAL void m0_be_emap_close(struct m0_be_emap_cursor *it)
static struct m0_be_emap_cursor it
static int emap_it_pack(struct m0_be_emap_cursor *it, void(*btree_func)(struct m0_be_btree *btree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key, const struct m0_buf *val), struct m0_be_tx *tx)
static void emap_dump(struct m0_be_emap_cursor *it)
static bool be_emap_invariant(struct m0_be_emap_cursor *it)
M0_INTERNAL void * m0_extent_get_checksum_addr(void *b_addr, m0_bindex_t off, m0_bindex_t base_off, m0_bindex_t unit_sz, m0_bcount_t cs_size)
struct m0_be_emap_seg ec_seg
M0_INTERNAL void m0_be_btree_create(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_fid *btree_fid)
M0_INTERNAL m0_bcount_t m0_extent_get_checksum_nob(m0_bindex_t ext_start, m0_bindex_t ext_length, m0_bindex_t unit_sz, m0_bcount_t cs_size)
M0_INTERNAL void m0_be_emap_split(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, struct m0_indexvec *vec, struct m0_buf *cksum)
M0_INTERNAL void m0_be_btree_destroy_credit(struct m0_be_btree *tree, struct m0_be_tx_credit *accum)
M0_INTERNAL bool m0_be_emap_ext_is_first(const struct m0_ext *ext)
#define M0_BE_CREDIT_DEC(cr_user, tx)
M0_INTERNAL void m0_be_emap_merge(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, m0_bindex_t delta)
#define M0_INVARIANT_EX(cond)
M0_INTERNAL void m0_be_btree_delete(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key)
M0_INTERNAL void m0_be_btree_cursor_fini(struct m0_be_btree_cursor *cursor)
M0_INTERNAL void m0_rwlock_init(struct m0_rwlock *lock)
struct m0_buf ee_cksum_buf
M0_INTERNAL struct m0_be_op * m0_be_emap_op(struct m0_be_emap_cursor *it)
static int btree(struct scanner *s, struct rectype *r, char *buf)
#define M0_ASSERT_EX(cond)
M0_INTERNAL bool m0_vec_is_empty(const struct m0_vec *vec)
M0_INTERNAL bool m0_ext_is_valid(const struct m0_ext *ext)
M0_INTERNAL int m0_be_emap_op_rc(const struct m0_be_emap_cursor *it)
static bool be_emap_invariant_check(struct m0_be_emap_cursor *it)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_be_emap_paste(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, struct m0_ext *ext, uint64_t val, void(*del)(struct m0_be_emap_seg *), void(*cut_left)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t), void(*cut_right)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t))
M0_INTERNAL void m0_be_btree_update_credit(const struct m0_be_btree *tree, m0_bcount_t nr, m0_bcount_t vsize, struct m0_be_tx_credit *accum)
struct m0_be_btree_cursor ec_cursor
#define M0_BE_OP_SYNC_RET(op_obj, action, member)
M0_INTERNAL void m0_be_emap_init(struct m0_be_emap *map, struct m0_be_seg *db)
M0_INTERNAL void m0_be_btree_create_credit(const struct m0_be_btree *tree, m0_bcount_t nr, struct m0_be_tx_credit *accum)
M0_INTERNAL void m0_be_btree_insert(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key, const struct m0_buf *val)
#define M0_FID_TINIT(type, container, key)
M0_INTERNAL void m0_be_btree_insert_credit(const struct m0_be_btree *tree, m0_bcount_t nr, m0_bcount_t ksize, m0_bcount_t vsize, struct m0_be_tx_credit *accum)
struct m0_be_emap * ec_map
M0_INTERNAL void m0_be_btree_destroy(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op)
M0_INTERNAL void m0_ext_init(struct m0_ext *ext)
struct m0_uint128 ek_prefix
M0_INTERNAL void m0_be_emap_caret_init(struct m0_be_emap_caret *car, struct m0_be_emap_cursor *it, m0_bindex_t index)
struct m0_be_emap_rec ec_rec
M0_INTERNAL bool m0_be_emap_ext_is_last(const struct m0_ext *ext)
M0_INTERNAL void m0_be_emap_extent_update(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, const struct m0_be_emap_seg *es)
static void delete_wrapper(struct m0_be_btree *btree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key, const struct m0_buf *val)
M0_INTERNAL int m0_buf_alloc(struct m0_buf *buf, size_t size)
struct m0_be_op::@39::@40 u_emap
M0_INTERNAL void m0_be_btree_fini(struct m0_be_btree *tree)
M0_INTERNAL void m0_be_emap_fini(struct m0_be_emap *map)
M0_INTERNAL void m0_be_emap_lookup(struct m0_be_emap *map, const struct m0_uint128 *prefix, m0_bindex_t offset, struct m0_be_emap_cursor *it)
static int be_emap_next(struct m0_be_emap_cursor *it)
M0_INTERNAL void m0_be_op_done(struct m0_be_op *op)
static m0_bindex_t offset
M0_INTERNAL void m0_rwlock_write_unlock(struct m0_rwlock *lock)
M0_INTERNAL void m0_be_emap_obj_delete(struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_uint128 *prefix)
M0_INTERNAL void m0_buf_free(struct m0_buf *buf)
M0_INTERNAL bool m0_ext_is_in(const struct m0_ext *ext, m0_bindex_t index)
struct m0_uint128 ec_prefix
M0_INTERNAL m0_bcount_t m0_vec_count(const struct m0_vec *vec)
M0_INTERNAL bool m0_ext_is_empty(const struct m0_ext *ext)
static int be_emap_split(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, struct m0_indexvec *vec, m0_bindex_t scan, struct m0_buf *cksum)
M0_INTERNAL m0_bcount_t m0_extent_get_num_unit_start(m0_bindex_t ext_start, m0_bindex_t ext_len, m0_bindex_t unit_sz)
static struct m0_be_emap * emap
M0_INTERNAL void m0_be_btree_cursor_kv_get(struct m0_be_btree_cursor *cur, struct m0_buf *key, struct m0_buf *val)
static void emap_it_init(struct m0_be_emap_cursor *it, const struct m0_uint128 *prefix, m0_bindex_t offset, struct m0_be_emap *map)
struct m0_be_btree em_mapping
struct m0_be_emap_cursor * ct_it
static bool emap_it_prefix_ok(const struct m0_be_emap_cursor *it)
#define m0_forall(var, nr,...)
M0_INTERNAL void m0_be_btree_update(struct m0_be_btree *tree, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_buf *key, const struct m0_buf *val)
static bool be_emap_changed(struct m0_be_emap_cursor *it, m0_bindex_t off)
static int be_emap_prev(struct m0_be_emap_cursor *it)
M0_INTERNAL void m0_be_op_active(struct m0_be_op *op)
M0_INTERNAL uint64_t max_cksum_size(void)
static bool be_emap_caret_invariant(const struct m0_be_emap_caret *car)
#define M0_FI_ENABLED(tag)
static int be_emap_lookup(struct m0_be_emap *map, const struct m0_uint128 *prefix, m0_bindex_t offset, struct m0_be_emap_cursor *it)
#define M0_ALLOC_PTR(ptr)
M0_INTERNAL void m0_be_btree_cursor_get(struct m0_be_btree_cursor *cur, const struct m0_buf *key, bool slant)
M0_INTERNAL void m0_be_btree_cursor_prev(struct m0_be_btree_cursor *cur)
static struct m0_be_emap_seg * seg
M0_INTERNAL void m0_be_op_fini(struct m0_be_op *op)
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
M0_INTERNAL int m0_be_emap_caret_move_sync(struct m0_be_emap_caret *car, m0_bcount_t count)
M0_INTERNAL void m0_rwlock_fini(struct m0_rwlock *lock)
M0_INTERNAL void m0_be_btree_init(struct m0_be_btree *tree, struct m0_be_seg *seg, const struct m0_be_btree_kv_ops *ops)
static const struct m0_be_btree_kv_ops be_emap_ops
static struct m0_rwlock * emap_rwlock(struct m0_be_emap *emap)
static void emap_key_init(struct m0_be_emap_key *key)
M0_INTERNAL void m0_be_btree_cursor_init(struct m0_be_btree_cursor *cur, struct m0_be_btree *btree)
#define M0_UINT128(hi, lo)
M0_INTERNAL void m0_ext_intersection(const struct m0_ext *e0, const struct m0_ext *e1, struct m0_ext *result)
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
M0_INTERNAL void m0_be_emap_credit(struct m0_be_emap *map, enum m0_be_emap_optype optype, m0_bcount_t nr, struct m0_be_tx_credit *accum)
struct m0_buf ec_app_cksum_buf
M0_INTERNAL int m0_be_emap_count(struct m0_be_emap_cursor *it, m0_bcount_t *segs)
static int update_next_segment(struct m0_be_emap_cursor *it, struct m0_be_tx *tx, m0_bindex_t delta, bool get_next)
struct m0_format_footer er_footer
static int emap_it_get(struct m0_be_emap_cursor *it)
static int scan(struct scanner *s)
M0_INTERNAL void m0_be_op_init(struct m0_be_op *op)
#define M0_BE_CREDIT_INC(n, cr_user, credit)
M0_INTERNAL bool m0_be_op_is_done(struct m0_be_op *op)
M0_INTERNAL void m0_be_emap_create(struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op, const struct m0_fid *fid)
static int be_emap_cmp(const void *key0, const void *key1)
M0_INTERNAL void m0_be_op_wait(struct m0_be_op *op)
M0_INTERNAL struct m0_be_emap_seg * m0_be_emap_seg_get(struct m0_be_emap_cursor *it)
static void emap_rec_init(struct m0_be_emap_rec *rec)
M0_INTERNAL void m0_be_emap_caret_fini(struct m0_be_emap_caret *car)
#define M0_IMPOSSIBLE(fmt,...)
static void be_emap_close(struct m0_be_emap_cursor *it)