Motr  M0
Extent map abstraction

Data Structures

struct  m0_be_emap_seg
 
struct  m0_be_emap_cursor
 
struct  m0_be_emap_caret
 
struct  m0_be_emap_key
 
struct  m0_be_emap_rec
 
struct  m0_be_emap
 

Enumerations

enum  m0_be_emap_optype {
  M0_BEO_CREATE, M0_BEO_DESTROY, M0_BEO_INSERT, M0_BEO_DELETE,
  M0_BEO_UPDATE, M0_BEO_MERGE, M0_BEO_SPLIT, M0_BEO_PASTE
}
 
enum  m0_be_emap_key_format_version { M0_BE_EMAP_KEY_FORMAT_VERSION_1 = 1, M0_BE_EMAP_KEY_FORMAT_VERSION = M0_BE_EMAP_KEY_FORMAT_VERSION_1 }
 
enum  m0_be_emap_rec_format_version { M0_BE_EMAP_REC_FORMAT_VERSION_1 = 1, M0_BE_EMAP_REC_FORMAT_VERSION = M0_BE_EMAP_REC_FORMAT_VERSION_1 }
 
enum  m0_be_emap_format_version { M0_BE_EMAP_FORMAT_VERSION_1 = 1, M0_BE_EMAP_FORMAT_VERSION = M0_BE_EMAP_FORMAT_VERSION_1 }
 

Functions

static int be_emap_cmp (const void *key0, const void *key1)
 
static m0_bcount_t be_emap_ksize (const void *k)
 
static m0_bcount_t be_emap_vsize (const void *d)
 
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 bool emap_it_prefix_ok (const struct m0_be_emap_cursor *it)
 
static int emap_it_open (struct m0_be_emap_cursor *it)
 
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)
 
static void be_emap_close (struct m0_be_emap_cursor *it)
 
static int emap_it_get (struct m0_be_emap_cursor *it)
 
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)
 
static int be_emap_next (struct m0_be_emap_cursor *it)
 
static int be_emap_prev (struct m0_be_emap_cursor *it)
 
static bool be_emap_invariant (struct m0_be_emap_cursor *it)
 
static int emap_extent_update (struct m0_be_emap_cursor *it, struct m0_be_tx *tx, const struct m0_be_emap_seg *es)
 
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)
 
static bool be_emap_caret_invariant (const struct m0_be_emap_caret *car)
 
static struct m0_rwlockemap_rwlock (struct m0_be_emap *emap)
 
static void emap_dump (struct m0_be_emap_cursor *it)
 
static void emap_key_init (struct m0_be_emap_key *key)
 
static void emap_rec_init (struct m0_be_emap_rec *rec)
 
M0_INTERNAL int m0_be_emap_dump (struct m0_be_emap *map)
 
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 void m0_be_emap_init (struct m0_be_emap *map, struct m0_be_seg *db)
 
M0_INTERNAL void m0_be_emap_fini (struct m0_be_emap *map)
 
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)
 
M0_INTERNAL void m0_be_emap_destroy (struct m0_be_emap *map, struct m0_be_tx *tx, struct m0_be_op *op)
 
M0_INTERNAL struct m0_be_emap_segm0_be_emap_seg_get (struct m0_be_emap_cursor *it)
 
M0_INTERNAL bool m0_be_emap_ext_is_last (const struct m0_ext *ext)
 
M0_INTERNAL bool m0_be_emap_ext_is_first (const struct m0_ext *ext)
 
M0_INTERNAL struct m0_be_opm0_be_emap_op (struct m0_be_emap_cursor *it)
 
M0_INTERNAL int m0_be_emap_op_rc (const struct m0_be_emap_cursor *it)
 
M0_INTERNAL struct m0_be_domainm0_be_emap_seg_domain (const 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)
 
M0_INTERNAL void m0_be_emap_close (struct m0_be_emap_cursor *it)
 
static bool be_emap_changed (struct m0_be_emap_cursor *it, m0_bindex_t off)
 
M0_INTERNAL void m0_be_emap_next (struct m0_be_emap_cursor *it)
 
M0_INTERNAL void m0_be_emap_prev (struct m0_be_emap_cursor *it)
 
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 int update_next_segment (struct m0_be_emap_cursor *it, struct m0_be_tx *tx, m0_bindex_t delta, bool get_next)
 
