Motr  M0
service.c File Reference
#include "be/op.h"
#include "be/tx_credit.h"
#include "be/dtm0_log.h"
#include "dtm0/fop.h"
#include "dtm0/service.h"
#include "lib/trace.h"
#include "lib/memory.h"
#include "lib/finject.h"
#include "lib/assert.h"
#include "lib/arith.h"
#include "lib/misc.h"
#include "lib/errno.h"
#include "lib/ext.h"
#include "fop/fom_long_lock.h"
#include "fop/fom_generic.h"
#include "fop/fom_interpose.h"
#include "reqh/reqh_service.h"
#include "reqh/reqh.h"
#include "rpc/rpc_opcodes.h"
#include "rpc/rpc_machine.h"
#include "conf/schema.h"
#include "module/instance.h"
#include "addb2/addb2.h"
#include "cas/ctg_store.h"
#include "pool/pool.h"
#include "dix/cm/cm.h"
#include "dix/fid_convert.h"
#include "cas/cas_addb2.h"
#include "cas/cas.h"
#include "cas/cas_xc.h"
#include "cas/index_gc.h"
#include "motr/setup.h"
Include dependency graph for service.c:

Go to the source code of this file.

Data Structures

struct  cas_service
 
struct  cas_kv
 
struct  cas_fom
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS
 
#define LAYOUT_IMASK_PTR(l)   (&(l)->u.dl_desc.ld_imask)
 
#define CID_IMASK_PTR(cid)   LAYOUT_IMASK_PTR(&(cid)->ci_layout)
 
enum  stats_kv { STATS_KEY, STATS_VAL, STATS_KV_NR }
 
enum  stats_kv_io { STATS_KV_IN, STATS_KV_OUT, STATS_KV_IO_NR }
 
enum  { STATS_NR_INLINE, STATS_NR_BULK, STATS_SIZE, STATS_NR }
 
enum  cas_fom_phase {
  CAS_TXN_OPENED = M0_FOPH_TYPE_SPECIFIC, CAS_META_UNLOCK, CAS_LOOP, CAS_DONE,
  CAS_CHECK_PRE, CAS_CHECK, CAS_START, CAS_META_LOCK,
  CAS_META_LOOKUP, CAS_META_LOOKUP_DONE, CAS_CTG_CROW_DONE, CAS_LOCK,
  CAS_CTIDX_LOCK, CAS_CTIDX, CAS_CTIDX_INSERT, CAS_CTIDX_LOOKUP,
  CAS_CTIDX_DELETE, CAS_CTIDX_MEM_PLACE, CAS_CTIDX_MEM_FREE, CAS_PREP,
  CAS_LOAD_KEY, CAS_LOAD_VAL, CAS_LOAD_DONE, CAS_PREPARE_SEND,
  CAS_SEND_KEY, CAS_KEY_SENT, CAS_SEND_VAL, CAS_VAL_SENT,
  CAS_DEAD_INDEX_LOCK, CAS_INSERT_TO_DEAD, CAS_DELETE_FROM_META, CAS_IDROP_LOOP,
  CAS_IDROP_LOCK_LOOP, CAS_IDROP_LOCKED, CAS_IDROP_START_GC, CAS_DTM0,
  CAS_NR
}
 
static const struct m0_reqh_service_ops cas_service_ops
 
static const struct m0_reqh_service_type_ops cas_service_type_ops
 
static const struct m0_fom_ops cas_fom_ops
 
static const struct m0_fom_type_ops cas_fom_type_ops
 
static struct m0_sm_conf cas_sm_conf
 
static struct m0_sm_state_descr cas_fom_phases []
 
M0_INTERNAL void(* cas__ut_cb_done )(struct m0_fom *fom)
 
M0_INTERNAL void(* cas__ut_cb_fini )(struct m0_fom *fom)
 
struct m0_sm_trans_descr cas_fom_trans []
 
