Motr  M0
ctg_store.c File Reference
#include "lib/trace.h"
#include "lib/memory.h"
#include "lib/finject.h"
#include "lib/assert.h"
#include "lib/errno.h"
#include "lib/ext.h"
#include "be/domain.h"
#include "be/op.h"
#include "module/instance.h"
#include "fop/fom_long_lock.h"
#include "cas/ctg_store.h"
#include "cas/index_gc.h"
#include "dix/fid_convert.h"
#include "motr/setup.h"
Include dependency graph for ctg_store.c:

Go to the source code of this file.

Data Structures

struct  m0_ctg_store
 
struct  generic_key
 
struct  generic_value
 
struct  fid_key
 
struct  meta_value
 
struct  layout_value
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS
 
#define FID_KEY_INIT(__fid)
 
#define GENERIC_VALUE_INIT(__size)
 
#define META_VALUE_INIT(__ctg_ptr)
 
#define LAYOUT_VALUE_INIT(__layout)
 

Enumerations

enum  cursor_phase { CPH_NONE = 0, CPH_INIT, CPH_GET, CPH_NEXT }
 

Functions

 M0_BASSERT (sizeof(struct generic_key)==M0_CAS_CTG_KEY_HDR_SIZE)
 
 M0_BASSERT (sizeof(struct generic_value)==M0_CAS_CTG_VAL_HDR_SIZE)
 
 M0_BASSERT (sizeof(struct m0_crv)==8)
 
 M0_BASSERT (sizeof(struct generic_key)+sizeof(struct m0_fid)==sizeof(struct fid_key))
 
 M0_BASSERT (sizeof(struct generic_value)+sizeof(struct m0_cas_ctg *)==sizeof(struct meta_value))
 
 M0_BASSERT (sizeof(struct generic_value)+sizeof(struct m0_dix_layout)==sizeof(struct layout_value))
 
static struct m0_be_segcas_seg (struct m0_be_domain *dom)
 
static bool ctg_op_is_versioned (const struct m0_ctg_op *op)
 
static int ctg_berc (struct m0_ctg_op *ctg_op)
 
static int ctg_vbuf_unpack (struct m0_buf *buf, struct m0_crv *crv)
 
static int ctg_vbuf_as_ctg (const struct m0_buf *val, struct m0_cas_ctg **ctg)
 
static int ctg_kbuf_unpack (struct m0_buf *buf)
 
static int ctg_kbuf_get (struct m0_buf *dst, const struct m0_buf *src, bool enabled_fi)
 
static void ctg_init (struct m0_cas_ctg *ctg, struct m0_be_seg *seg)
 
static void ctg_fini (struct m0_cas_ctg *ctg)
 
static void ctg_destroy (struct m0_cas_ctg *ctg, struct m0_be_tx *tx)
 
static int ctg_meta_selfadd (struct m0_be_btree *meta, struct m0_be_tx *tx)
 
static void ctg_meta_delete (struct m0_be_btree *meta, const struct m0_fid *fid, struct m0_be_tx *tx)
 
static void ctg_meta_selfrm (struct m0_be_btree *meta, struct m0_be_tx *tx)
 
static void ctg_meta_insert_credit (struct m0_be_btree *bt, m0_bcount_t nr, struct m0_be_tx_credit *accum)
 
static void ctg_meta_delete_credit (struct m0_be_btree *bt, m0_bcount_t nr, struct m0_be_tx_credit *accum)
 
static void ctg_store_init_creds_calc (struct m0_be_seg *seg, struct m0_cas_state *state, struct m0_cas_ctg *ctidx, struct m0_be_tx_credit *cred)
 
static int ctg_op_tick_ret (struct m0_ctg_op *ctg_op, int next_state)
 
static int ctg_op_exec (struct m0_ctg_op *ctg_op, int next_phase)
 