M0_INTERNAL void m0_be_emap_merge (struct m0_be_emap_cursor *it, struct m0_be_tx *tx, m0_bindex_t delta)
 
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_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 int m0_be_emap_count (struct m0_be_emap_cursor *it, m0_bcount_t *segs)
 
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)
 
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_be_emap_caret_init (struct m0_be_emap_caret *car, struct m0_be_emap_cursor *it, m0_bindex_t index)
 
M0_INTERNAL void m0_be_emap_caret_fini (struct m0_be_emap_caret *car)
 
M0_INTERNAL m0_bcount_t m0_be_emap_caret_step (const struct m0_be_emap_caret *car)
 
M0_INTERNAL int m0_be_emap_caret_move (struct m0_be_emap_caret *car, m0_bcount_t count)
 
M0_INTERNAL int m0_be_emap_caret_move_sync (struct m0_be_emap_caret *car, m0_bcount_t count)
 
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)
 
static bool be_emap_invariant_check (struct m0_be_emap_cursor *it)
 
struct m0_be_emap_seg M0_XCA_DOMAIN (be)
 

Variables

static const struct m0_be_btree_kv_ops be_emap_ops
 
struct m0_be_emap_cursor M0_XCA_DOMAIN
 
enum m0_be_emap_rec_format_version M0_XCA_DOMAIN
 

Detailed Description

Extent map is a persistent transactional collection of extents in an abstract numerical name-space with a numerical value associated to each extent.

The name-space is a set of all 64-bit unsigned numbers from 0 to M0_BINDEX_MAX. An extent of the name-space consisting of numbers from A (inclusive) to B (exclusive) is denoted [A, B).

A segment is an extent together with a 64-bit value associated with it, denoted as ([A, B), V).

An extent map is a collection of segments whose extents are non-empty and form a partition of the name-space.

That is, an extent map is something like

\[ ([0, e_0), v_0), ([e_0, e_1), v_1), \ldots, ([e_n, M0\_BINDEX\_MAX + 1), v_n) \]

Note that extents cover the whole name-space from 0 to M0_BINDEX_MAX without holes.

Possible applications of extent map include:

Extent map interface is based on a notion of map cursor (m0_be_emap_cursor): an object recording a position within a map (i.e., a segment reached by the iteration).

A cursor can be positioned at the segment including a given point in the name-space (m0_be_emap_lookup()) and moved through the segments (m0_be_emap_next() and m0_be_emap_prev()).

An extent map can be modified by the following functions:

It's easy to see that these operations preserve extent map invariant that extents are non-empty and form the name-space partition.

Note
The asymmetry between split and merge interfaces (i.e., the fact that a segment can be split into multiple segments at once, but only two segments can be merged) is because a user usually wants to inspect a segment before merging it with another one. For example, data object truncate goes through the allocation data segments downward until the target offset of reached. Each segment is analyzed, data-blocks are freed is necessary and the segment is merged with the next one.
Currently the length and ordering of prefix and value is fixed by the implementation. Should the need arise, prefixes and values of arbitrary size and ordering could be easily implemented at the expense of dynamic memory allocation during cursor initialization. Prefix comparison function could be supplied as m0_be_emap constructor parameter.

Extent map implementation details.

See also
extmap_internal.h

Few notes:

Note
be_emap_invariant() is potentially expensive. Consider turning it off conditionally.

Extent map implementation.

Extent map collection (m0_be_emap) is a table. 128-bit prefix is used to store multiple extent maps in the same table.

Enumeration Type Documentation

◆ m0_be_emap_format_version

Enumerator
M0_BE_EMAP_FORMAT_VERSION_1 
M0_BE_EMAP_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 124 of file extmap_internal.h.

◆ m0_be_emap_key_format_version

Enumerator
M0_BE_EMAP_KEY_FORMAT_VERSION_1 
M0_BE_EMAP_KEY_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 46 of file extmap_internal.h.

◆ m0_be_emap_optype

Possible persistent operations over the tree. Enumeration items are being reused to define transaction credit types also.

Enumerator
M0_BEO_CREATE 

m0_be_emap_create()

M0_BEO_DESTROY 

m0_be_emap_destroy()

M0_BEO_INSERT 

m0_be_emap_obj_insert()

M0_BEO_DELETE 

m0_be_emap_obj_delete()