M0_INTERNAL struct m0_reqh_service_type m0_cas_service_type
 
 M0_BASSERT (M0_CAS_GET_FOP_OPCODE==CO_GET+M0_CAS_GET_FOP_OPCODE)
 
 M0_BASSERT (M0_CAS_PUT_FOP_OPCODE==CO_PUT+M0_CAS_GET_FOP_OPCODE)
 
 M0_BASSERT (M0_CAS_DEL_FOP_OPCODE==CO_DEL+M0_CAS_GET_FOP_OPCODE)
 
 M0_BASSERT (M0_CAS_CUR_FOP_OPCODE==CO_CUR+M0_CAS_GET_FOP_OPCODE)
 
 M0_BASSERT (M0_CAS_REP_FOP_OPCODE==CO_REP+M0_CAS_GET_FOP_OPCODE)
 
static int cas_service_start (struct m0_reqh_service *service)
 
static void cas_service_stop (struct m0_reqh_service *service)
 
static void cas_service_fini (struct m0_reqh_service *service)
 
static size_t cas_fom_home_locality (const struct m0_fom *fom)
 
static int cas_service_type_allocate (struct m0_reqh_service **service, const struct m0_reqh_service_type *st)
 
static struct m0_cas_opcas_op (const struct m0_fom *fom)
 
static const struct m0_fidcas_fid (const struct m0_fom *fom)
 
static enum m0_cas_type cas_type (const struct m0_fom *fom)
 
static struct m0_cas_reccas_at (struct m0_cas_op *op, int idx)
 
static struct m0_cas_reccas_out_at (const struct m0_cas_rep *rep, int idx)
 
static bool cas_is_ro (enum m0_cas_opcode opc)
 
static enum m0_cas_opcode m0_cas_opcode (const struct m0_fop *fop)
 
static uint64_t cas_in_nr (const struct m0_fop *fop)
 
static uint64_t cas_out_nr (const struct m0_fop *fop)
 
static void cas_prep (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, struct m0_cas_ctg *ctg, uint64_t rec_pos, struct m0_be_tx_credit *accum)
 
static int cas_exec (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, struct m0_cas_ctg *ctg, uint64_t rec_pos, int next)
 
static int cas_done (struct cas_fom *fom, struct m0_cas_op *op, struct m0_cas_rep *rep, enum m0_cas_opcode opc)
 
static bool cas_ctidx_op_needed (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, uint64_t rec_pos)
 
static bool cas_key_need_to_send (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, struct m0_cas_op *op, uint64_t rec_pos)
 
static int cas_prep_send (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct)
 
static bool cas_is_valid (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, const struct m0_cas_rec *rec, uint64_t rec_pos)
 
static int cas_op_recs_check (struct cas_fom *fom, enum m0_cas_opcode opc, enum m0_cas_type ct, struct m0_cas_op *op)
 
static bool cas_fom_invariant (const struct cas_fom *fom)
 
static int cas_buf_cid_decode (struct m0_buf *enc_buf, struct m0_cas_id *cid)
 
static bool cas_fid_is_cctg (const struct m0_fid *fid)
 
static int cas_id_check (const struct m0_cas_id *cid)
 
static int cas_device_check (const struct cas_fom *fom, const struct m0_cas_id *cid)
 
static int cas_op_check (struct m0_cas_op *op, struct cas_fom *fom, bool is_index_drop)
 
static void cas_incoming_kv (const struct cas_fom *fom, uint64_t rec_pos, struct m0_buf *key, struct m0_buf *val)
 
static int cas_incoming_kv_setup (struct cas_fom *fom, const struct m0_cas_op *op)
 
static int cas_kv_load_done (struct cas_fom *fom, enum m0_cas_opcode opc, const struct m0_cas_op *op, int phase)
 
static int cas_ctg_crow_handle (struct cas_fom *fom, const struct m0_cas_id *cid)
 
static int cas_ctidx_mem_place (struct cas_fom *fom, const struct m0_cas_id *in_cid, int next)
 
static int cas_ctidx_mem_free (struct cas_fom *fom, int next)
 
static int cas_ctidx_insert (struct cas_fom *fom, const struct m0_cas_id *in_cid, int next)
 
static int cas_ctidx_lookup (struct cas_fom *fom, const struct m0_cas_id *in_cid, int next)
 
static int cas_ctidx_delete (struct cas_fom *fom, const struct m0_cas_id *in_cid, int next)
 