static int ctg_meta_exec (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
static int ctg_exec (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
 
static void ctg_store_release (struct m0_ref *ref)
 
static m0_bcount_t ctg_ksize (const void *key)
 
static m0_bcount_t ctg_vsize (const void *val)
 
static int ctg_cmp (const void *key0, const void *key1)
 
static int versioned_put_sync (struct m0_ctg_op *ctg_op)
 
static int versioned_get_sync (struct m0_ctg_op *op)
 
static int versioned_cursor_next_sync (struct m0_ctg_op *op, bool alive_only)
 
static int versioned_cursor_get_sync (struct m0_ctg_op *op, bool alive_only)
 
static struct m0_be_opctg_beop (struct m0_ctg_op *ctg_op)
 
static m0_bcount_t ctg_vbuf_packed_size (const struct m0_buf *value)
 
static void ctg_vbuf_pack (struct m0_buf *dst, const struct m0_buf *src, const struct m0_crv *crv)
 
static int ctg_vbuf_as_layout (const struct m0_buf *buf, struct m0_dix_layout **layout)
 
int m0_ctg_create (struct m0_be_seg *seg, struct m0_be_tx *tx, struct m0_cas_ctg **out, const struct m0_fid *cas_fid)
 
M0_INTERNAL void m0_ctg_fini (struct m0_fom *fom, struct m0_cas_ctg *ctg)
 
M0_INTERNAL int m0_ctg_meta_find_ctg (struct m0_cas_ctg *meta, const struct m0_fid *ctg_fid, struct m0_cas_ctg **ctg)
 
M0_INTERNAL int m0_ctg__meta_insert (struct m0_be_btree *meta, const struct m0_fid *fid, struct m0_cas_ctg *ctg, struct m0_be_tx *tx)
 
static int ctg_state_create (struct m0_be_seg *seg, struct m0_be_tx *tx, struct m0_cas_state **state)
 
static void ctg_state_destroy (struct m0_cas_state *state, struct m0_be_tx *tx)
 
static int ctg_store__init (struct m0_be_seg *seg, struct m0_cas_state *state)
 
static int ctg_store_create (struct m0_be_seg *seg)
 
M0_INTERNAL int m0_ctg_store_init (struct m0_be_domain *dom)
 
M0_INTERNAL void m0_ctg_store_fini (void)
 
static void ctg_state_counter_add (uint64_t *counter, uint64_t val)
 
static void ctg_state_counter_sub (uint64_t *counter, uint64_t val)
 
static uint64_t ctg_state_update (struct m0_be_tx *tx, uint64_t size, bool is_inc)
 
M0_INTERNAL void m0_ctg_state_inc_update (struct m0_be_tx *tx, uint64_t size)
 
static void ctg_state_dec_update (struct m0_be_tx *tx, uint64_t size)
 
M0_INTERNAL void m0_ctg_try_init (struct m0_cas_ctg *ctg)
 
static bool ctg_is_ordinary (const struct m0_cas_ctg *ctg)
 
static bool ctg_op_cb (struct m0_clink *clink)
 
static uint32_t ctg_op_zones (const struct m0_ctg_op *ctg_op)
 
static int ctg_op_exec_normal (struct m0_ctg_op *ctg_op, int next_phase)
 
static int ctg_op_exec_versioned (struct m0_ctg_op *ctg_op, int next_phase)
 
static int ctg_mem_op_exec (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL int m0_ctg_meta_insert (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL int m0_ctg_gc_wait (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL int m0_ctg_meta_lookup (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_meta_lookup_result (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_meta_delete (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL int m0_ctg_dead_index_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
static int ctg_mem_exec (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL int m0_ctg_insert (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, const struct m0_buf *val, int next_phase)
 
M0_INTERNAL int m0_ctg_lookup_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, struct m0_buf *val, int flags, int next_phase)
 
M0_INTERNAL int m0_ctg_delete (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL int m0_ctg_lookup (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL void m0_ctg_lookup_result (struct m0_ctg_op *ctg_op, struct m0_buf *buf)
 
M0_INTERNAL void m0_ctg_op_get_ver (struct m0_ctg_op *ctg_op, struct m0_crv *out)
 
M0_INTERNAL int m0_ctg_minkey (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
M0_INTERNAL int m0_ctg_truncate (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, m0_bcount_t limit, int next_phase)
 
M0_INTERNAL int m0_ctg_drop (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg, int next_phase)
 
M0_INTERNAL bool m0_ctg_cursor_is_initialised (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_cursor_init (struct m0_ctg_op *ctg_op, struct m0_cas_ctg *ctg)
 
M0_INTERNAL int m0_ctg_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_buf *key, int next_phase)
 
M0_INTERNAL int m0_ctg_cursor_next (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL int m0_ctg_meta_cursor_next (struct m0_ctg_op *ctg_op, int next_phase)
 
M0_INTERNAL void m0_ctg_cursor_kv_get (struct m0_ctg_op *ctg_op, struct m0_buf *key, struct m0_buf *val)
 
M0_INTERNAL void m0_ctg_meta_cursor_init (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL int m0_ctg_meta_cursor_get (struct m0_ctg_op *ctg_op, const struct m0_fid *fid, int next_phase)
 
M0_INTERNAL void m0_ctg_cursor_put (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_cursor_fini (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_op_init (struct m0_ctg_op *ctg_op, struct m0_fom *fom, uint32_t flags)
 
M0_INTERNAL int m0_ctg_op_rc (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_op_fini (struct m0_ctg_op *ctg_op)
 
M0_INTERNAL void m0_ctg_mark_deleted_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_create_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_drop_credit (struct m0_fom *fom, struct m0_be_tx_credit *accum, struct m0_cas_ctg *ctg, m0_bcount_t *limit)
 
M0_INTERNAL void m0_ctg_dead_clean_credit (struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_insert_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_delete_credit (struct m0_cas_ctg *ctg, m0_bcount_t knob, m0_bcount_t vnob, struct m0_be_tx_credit *accum)
 
static void ctg_ctidx_op_credits (struct m0_cas_id *cid, bool insert, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_ctidx_insert_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum)
 
M0_INTERNAL void m0_ctg_ctidx_delete_credits (struct m0_cas_id *cid, struct m0_be_tx_credit *accum)
 
M0_INTERNAL int m0_ctg_ctidx_lookup_sync (const struct m0_fid *fid, struct m0_dix_layout **layout)
 
M0_INTERNAL int m0_ctg_ctidx_insert_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_ctg_ctidx_delete_sync (const struct m0_cas_id *cid, struct m0_be_tx *tx)
 
M0_INTERNAL int m0_ctg_mem_place (struct m0_ctg_op *ctg_op, const struct m0_buf *buf, int next_phase)
 
M0_INTERNAL void m0_ctg_mem_place_get (struct m0_ctg_op *ctg_op, struct m0_buf *buf)
 
M0_INTERNAL int m0_ctg_mem_free (struct m0_ctg_op *ctg_op, void *area, int next_phase)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_meta (void)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_ctidx (void)
 
M0_INTERNAL struct m0_cas_ctgm0_ctg_dead_index (void)
 
M0_INTERNAL uint64_t m0_ctg_rec_nr (void)
 
M0_INTERNAL uint64_t m0_ctg_rec_size (void)
 
M0_INTERNAL struct m0_long_lockm0_ctg_del_lock (void)
 
M0_INTERNAL struct m0_long_lockm0_ctg_lock (struct m0_cas_ctg *ctg)
 
M0_INTERNAL const struct m0_be_btree_kv_opsm0_ctg_btree_ops (void)
 
M0_INTERNAL void ctg_index_btree_dump_one_rec (struct m0_buf *key, struct m0_buf *val, bool dump_in_hex)
 
M0_INTERNAL int ctg_index_btree_dump (struct m0_motr *motr_ctx, struct m0_cas_ctg *ctg, bool dump_in_hex)
 
int ctgdump (struct m0_motr *motr_ctx, char *fidstr, char *dump_in_hex_str)
 
static void ctg_op_version_get (const struct m0_ctg_op *ctg_op, struct m0_crv *out)
 

Variables

static struct m0_mutex cs_init_guard = M0_MUTEX_SINIT(&cs_init_guard)
 
static const struct m0_be_btree_kv_ops cas_btree_ops
 
static struct m0_ctg_store ctg_store = {}
 
static const char cas_state_key [] = "cas-state-nr"
 

Macro Definition Documentation

◆ FID_KEY_INIT

#define FID_KEY_INIT (   __fid)
Value:
(struct fid_key) { \
.fk_gkey = { \
.gk_length = sizeof(*(__fid)), \
}, \
.fk_fid = *(__fid), \
}

Definition at line 361 of file ctg_store.c.

◆ GENERIC_VALUE_INIT

#define GENERIC_VALUE_INIT (   __size)
Value:
(struct generic_value) { \
.gv_length = __size, \
.gv_version = M0_CRV_INIT_NONE, \
}
#define M0_CRV_INIT_NONE
Definition: cas.h:511

Definition at line 368 of file ctg_store.c.

◆ LAYOUT_VALUE_INIT

#define LAYOUT_VALUE_INIT (   __layout)
Value:
(struct layout_value) { \
.lv_gval = GENERIC_VALUE_INIT(sizeof(*(__layout))), \
.lv_layout = *(__layout), \
}
#define GENERIC_VALUE_INIT(__size)
Definition: ctg_store.c:368

Definition at line 378 of file ctg_store.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS

Definition at line 23 of file ctg_store.c.

◆ META_VALUE_INIT

#define META_VALUE_INIT (   __ctg_ptr)
Value:
(struct meta_value) { \
.mv_gval = GENERIC_VALUE_INIT(sizeof(__ctg_ptr)), \
.mv_ctg = (__ctg_ptr), \
}
#define GENERIC_VALUE_INIT(__size)
Definition: ctg_store.c:368

Definition at line 373 of file ctg_store.c.

Enumeration Type Documentation

◆ cursor_phase

Enumerator
CPH_NONE 
CPH_INIT 
CPH_GET 
CPH_NEXT 

Definition at line 128 of file ctg_store.c.

Function Documentation

◆ cas_seg()

static struct m0_be_seg * cas_seg ( struct m0_be_domain dom)
static

Definition at line 199 of file ctg_store.c.

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

◆ ctg_beop()

static struct m0_be_op* ctg_beop ( struct m0_ctg_op ctg_op)
static

Definition at line 208 of file ctg_store.c.

Here is the caller graph for this function:

◆ ctg_berc()

static int ctg_berc ( struct m0_ctg_op ctg_op)
static

Definition at line 214 of file ctg_store.c.

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

◆ ctg_cmp()

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

Definition at line 395 of file ctg_store.c.

◆ ctg_ctidx_op_credits()

static void ctg_ctidx_op_credits ( struct m0_cas_id cid,
bool  insert,
struct m0_be_tx_credit accum 
)
static

Definition at line 1930 of file ctg_store.c.

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

◆ ctg_destroy()

static void ctg_destroy ( struct m0_cas_ctg ctg,
struct m0_be_tx tx 
)
static

Definition at line 471 of file ctg_store.c.

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

◆ ctg_exec()

static int ctg_exec ( struct m0_ctg_op ctg_op,
struct m0_cas_ctg ctg,
const struct m0_buf key,
int  next_phase 
)
static

Definition at line 1418 of file ctg_store.c.

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

◆ ctg_fini()

static void ctg_fini ( struct m0_cas_ctg ctg)
static

Definition at line 431 of file ctg_store.c.

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

◆ ctg_index_btree_dump()

M0_INTERNAL int ctg_index_btree_dump ( struct m0_motr motr_ctx,
struct m0_cas_ctg ctg,
bool  dump_in_hex 
)

Definition at line 2212 of file ctg_store.c.

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

◆ ctg_index_btree_dump_one_rec()

M0_INTERNAL void ctg_index_btree_dump_one_rec ( struct m0_buf key,
struct m0_buf val,
bool  dump_in_hex 
)

Definition at line 2180 of file ctg_store.c.

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

◆ ctg_init()

static void ctg_init ( struct m0_cas_ctg ctg,
struct m0_be_seg seg 
)
static

Definition at line 415 of file ctg_store.c.

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

◆ ctg_is_ordinary()

static bool ctg_is_ordinary ( const struct m0_cas_ctg ctg)
static

Checks whether catalogue is a user catalogue (not meta).

Definition at line 969 of file ctg_store.c.

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

◆ ctg_kbuf_get()

static int ctg_kbuf_get ( struct m0_buf dst,
const struct m0_buf src,
bool  enabled_fi 
)
static

Allocates memory for dst buf and fills it with CAS-specific data and length from src buf.

Definition at line 251 of file ctg_store.c.

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

◆ ctg_kbuf_unpack()

static int ctg_kbuf_unpack ( struct m0_buf buf)
static

Convert a versioned variable length buffer (on-disk data) into user-specific data (see generic_key::gk_data).

Definition at line 342 of file ctg_store.c.

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

◆ ctg_ksize()

static m0_bcount_t ctg_ksize ( const void *  key)
static

Definition at line 383 of file ctg_store.c.

◆ ctg_mem_exec()

static int ctg_mem_exec ( struct m0_ctg_op ctg_op,
int  next_phase 
)
static

Definition at line 1441 of file ctg_store.c.

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

◆ ctg_mem_op_exec()

static int ctg_mem_op_exec ( struct m0_ctg_op ctg_op,
int  next_phase 
)
static

Definition at line 1290 of file ctg_store.c.

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

◆ ctg_meta_delete()

static void ctg_meta_delete ( struct m0_be_btree meta,
const struct m0_fid fid,
struct m0_be_tx tx 
)
static

Definition at line 570 of file ctg_store.c.

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

◆ ctg_meta_delete_credit()

static void ctg_meta_delete_credit ( struct m0_be_btree bt,
m0_bcount_t  nr,
struct m0_be_tx_credit accum 
)
static

Definition at line 603 of file ctg_store.c.

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

◆ ctg_meta_exec()

static int ctg_meta_exec ( struct m0_ctg_op ctg_op,
const struct m0_fid fid,
int  next_phase 
)
static

Definition at line 1311 of file ctg_store.c.

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

◆ ctg_meta_insert_credit()

static void ctg_meta_insert_credit ( struct m0_be_btree bt,
m0_bcount_t  nr,
struct m0_be_tx_credit accum 
)
static

Definition at line 586 of file ctg_store.c.

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

◆ ctg_meta_selfadd()

static int ctg_meta_selfadd ( struct m0_be_btree meta,
struct m0_be_tx tx 
)
static

Definition at line 564 of file ctg_store.c.

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

◆ ctg_meta_selfrm()

static void ctg_meta_selfrm ( struct m0_be_btree meta,
struct m0_be_tx tx 
)
static

Definition at line 581 of file ctg_store.c.

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

◆ ctg_op_cb()

static bool ctg_op_cb ( struct m0_clink clink)
static

Definition at line 975 of file ctg_store.c.

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

◆ ctg_op_exec()

static int ctg_op_exec ( struct m0_ctg_op ctg_op,
int  next_phase 
)
static

Definition at line 1280 of file ctg_store.c.

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

◆ ctg_op_exec_normal()

static int ctg_op_exec_normal ( struct m0_ctg_op ctg_op,
int  next_phase 
)
static

Definition at line 1143 of file ctg_store.c.

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

◆ ctg_op_exec_versioned()

static int ctg_op_exec_versioned ( struct m0_ctg_op ctg_op,
int  next_phase 
)
static

Definition at line 1214 of file ctg_store.c.

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

◆ ctg_op_is_versioned()

static bool ctg_op_is_versioned ( const struct m0_ctg_op op)
static

Definition at line 2291 of file ctg_store.c.

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

◆ ctg_op_tick_ret()

static int ctg_op_tick_ret ( struct m0_ctg_op ctg_op,
int  next_state 
)
static

Definition at line 1095 of file ctg_store.c.

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

◆ ctg_op_version_get()

static void ctg_op_version_get ( const struct m0_ctg_op ctg_op,
struct m0_crv out 
)
static

Definition at line 2347 of file ctg_store.c.

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

◆ ctg_op_zones()

static uint32_t ctg_op_zones ( const struct m0_ctg_op ctg_op)
static

Definition at line 1137 of file ctg_store.c.

Here is the caller graph for this function:

◆ ctg_state_counter_add()

static void ctg_state_counter_add ( uint64_t *  counter,
uint64_t  val 
)
static

Definition at line 876 of file ctg_store.c.

Here is the caller graph for this function:

◆ ctg_state_counter_sub()

static void ctg_state_counter_sub ( uint64_t *  counter,
uint64_t  val 
)
static

Definition at line 890 of file ctg_store.c.

Here is the caller graph for this function:

◆ ctg_state_create()

static int ctg_state_create ( struct m0_be_seg seg,
struct m0_be_tx tx,
struct m0_cas_state **  state 
)
static

Definition at line 649 of file ctg_store.c.

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

◆ ctg_state_dec_update()

static void ctg_state_dec_update ( struct m0_be_tx tx,
uint64_t  size 
)
static

Definition at line 945 of file ctg_store.c.

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

◆ ctg_state_destroy()

static void ctg_state_destroy ( struct m0_cas_state state,
struct m0_be_tx tx 
)
static

Definition at line 681 of file ctg_store.c.

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

◆ ctg_state_update()

static uint64_t ctg_state_update ( struct m0_be_tx tx,
uint64_t  size,
bool  is_inc 
)
static

Definition at line 898 of file ctg_store.c.

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

◆ ctg_store__init()

static int ctg_store__init ( struct m0_be_seg seg,
struct m0_cas_state state 
)
static

Initialisation function when catalogue store state was found on a disk.

Definition at line 695 of file ctg_store.c.

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

◆ ctg_store_create()

static int ctg_store_create ( struct m0_be_seg seg)
static

Initialisation function when catalogue store state was not found on a disk.

It creates all necessary data in BE segment and initialises catalogue store.

Definition at line 725 of file ctg_store.c.

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

◆ ctg_store_init_creds_calc()

static void ctg_store_init_creds_calc ( struct m0_be_seg seg,
struct m0_cas_state state,
struct m0_cas_ctg ctidx,
struct m0_be_tx_credit cred 
)
static

Definition at line 617 of file ctg_store.c.

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

◆ ctg_store_release()

static void ctg_store_release ( struct m0_ref ref)
static

Definition at line 858 of file ctg_store.c.

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

◆ ctg_vbuf_as_ctg()

static int ctg_vbuf_as_ctg ( const struct m0_buf buf,
struct m0_cas_ctg **  ctg 
)
static

Get a m0_cas_ctg pointer from in-memory representation of a meta-index value.

Definition at line 306 of file ctg_store.c.

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

◆ ctg_vbuf_as_layout()

static int ctg_vbuf_as_layout ( const struct m0_buf buf,
struct m0_dix_layout **  layout 
)
static

Get the layout from an unpacked layout_value (cctidx value).

Definition at line 323 of file ctg_store.c.

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

◆ ctg_vbuf_pack()

static void ctg_vbuf_pack ( struct m0_buf dst,
const struct m0_buf src,
const struct m0_crv crv 
)
static

Packs a user-provided value into on-disk representation.

Parameters
srcA value to be packed (in-memory representation).
dstA buffer to be filled with user data and on-disk format-specific information.
crvEncoded version of the value.

Definition at line 235 of file ctg_store.c.

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

◆ ctg_vbuf_packed_size()

static m0_bcount_t ctg_vbuf_packed_size ( const struct m0_buf value)
static

Returns the number of bytes required to store the given "value" in on-disk format.

Definition at line 223 of file ctg_store.c.

Here is the caller graph for this function:

◆ ctg_vbuf_unpack()

static int ctg_vbuf_unpack ( struct m0_buf buf,
struct m0_crv crv 
)
static

Unpack an on-disk value data into in-memory format. The function makes "buf" to point to the user-specific data associated with the value (see generic_value::gv_data).

Parameters
[out]crvOptional storage for the version of the record.
Returns
0 or else -EPROTO if on-disk/on-wire buffer has invalid length.
See also
ctg_vbuf_pack.

Definition at line 279 of file ctg_store.c.

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

◆ ctg_vsize()

static m0_bcount_t ctg_vsize ( const void *  val)
static

Definition at line 389 of file ctg_store.c.

◆ M0_BASSERT() [1/6]

M0_BASSERT ( sizeof(struct generic_key = =M0_CAS_CTG_KEY_HDR_SIZE)

◆ M0_BASSERT() [2/6]

M0_BASSERT ( sizeof(struct generic_value = =M0_CAS_CTG_VAL_HDR_SIZE)

◆ M0_BASSERT() [3/6]

M0_BASSERT ( sizeof(struct m0_crv = =8)

◆ M0_BASSERT() [4/6]

M0_BASSERT ( sizeof(struct generic_key)+sizeof(struct m0_fid = =sizeof(struct fid_key))

◆ M0_BASSERT() [5/6]

M0_BASSERT ( sizeof(struct generic_value)+sizeof(struct m0_cas_ctg *)  = =sizeof(struct meta_value))

◆ M0_BASSERT() [6/6]

M0_BASSERT ( sizeof(struct generic_value)+sizeof(struct m0_dix_layout = =sizeof(struct layout_value))

◆ versioned_cursor_get_sync()

static int versioned_cursor_get_sync ( struct m0_ctg_op op,
bool  alive_only 
)
static

Definition at line 2537 of file ctg_store.c.

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

◆ versioned_cursor_next_sync()

static int versioned_cursor_next_sync ( struct m0_ctg_op op,
bool  alive_only 
)
static

Definition at line 2491 of file ctg_store.c.

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

◆ versioned_get_sync()

static int versioned_get_sync ( struct m0_ctg_op op)
static

Definition at line 2460 of file ctg_store.c.

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

◆ versioned_put_sync()

static int versioned_put_sync ( struct m0_ctg_op ctg_op)
static

Definition at line 2381 of file ctg_store.c.

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

Variable Documentation

◆ cas_btree_ops

static const struct m0_be_btree_kv_ops cas_btree_ops
static
Initial value:
= {
.ko_type = M0_BBT_CAS_CTG,
.ko_ksize = &ctg_ksize,
.ko_vsize = &ctg_vsize,
.ko_compare = &ctg_cmp
}
static m0_bcount_t ctg_ksize(const void *key)
Definition: ctg_store.c:383
static int ctg_cmp(const void *key0, const void *key1)
Definition: ctg_store.c:395
static m0_bcount_t ctg_vsize(const void *val)
Definition: ctg_store.c:389

XXX: The following static structures should be either moved to m0 instance to show them to everyone or be a part of high-level context structure.

Definition at line 195 of file ctg_store.c.

◆ cas_state_key

const char cas_state_key[] = "cas-state-nr"
static

Definition at line 197 of file ctg_store.c.

◆ cs_init_guard

struct m0_mutex cs_init_guard = M0_MUTEX_SINIT(&cs_init_guard)
static

Mutex to provide thread-safety for catalogue store singleton initialisation.

Definition at line 189 of file ctg_store.c.

◆ ctg_store

struct m0_ctg_store ctg_store = {}
static

Definition at line 196 of file ctg_store.c.