M0_BEO_UPDATE 

m0_be_emap_extent_update()

M0_BEO_MERGE 

m0_be_emap_merge()

M0_BEO_SPLIT 

m0_be_emap_split()

M0_BEO_PASTE 

m0_be_emap_paste()

Definition at line 415 of file extmap.h.

◆ m0_be_emap_rec_format_version

Enumerator
M0_BE_EMAP_REC_FORMAT_VERSION_1 
M0_BE_EMAP_REC_FORMAT_VERSION 

Current version, should point to the latest version present

Definition at line 80 of file extmap_internal.h.

Function Documentation

◆ be_emap_caret_invariant()

static bool be_emap_caret_invariant ( const struct m0_be_emap_caret car)
static

Definition at line 1334 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_changed()

static bool be_emap_changed ( struct m0_be_emap_cursor it,
m0_bindex_t  off 
)
static

Definition at line 366 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_close()

static void be_emap_close ( struct m0_be_emap_cursor it)
static

Definition at line 1111 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_cmp()

static int be_emap_cmp ( const void *  key0,
const void *  key1 
)
static

Definition at line 948 of file extmap.c.

Here is the call graph for this function:

◆ be_emap_invariant()

static bool be_emap_invariant ( struct m0_be_emap_cursor it)
static

Definition at line 1218 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_invariant_check()

static bool be_emap_invariant_check ( struct m0_be_emap_cursor it)
static

Definition at line 1185 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_ksize()

static m0_bcount_t be_emap_ksize ( const void *  k)
static

Definition at line 958 of file extmap.c.

◆ be_emap_lookup()

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 
)
static

Definition at line 1135 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_next()

static int be_emap_next ( struct m0_be_emap_cursor it)
static

Definition at line 1152 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_prev()

static int be_emap_prev ( struct m0_be_emap_cursor it)
static

Definition at line 1168 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_split()

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 
)
static

Definition at line 1279 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ be_emap_vsize()

static m0_bcount_t be_emap_vsize ( const void *  d)
static

Definition at line 964 of file extmap.c.

◆ delete_wrapper()

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 
)
static

Definition at line 250 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_dump()

static void emap_dump ( struct m0_be_emap_cursor it)
static

Definition at line 139 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_extent_update()

static int emap_extent_update ( struct m0_be_emap_cursor it,
struct m0_be_tx tx,
const struct m0_be_emap_seg es 
)
static

Definition at line 1264 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_it_get()

static int emap_it_get ( struct m0_be_emap_cursor it)
static

Definition at line 1120 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_it_init()

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 
)
static

Definition at line 1095 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_it_open()

static int emap_it_open ( struct m0_be_emap_cursor it)
static

Definition at line 1036 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_it_pack()

static int emap_it_pack ( struct m0_be_emap_cursor it,
void(*)(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 btree_func,
struct m0_be_tx tx 
)
static

Definition at line 971 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_it_prefix_ok()

static bool emap_it_prefix_ok ( const struct m0_be_emap_cursor it)
static

Definition at line 1031 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_key_init()

static void emap_key_init ( struct m0_be_emap_key key)
static

Definition at line 174 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_rec_init()

static void emap_rec_init ( struct m0_be_emap_rec rec)
static

cksum of size cksum_nob will be present just before footer, update the same in emap header.

Definition at line 184 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ emap_rwlock()

static struct m0_rwlock* emap_rwlock ( struct m0_be_emap emap)
static

Definition at line 134 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_caret_fini()

M0_INTERNAL void m0_be_emap_caret_fini ( struct m0_be_emap_caret car)

Definition at line 828 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_caret_init()

M0_INTERNAL void m0_be_emap_caret_init ( struct m0_be_emap_caret car,
struct m0_be_emap_cursor it,
m0_bindex_t  index 
)

Definition at line 817 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_caret_move()

M0_INTERNAL int m0_be_emap_caret_move ( struct m0_be_emap_caret car,
m0_bcount_t  count 
)

Move the caret.

Asynchronous operation, get status via m0_be_emap_op(car->ct_it)->bo_sm.sm_rc.

Definition at line 840 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_caret_move_sync()

M0_INTERNAL int m0_be_emap_caret_move_sync ( struct m0_be_emap_caret car,
m0_bcount_t  count 
)

Synchronous equivalent of m0_be_emap_caret_move().

Definition at line 872 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_caret_step()

M0_INTERNAL m0_bcount_t m0_be_emap_caret_step ( const struct m0_be_emap_caret )

Returns how far is the end of extent.

Definition at line 834 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_close()

M0_INTERNAL void m0_be_emap_close ( struct m0_be_emap_cursor it)

Release the resources associated with the cursor.

Definition at line 360 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_count()

M0_INTERNAL int m0_be_emap_count ( struct m0_be_emap_cursor it,
m0_bcount_t segs 
)

Returns number of segments in the map.

Definition at line 713 of file extmap.c.

Here is the call graph for this function:

◆ m0_be_emap_create()

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 
)