M0_INTERNAL void m0_cas_svc_init (void)
 
M0_INTERNAL void m0_cas_svc_fini (void)
 
M0_INTERNAL void m0_cas_svc_fop_args (struct m0_sm_conf **sm_conf, const struct m0_fom_type_ops **fom_ops, struct m0_reqh_service_type **svctype)
 
M0_INTERNAL void m0_cas__ut_svc_be_set (struct m0_reqh_service *svc, struct m0_be_domain *dom)
 
M0_INTERNAL struct m0_be_domainm0_cas__ut_svc_be_get (struct m0_reqh_service *svc)
 
static void cas_service_prepare_to_stop (struct m0_reqh_service *svc)
 
static bool cas_service_started (struct m0_fop *fop, struct m0_reqh *reqh)
 
static int cas_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static int cas_at_load (struct m0_rpc_at_buf *ab, struct m0_fom *fom, int next_phase)
 
static int cas_at_reply (struct m0_rpc_at_buf *in, struct m0_rpc_at_buf *out, struct m0_buf *repbuf, struct m0_fom *fom, int next_phase)
 
static void cas_at_fini (struct m0_rpc_at_buf *ab)
 
static void cas_update_kv_stats (struct cas_fom *fom, const struct m0_rpc_at_buf *ab, m0_bcount_t nob, enum stats_kv kv, enum stats_kv_io kv_io)
 
static struct m0_rpc_at_bufcas_out_complementary (enum m0_cas_opcode opc, const struct m0_cas_op *op, bool key, size_t opos)
 
static int cas_key_send (struct cas_fom *fom, const struct m0_cas_op *op, enum m0_cas_opcode opc, const struct m0_cas_rep *rep, enum cas_fom_phase next_phase)
 
static int cas_val_send (struct cas_fom *fom, const struct m0_cas_op *op, enum m0_cas_opcode opc, const struct m0_cas_rep *rep, enum cas_fom_phase next_phase)
 
static bool cas_max_reply_payload_exceeded (struct cas_fom *fom)
 
static void cas_fom_cleanup (struct cas_fom *fom, bool ctg_op_fini)
 
static void cas_fom_failure (struct cas_fom *fom, int rc, bool ctg_op_fini)
 
static int cas_dtm0_logrec_credit_add (struct m0_fom *fom0)
 
static int cas_dtm0_logrec_add (struct m0_fom *fom0, enum m0_dtm0_tx_pa_state state)
 
static void cas_fom_success (struct cas_fom *fom, enum m0_cas_opcode opc)
 
static void addb2_add_kv_attrs (const struct cas_fom *fom, enum stats_kv_io kv_io)
 
static bool op_is_index_drop (enum m0_cas_opcode opc, enum m0_cas_type ct)
 
static int op_sync_wait (struct m0_fom *fom)
 
static int cas_fom_tick (struct m0_fom *fom0)
 
static void cas_fom_fini (struct m0_fom *fom0)
 
static int cas_sdev_state (struct m0_poolmach *pm, uint32_t sdev_idx, enum m0_pool_nd_state *state_out)
 
static int cas_place (struct m0_buf *dst, struct m0_buf *src, m0_bcount_t cutoff)
 
static m0_bcount_t cas_kv_nob (const struct m0_buf *inbuf)
 
static m0_bcount_t cas_rpc_cutoff (const struct cas_fom *fom)
 
static int cas_ctg_crow_fop_buf_prepare (const struct m0_cas_id *cid, struct m0_rpc_at_buf *at_buf)
 
static int cas_ctg_crow_fop_create (const struct m0_cas_id *cid, struct m0_fop **out)
 
static void cas_ctg_crow_done_cb (struct m0_fom_thralldom *thrall, struct m0_fom *serf)
 
static void cas_addb2_fom_to_crow_fom (const struct m0_fom *fom0, const struct m0_fom *crow_fom0)
 
M0_INTERNAL int m0_cas_fom_spawn (struct m0_fom *lead, struct m0_fom_thralldom *thrall, struct m0_fop *cas_fop, void(*on_fom_complete)(struct m0_fom_thralldom *, struct m0_fom *))
 