Create maps collection.

m0_be_emap_init() should be called beforehand.

Parameters
fid- unique fid for emap tree.
Note
m0_be_emap_init() should be called before this routine.

Definition at line 283 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_credit()

M0_INTERNAL void m0_be_emap_credit ( struct m0_be_emap emap,
enum m0_be_emap_optype  optype,
m0_bcount_t  nr,
struct m0_be_tx_credit accum 
)

Calculates how many internal resources of tx_engine, described by m0_be_tx_credit, is needed to perform an operation over the . Function updates structure which is an input for m0_be_tx_prep().

Parameters
optypeoperation type over the .
nrnumber of operations.
Note
in case of M0_BEO_SPLIT is the number of split parts.

Definition at line 886 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_destroy()

M0_INTERNAL void m0_be_emap_destroy ( struct m0_be_emap map,
struct m0_be_tx tx,
struct m0_be_op op 
)

Destroy maps collection.

Definition at line 300 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_dump()

M0_INTERNAL int m0_be_emap_dump ( struct m0_be_emap map)

Definition at line 199 of file extmap.c.

Here is the call graph for this function:

◆ m0_be_emap_ext_is_first()

M0_INTERNAL bool m0_be_emap_ext_is_first ( const struct m0_ext ext)

True iff the extent is the first one in a map.

Definition at line 323 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_ext_is_last()

M0_INTERNAL bool m0_be_emap_ext_is_last ( const struct m0_ext ext)

True iff the extent is the last one in a map.

Definition at line 318 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_extent_update()

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 
)

Updates the segment at the current cursor with the given segment having same prefix.

Precondition
m0_uint128_eq(&it->ec_seg.ee_pre, &es->ee_pre) == true

Definition at line 405 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_fini()

M0_INTERNAL void m0_be_emap_fini ( struct m0_be_emap map)

Release the resources associated with the collection.

Definition at line 276 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_init()

M0_INTERNAL void m0_be_emap_init ( struct m0_be_emap map,
struct m0_be_seg db 
)

Initialize maps collection.

Parameters
db- data-base environment used for persistency and transactional support.
Return values
-ENOENTmapname is not found in the segment dictionary.

Definition at line 258 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_lookup()

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 
)

Initialises extent map cursor to point to the segment containing given offset in a map with a given prefix in a given collection.

All operations done through this cursor are executed in the context of given transaction.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Precondition
offset <= M0_BINDEX_MAX
Return values
-ESRCHno matching segment is found. The cursor is non-functional, but m0_be_emap_seg_get() contains information about the first segment of the next map (in prefix lexicographical order);
-ENOENTno matching segment is found and there is no map following requested one.

Definition at line 344 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_merge()

M0_INTERNAL void m0_be_emap_merge ( struct m0_be_emap_cursor it,
struct m0_be_tx tx,
m0_bindex_t  delta 
)

Merge a part of the segment the cursor is currently positioned at with the next segment in the map.

Current segment's extent is shrunk by delta. If this would make it empty, the current segment is deleted. The next segment is expanded by delta downwards.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Precondition
!m0_be_emap_ext_is_last(m0_be_emap_seg_get(it))
delta <= m0_ext_length(m0_be_emap_seg_get(it));

Definition at line 432 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_next()

M0_INTERNAL void m0_be_emap_next ( struct m0_be_emap_cursor it)

Move cursor to the next segment in its map.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Precondition
!m0_be_emap_ext_is_last(m0_be_emap_seg_get(it))

Definition at line 377 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_obj_delete()

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 
)

Remove a map with the given prefix from the collection.

Precondition
the map must be in initial state: consists of a single extent, covering the whole name-space.