static void cas_fom_addb2_descr (struct m0_fom *fom)
 

Macro Definition Documentation

◆ CID_IMASK_PTR

#define CID_IMASK_PTR (   cid)    LAYOUT_IMASK_PTR(&(cid)->ci_layout)

Definition at line 425 of file service.c.

◆ LAYOUT_IMASK_PTR

#define LAYOUT_IMASK_PTR (   l)    (&(l)->u.dl_desc.ld_imask)

Definition at line 424 of file service.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CAS

Definition at line 23 of file service.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
STATS_NR_INLINE 
STATS_NR_BULK 
STATS_SIZE 
STATS_NR 

Definition at line 304 of file service.c.

◆ cas_fom_phase

Enumerator
CAS_TXN_OPENED 
CAS_META_UNLOCK 
CAS_LOOP 
CAS_DONE 
CAS_CHECK_PRE 
CAS_CHECK 
CAS_START 
CAS_META_LOCK 
CAS_META_LOOKUP 
CAS_META_LOOKUP_DONE 
CAS_CTG_CROW_DONE 
CAS_LOCK 
CAS_CTIDX_LOCK 
CAS_CTIDX 
CAS_CTIDX_INSERT 
CAS_CTIDX_LOOKUP 
CAS_CTIDX_DELETE 
CAS_CTIDX_MEM_PLACE 
CAS_CTIDX_MEM_FREE 
CAS_PREP 
CAS_LOAD_KEY 
CAS_LOAD_VAL 
CAS_LOAD_DONE 
CAS_PREPARE_SEND 
CAS_SEND_KEY 
CAS_KEY_SENT 
CAS_SEND_VAL 
CAS_VAL_SENT 
CAS_DEAD_INDEX_LOCK 
CAS_INSERT_TO_DEAD 
CAS_DELETE_FROM_META 
CAS_IDROP_LOOP 
CAS_IDROP_LOCK_LOOP 
CAS_IDROP_LOCKED 
CAS_IDROP_START_GC 
CAS_DTM0 
CAS_NR 

Definition at line 376 of file service.c.

◆ stats_kv

enum stats_kv
Enumerator
STATS_KEY 
STATS_VAL 
STATS_KV_NR 

Definition at line 292 of file service.c.

◆ stats_kv_io

Enumerator
STATS_KV_IN 
STATS_KV_OUT 
STATS_KV_IO_NR 

Definition at line 298 of file service.c.

Function Documentation

◆ addb2_add_kv_attrs()

static void addb2_add_kv_attrs ( const struct cas_fom fom,
enum stats_kv_io  kv_io 
)
static

Definition at line 1081 of file service.c.

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

◆ cas_addb2_fom_to_crow_fom()

static void cas_addb2_fom_to_crow_fom ( const struct m0_fom fom0,
const struct m0_fom crow_fom0 
)
static

Definition at line 2561 of file service.c.

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

◆ cas_at()

static struct m0_cas_rec * cas_at ( struct m0_cas_op op,
int  idx 
)
static

Definition at line 2121 of file service.c.

Here is the caller graph for this function:

◆ cas_at_fini()

static void cas_at_fini ( struct m0_rpc_at_buf ab)
static

Definition at line 732 of file service.c.

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

◆ cas_at_load()

static int cas_at_load ( struct m0_rpc_at_buf ab,
struct m0_fom fom,
int  next_phase 
)
static

Definition at line 705 of file service.c.

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

◆ cas_at_reply()

static int cas_at_reply ( struct m0_rpc_at_buf in,
struct m0_rpc_at_buf out,
struct m0_buf repbuf,
struct m0_fom fom,
int  next_phase 
)
static

Definition at line 716 of file service.c.

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

◆ cas_buf_cid_decode()

static int cas_buf_cid_decode ( struct m0_buf enc_buf,
struct m0_cas_id cid 
)
static

Definition at line 2021 of file service.c.

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

◆ cas_ctg_crow_done_cb()

static void cas_ctg_crow_done_cb ( struct m0_fom_thralldom thrall,
struct m0_fom serf 
)
static

Definition at line 2540 of file service.c.

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

◆ cas_ctg_crow_fop_buf_prepare()

static int cas_ctg_crow_fop_buf_prepare ( const struct m0_cas_id cid,
struct m0_rpc_at_buf at_buf 
)
static

Definition at line 2487 of file service.c.

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

◆ cas_ctg_crow_fop_create()

static int cas_ctg_crow_fop_create ( const struct m0_cas_id cid,
struct m0_fop **  out 
)
static

Definition at line 2507 of file service.c.

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

◆ cas_ctg_crow_handle()

static int cas_ctg_crow_handle ( struct cas_fom fom,
const struct m0_cas_id cid 
)
static

Definition at line 2605 of file service.c.

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

◆ cas_ctidx_delete()

static int cas_ctidx_delete ( struct cas_fom fom,
const struct m0_cas_id in_cid,
int  next 
)
static

Definition at line 2315 of file service.c.

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

◆ cas_ctidx_insert()

static int cas_ctidx_insert ( struct cas_fom fom,
const struct m0_cas_id in_cid,
int  next 
)
static

Definition at line 2347 of file service.c.

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

◆ cas_ctidx_lookup()

static int cas_ctidx_lookup ( struct cas_fom fom,
const struct m0_cas_id in_cid,
int  next 
)
static

Definition at line 2334 of file service.c.

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

◆ cas_ctidx_mem_free()

static int cas_ctidx_mem_free ( struct cas_fom fom,
int  next 
)
static

Definition at line 2285 of file service.c.

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

◆ cas_ctidx_mem_place()

static int cas_ctidx_mem_place ( struct cas_fom fom,
const struct m0_cas_id in_cid,
int  next 
)
static

Definition at line 2263 of file service.c.

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

◆ cas_ctidx_op_needed()

static bool cas_ctidx_op_needed ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
uint64_t  rec_pos 
)
static

Definition at line 2243 of file service.c.

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

◆ cas_device_check()

static int cas_device_check ( const struct cas_fom fom,
const struct m0_cas_id cid 
)
static

Checks that device where a component catalogue with a given cid resides is available (online or rebalancing).

Client should send requests against catalogues which are available. DIX degraded mode logic is responsible to guarantee this.

Definition at line 1803 of file service.c.

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

◆ cas_done()

static int cas_done ( struct cas_fom fom,
struct m0_cas_op op,
struct m0_cas_rep rep,
enum m0_cas_opcode  opc 
)
static

Definition at line 2427 of file service.c.

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

◆ cas_dtm0_logrec_add()

static int cas_dtm0_logrec_add ( struct m0_fom fom0,
enum m0_dtm0_tx_pa_state  state 
)
static

Definition at line 1048 of file service.c.

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

◆ cas_dtm0_logrec_credit_add()

static int cas_dtm0_logrec_credit_add ( struct m0_fom fom0)
static

Definition at line 1023 of file service.c.

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

◆ cas_exec()

static int cas_exec ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
struct m0_cas_ctg ctg,
uint64_t  rec_pos,
int  next 
)
static

Definition at line 2153 of file service.c.

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

◆ cas_fid()

static const struct m0_fid * cas_fid ( const struct m0_fom fom)
static

Definition at line 1749 of file service.c.

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

◆ cas_fid_is_cctg()

static bool cas_fid_is_cctg ( const struct m0_fid fid)
static

Definition at line 2034 of file service.c.

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

◆ cas_fom_addb2_descr()

static void cas_fom_addb2_descr ( struct m0_fom fom)
static

Definition at line 2635 of file service.c.

Here is the call graph for this function:

◆ cas_fom_cleanup()

static void cas_fom_cleanup ( struct cas_fom fom,
bool  ctg_op_fini 
)
static

Definition at line 976 of file service.c.

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

◆ cas_fom_create()

static int cas_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static
Todo:
Validity (cas_is_valid()) of input records is not checked here, so "out_nr" can be bogus. Cannot check validity at this point, because ->fto_create() errors are silently ignored.

In case out_nr is 0, M0_ALLOC_ARR returns non-NULL pointer. Two cases should be distinguished:

  • allocate operation has failed and repv is NULL;
  • out_nr == 0 and repv is NULL; The second one is a correct case.