Definition at line 774 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_obj_insert()

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 
)

Insert a new map with the given prefix into the collection.

Initially new map consists of a single extent:

\[ ([0, M0\_BINDEX\_MAX + 1), val) \]

Definition at line 744 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_op()

M0_INTERNAL struct m0_be_op * m0_be_emap_op ( struct m0_be_emap_cursor it)

Returns the back-end operation of emap cursor

Definition at line 328 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_op_rc()

M0_INTERNAL int m0_be_emap_op_rc ( const struct m0_be_emap_cursor it)

Definition at line 333 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_paste()

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(*)(struct m0_be_emap_seg *)  del,
void(*)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t)  cut_left,
void(*)(struct m0_be_emap_seg *, struct m0_ext *, uint64_t)  cut_right 
)

Paste segment (ext, val) into the map, deleting or truncating overlapping segments as necessary.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Parameters
del- this call-back is called when an existing segment is completely covered by a new one and has to be deleted. The segment to be deleted is supplied as the call-back argument;
cut_left- this call-back is called when an existing segment has to be cut to give place to a new one and some non-empty left part of the existing segment remains in the map. m0_ext call-back argument is the extent being cut from the existing segment. The last argument is the value associated with the existing segment. The call-back must set seg->ee_val to the new value associated with the remaining left part of the segment;
cut_right- similar to cut_left, this call-back is called when some non-empty right part of an existing segment survives the paste operation.
Note
It is possible that both left and right cut call-backs are called against the same segment (in the case where new segment fits completely into existing one).
Map invariant is temporarily violated during paste operation. No calls against the map should be made from the call-backs or, more generally, from the same transaction, while paste is running.
Call-backs are called in the order of cursor iteration, but this is not a part of official function contract.

Definition at line 517 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_prev()

M0_INTERNAL void m0_be_emap_prev ( struct m0_be_emap_cursor it)

Move cursor to the previous segment in its map.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Precondition
!m0_be_emap_ext_is_first(m0_be_emap_seg_get(it))

Definition at line 391 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_be_emap_seg_domain()

M0_INTERNAL struct m0_be_domain * m0_be_emap_seg_domain ( const struct m0_be_emap map)

Definition at line 339 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_seg_get()

M0_INTERNAL struct m0_be_emap_seg * m0_be_emap_seg_get ( struct m0_be_emap_cursor it)

Returns an extent at the current cursor position.

Definition at line 313 of file extmap.c.

Here is the caller graph for this function:

◆ m0_be_emap_split()

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 
)

Split the segment the cursor is current positioned at into a collection of segments given by the vector.

Iterator is moved to the next segment after original one automatically.

Parameters
vec- a vector describing the collection of segments. vec->ov_vec.v_count[] array contains lengths of the extents and vec->ov_index[] array contains values associated with the corresponding extents.

Empty segments from vec are skipped. On successful completion, the cursor is positioned on the last created segment.

Asynchronous operation, get status via m0_be_emap_op(it)->bo_sm.sm_rc.

Precondition
m0_vec_count(&vec->ov_vec) == m0_ext_length(m0_be_emap_seg_get(it))

Definition at line 464 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ M0_XCA_DOMAIN()

struct m0_be_emap_seg M0_XCA_DOMAIN ( be  )

◆ update_next_segment()

static int update_next_segment ( struct m0_be_emap_cursor it,
struct m0_be_tx tx,
m0_bindex_t  delta,
bool  get_next 
)
static

Definition at line 414 of file extmap.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ be_emap_ops

const struct m0_be_btree_kv_ops be_emap_ops
static
Initial value:
= {
.ko_ksize = be_emap_ksize,
.ko_vsize = be_emap_vsize,
.ko_compare = be_emap_cmp
}
static m0_bcount_t be_emap_ksize(const void *k)
Definition: extmap.c:958
static m0_bcount_t be_emap_vsize(const void *d)
Definition: extmap.c:964
static int be_emap_cmp(const void *key0, const void *key1)
Definition: extmap.c:948

Definition at line 127 of file extmap.c.

◆ M0_XCA_DOMAIN [1/2]

enum m0_be_emap_format_version M0_XCA_DOMAIN

◆ M0_XCA_DOMAIN [2/2]

struct m0_be_emap_cursor M0_XCA_DOMAIN