Definition at line 634 of file service.c.

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

◆ cas_fom_failure()

static void cas_fom_failure ( struct cas_fom fom,
int  rc,
bool  ctg_op_fini 
)
static

Definition at line 996 of file service.c.

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

◆ cas_fom_fini()

static void cas_fom_fini ( struct m0_fom fom0)
static

Definition at line 1715 of file service.c.

Here is the call graph for this function:

◆ cas_fom_home_locality()

static size_t cas_fom_home_locality ( const struct m0_fom fom)
static

Definition at line 1754 of file service.c.

◆ cas_fom_invariant()

static bool cas_fom_invariant ( const struct cas_fom fom)
static

Definition at line 2622 of file service.c.

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

◆ cas_fom_success()

static void cas_fom_success ( struct cas_fom fom,
enum m0_cas_opcode  opc 
)
static

Definition at line 1075 of file service.c.

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

◆ cas_fom_tick()

static int cas_fom_tick ( struct m0_fom fom0)
static

Definition at line 1160 of file service.c.

◆ cas_id_check()

static int cas_id_check ( const struct m0_cas_id cid)
static

Definition at line 1835 of file service.c.

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

◆ cas_in_nr()

static uint64_t cas_in_nr ( const struct m0_fop fop)
static

Definition at line 2003 of file service.c.

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

◆ cas_incoming_kv()

static void cas_incoming_kv ( const struct cas_fom fom,
uint64_t  rec_pos,
struct m0_buf key,
struct m0_buf val 
)
static

Definition at line 742 of file service.c.

Here is the caller graph for this function:

◆ cas_incoming_kv_setup()

static int cas_incoming_kv_setup ( struct cas_fom fom,
const struct m0_cas_op op 
)
static

Definition at line 766 of file service.c.

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

◆ cas_is_ro()

static bool cas_is_ro ( enum m0_cas_opcode  opc)
static

Definition at line 1990 of file service.c.

Here is the caller graph for this function:

◆ cas_is_valid()

static bool cas_is_valid ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
const struct m0_cas_rec rec,
uint64_t  rec_pos 
)
static

Definition at line 1916 of file service.c.

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

◆ cas_key_need_to_send()

static bool cas_key_need_to_send ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
struct m0_cas_op op,
uint64_t  rec_pos 
)
static

Definition at line 939 of file service.c.

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

◆ cas_key_send()

static int cas_key_send ( struct cas_fom fom,
const struct m0_cas_op op,
enum m0_cas_opcode  opc,
const struct m0_cas_rep rep,
enum cas_fom_phase  next_phase 
)
static

Fills outgoing key AT buffer for current outgoing record in processing.

The key buffer usually is not sent over network right here, but just included into outgoing FOP. If the key is too big to fit into the FOP, then 'inbulk' AT transmission method comes to play. See cas_at_reply() for more info.

Current outgoing record in the outgoing FOP is identified by fom->cf_opos index.

Definition at line 858 of file service.c.

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

◆ cas_kv_load_done()

static int cas_kv_load_done ( struct cas_fom fom,
enum m0_cas_opcode  opc,
const struct m0_cas_op op,
int  phase 
)
static

Definition at line 2133 of file service.c.

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

◆ cas_kv_nob()

static m0_bcount_t cas_kv_nob ( const struct m0_buf inbuf)
static

Returns number of bytes required for key/value stored in btree given user-supplied key/value buffer.

Key/value stored in btree have first 8 bytes defining length and successive bytes storing key/value.

Definition at line 2066 of file service.c.

Here is the caller graph for this function:

◆ cas_max_reply_payload_exceeded()

static bool cas_max_reply_payload_exceeded ( struct cas_fom fom)
static

Definition at line 922 of file service.c.

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

◆ cas_op()

static struct m0_cas_op * cas_op ( const struct m0_fom fom)
static

Definition at line 1761 of file service.c.

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

◆ cas_op_check()

static int cas_op_check ( struct m0_cas_op op,
struct cas_fom fom,
bool  is_index_drop 
)
static

Definition at line 1853 of file service.c.

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

◆ cas_op_recs_check()

static int cas_op_recs_check ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
struct m0_cas_op op 
)
static

Definition at line 907 of file service.c.

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

◆ cas_out_at()

static struct m0_cas_rec * cas_out_at ( const struct m0_cas_rep rep,
int  idx 
)
static

Definition at line 2127 of file service.c.

Here is the caller graph for this function:

◆ cas_out_complementary()

static struct m0_rpc_at_buf* cas_out_complementary ( enum m0_cas_opcode  opc,
const struct m0_cas_op op,
bool  key,
size_t  opos 
)
static

Returns AT buffer from client request that is used to transmit key/value from server.

Definition at line 805 of file service.c.

Here is the caller graph for this function:

◆ cas_out_nr()

static uint64_t cas_out_nr ( const struct m0_fop fop)
static

Definition at line 2010 of file service.c.

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

◆ cas_place()

static int cas_place ( struct m0_buf dst,
struct m0_buf src,
m0_bcount_t  cutoff 
)
static

Definition at line 2040 of file service.c.

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

◆ cas_prep()

static void cas_prep ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct,
struct m0_cas_ctg ctg,
uint64_t  rec_pos,
struct m0_be_tx_credit accum 
)
static

Definition at line 2071 of file service.c.

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

◆ cas_prep_send()

static int cas_prep_send ( struct cas_fom fom,
enum m0_cas_opcode  opc,
enum m0_cas_type  ct 
)
static

Definition at line 2393 of file service.c.

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

◆ cas_rpc_cutoff()

static m0_bcount_t cas_rpc_cutoff ( const struct cas_fom fom)
static

Definition at line 2387 of file service.c.

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

◆ cas_sdev_state()

static int cas_sdev_state ( struct m0_poolmach pm,
uint32_t  sdev_idx,
enum m0_pool_nd_state state_out 
)
static

Definition at line 1775 of file service.c.

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

◆ cas_service_fini()

static void cas_service_fini ( struct m0_reqh_service service)
static

Definition at line 595 of file service.c.

Here is the call graph for this function:

◆ cas_service_prepare_to_stop()

static void cas_service_prepare_to_stop ( struct m0_reqh_service svc)
static

Definition at line 583 of file service.c.

Here is the call graph for this function:

◆ cas_service_start()

static int cas_service_start ( struct m0_reqh_service service)
static

Definition at line 560 of file service.c.

Here is the call graph for this function:

◆ cas_service_started()

static bool cas_service_started ( struct m0_fop fop,
struct m0_reqh reqh 
)
static

Definition at line 619 of file service.c.

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

◆ cas_service_stop()

static void cas_service_stop ( struct m0_reqh_service service)
static

Definition at line 589 of file service.c.

Here is the call graph for this function:

◆ cas_service_type_allocate()

static int cas_service_type_allocate ( struct m0_reqh_service **  service,
const struct m0_reqh_service_type st 
)
static

Definition at line 604 of file service.c.

Here is the call graph for this function:

◆ cas_type()

static enum m0_cas_type cas_type ( const struct m0_fom fom)
static

Definition at line 1995 of file service.c.

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

◆ cas_update_kv_stats()

static void cas_update_kv_stats ( struct cas_fom fom,
const struct m0_rpc_at_buf ab,
m0_bcount_t  nob,
enum stats_kv  kv,
enum stats_kv_io  kv_io 
)
static

Definition at line 751 of file service.c.

Here is the caller graph for this function:

◆ cas_val_send()

static int cas_val_send ( struct cas_fom fom,
const struct m0_cas_op op,
enum m0_cas_opcode  opc,
const struct m0_cas_rep rep,
enum cas_fom_phase  next_phase 
)
static

Similar to cas_key_send(), but fills value AT buffer.

Definition at line 884 of file service.c.

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

◆ M0_BASSERT() [1/5]

◆ M0_BASSERT() [2/5]

◆ M0_BASSERT() [3/5]

◆ M0_BASSERT() [4/5]

◆ M0_BASSERT() [5/5]

◆ m0_cas_opcode()

static enum m0_cas_opcode m0_cas_opcode ( const struct m0_fop fop)
static

Definition at line 1766 of file service.c.

Here is the caller graph for this function:

◆ op_is_index_drop()

static bool op_is_index_drop ( enum m0_cas_opcode  opc,
enum m0_cas_type  ct 
)
static

Checks if operation is index drop.

Parameters
opcopcode
ctoperation type: DDL or DML?
Returns
true if this is index drop

Definition at line 1129 of file service.c.

Here is the caller graph for this function:

◆ op_sync_wait()

static int op_sync_wait ( struct m0_fom fom)
static

Definition at line 1138 of file service.c.

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

Variable Documentation

◆ cas_fom_ops

static const struct m0_fom_ops cas_fom_ops
static
Initial value:
= {
.fo_tick = &cas_fom_tick,
.fo_home_locality = &cas_fom_home_locality,
.fo_fini = &cas_fom_fini,
.fo_addb2_descr = &cas_fom_addb2_descr
}
static void cas_fom_addb2_descr(struct m0_fom *fom)
Definition: service.c:2635
static void cas_fom_fini(struct m0_fom *fom0)
Definition: service.c:1715
static int cas_fom_tick(struct m0_fom *fom0)
Definition: service.c:1160
static size_t cas_fom_home_locality(const struct m0_fom *fom)
Definition: service.c:1754

Definition at line 510 of file service.c.

◆ cas_fom_phases

static struct m0_sm_state_descr cas_fom_phases
static

Definition at line 513 of file service.c.

◆ cas_fom_trans

struct m0_sm_trans_descr cas_fom_trans[]

Definition at line 2821 of file service.c.

◆ cas_fom_type_ops

static const struct m0_fom_type_ops cas_fom_type_ops
static
Initial value:
= {
.fto_create = &cas_fom_create
}
static int cas_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: service.c:634

Definition at line 511 of file service.c.

◆ cas_service_ops

static const struct m0_reqh_service_ops cas_service_ops
static
Initial value:
= {
.rso_start = &cas_service_start,
.rso_prepare_to_stop = &cas_service_prepare_to_stop,
.rso_stop = &cas_service_stop,
.rso_fini = &cas_service_fini
}
static void cas_service_fini(struct m0_reqh_service *service)
Definition: service.c:595
int m0_reqh_service_async_start_simple(struct m0_reqh_service_start_async_ctx *asc)
Definition: reqh_service.c:601
static void cas_service_stop(struct m0_reqh_service *service)
Definition: service.c:589
static void cas_service_prepare_to_stop(struct m0_reqh_service *svc)
Definition: service.c:583
static int cas_service_start(struct m0_reqh_service *service)
Definition: service.c:560

Definition at line 508 of file service.c.

◆ cas_service_type_ops

static const struct m0_reqh_service_type_ops cas_service_type_ops
static
Initial value:
= {
.rsto_service_allocate = &cas_service_type_allocate
}
static int cas_service_type_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *st)
Definition: service.c:604

Definition at line 509 of file service.c.

◆ cas_sm_conf

static struct m0_sm_conf cas_sm_conf
static
Initial value:
= {
.scf_name = "cas-fom",
.scf_nr_states = ARRAY_SIZE(cas_fom_phases),
.scf_state = cas_fom_phases,
.scf_trans_nr = ARRAY_SIZE(cas_fom_trans),
.scf_trans = cas_fom_trans
}
struct m0_sm_trans_descr cas_fom_trans[]
Definition: service.c:2821
#define ARRAY_SIZE(a)
Definition: misc.h:45
static struct m0_sm_state_descr cas_fom_phases[]
Definition: service.c:513

Definition at line 512 of file service.c.

◆ m0_cas_service_type

M0_INTERNAL struct m0_reqh_service_type m0_cas_service_type
Initial value:
= {
.rst_name = "M0_CST_CAS",
.rst_ops = &cas_service_type_ops,
.rst_level = M0_RS_LEVEL_NORMAL,
.rst_typecode = M0_CST_CAS
}
static const struct m0_reqh_service_type_ops cas_service_type_ops
Definition: service.c:509

Definition at line 2927 of file service.c.