Motr  M0
iter_ut.c File Reference
#include <endian.h>
#include <unistd.h>
#include "ut/ut.h"
#include "be/ut/helper.h"
#include "be/tx.h"
#include "pool/pool.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "dix/cm/cm.h"
#include "rpc/rpc_opcodes.h"
#include "cas/cas.h"
#include "cas/ctg_store.h"
#include "dix/cm/iter.h"
#include "dix/fid_convert.h"
#include "lib/finject.h"
#include "lib/trace.h"
Include dependency graph for iter_ut.c:

Go to the source code of this file.

Data Structures

struct  iter_ut_fom
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT
 
#define POOL_WIDTH   10
 
#define NODES   10
 
#define DATA_NR   1
 
#define FAILURES_NR   3
 
#define SPARE_NR   3
 
#define DEVS_ID_SHIFT   100
 

Enumerations

enum  { RPC_CUTOFF = 4096 }
 
enum  iter_ut_fom_op {
  ITER_UT_OP_META_INSERT, ITER_UT_OP_META_DELETE, ITER_UT_OP_META_LOOKUP, ITER_UT_OP_CTIDX_INSERT,
  ITER_UT_OP_CTIDX_DELETE, ITER_UT_OP_KV_INSERT, ITER_UT_OP_KV_DELETE
}
 
enum  iter_ut_fom_phase {
  ITER_UT_FOM_INIT = M0_FOM_PHASE_INIT, ITER_UT_FOM_FINAL = M0_FOM_PHASE_FINISH, ITER_UT_FOM_DONE = M0_FOM_PHASE_NR, ITER_UT_FOM_INIT_WAIT,
  ITER_UT_FOM_CTIDX_LOCK, ITER_UT_FOM_META_LOCK, ITER_UT_FOM_EXEC, ITER_UT_FOM_TX_COMMIT
}
 

Functions

static struct m0_dix_cm_iteriter_ut_iter (struct m0_reqh_service *svc)
 
static void iter_ut_fom_fini (struct m0_fom *fom0)
 
static uint64_t iter_ut_fom_locality (const struct m0_fom *fom)
 
static void iter_ut_fom_init (struct iter_ut_fom *fom)
 
static int iter_ut_fom_exec (struct iter_ut_fom *fom)
 
static void iter_ut_fom_result (struct iter_ut_fom *fom)
 
static int iter_ut_fom_tick (struct m0_fom *fom0)
 
static void iter_ut_fom_op_sync (struct iter_ut_fom *fom)
 
static void iter_ut_fom_op (struct iter_ut_fom *fom, struct m0_semaphore *sem)
 
static void iter_ut_meta_insert (struct m0_fid *cctg_fid)
 
static struct m0_cas_ctgiter_ut_meta_lookup (struct m0_fid *cctg_fid)
 
static void iter_ut_ctidx_insert (struct m0_fid *cctg_fid)
 
static void iter_ut_meta_delete_async (struct iter_ut_fom *fom, struct m0_fid *cctg_fid, struct m0_semaphore *sem)
 
static void iter_ut_ctidx_delete_async (struct iter_ut_fom *fom, struct m0_fid *cctg_fid, struct m0_semaphore *sem)
 
static void iter_ut_insert (struct m0_cas_ctg *cctg, uint64_t key, uint64_t val)
 
static void iter_ut_delete (struct m0_cas_ctg *cctg, uint64_t key, uint64_t val)
 
static void device_state_set (uint64_t pool_device_id, int dev_state)
 
static void device_repaired_set (uint64_t pool_device_id)
 
static void device_repairing_set (uint64_t pool_device_id)
 
static void device_rebalancing_set (uint64_t pool_device_id)
 
static void spare_slot_unused_set ()
 
static void iter_ut_devs_setup ()
 
static void iter_ut_pool_init ()
 
static void iter_ut_reqh_init (void)
 
static void iter_ut_init (struct m0_reqh_service **svc, struct m0_reqh_service_type *stype)
 
static void iter_ut_pool_fini ()
 
static void iter_ut_reqh_fini ()
 
static void iter_ut_fini (struct m0_reqh_service *svc)
 
static void start_stop (void)
 
static int iter_ut_next_sync (struct m0_dix_cm_iter *iter, struct m0_buf *key, struct m0_buf *val, uint32_t *sdev_id)
 
static void empty_store (void)
 
static void empty_cctg (void)
 
static void cctg_not_found (void)
 
static uint64_t buf_value (const struct m0_buf *buf)
 
static void one_rec (void)
 
static void multi_rec (void)
 
static void rep_coordinator (void)
 
static void one_dev_fail (void)
 
static void two_devs_fail (void)
 
static void outside_dev_fail (void)
 
static void empty_spare_fail (void)
 
static void filled_spare_fail (void)
 
static void many_keys_rep (void)
 
static void user_concur_rep (void)
 
static void ctg_del_concur_rep1 (void)
 
static void ctg_del_concur_rep2 (void)
 
static void one_dev_reb (void)
 
static void reb_coordinator (void)
 
static void outside_dev_reb (void)
 
static void reb_unused (void)
 
static void many_keys_reb (void)
 
static void user_concur_reb (void)
 

Variables

static struct m0_reqh reqh
 
static struct m0_be_ut_backend be
 
static struct m0_be_segseg0
 
static struct m0_reqh_servicerepair_svc
 
static struct m0_reqh_servicerebalance_svc
 
static struct m0_fom_type ut_fom_type
 
static struct m0_fom_type ut_fom_type_rep
 
static struct m0_fom_type ut_fom_type_reb
 
static struct m0_pool pool
 
static struct m0_pools_common pc
 
static struct m0_pool_version pv
 
static struct m0_fid pv_fid = M0_FID_TINIT('v', 1, 1)
 
static int spare_usage_pos = 0
 
static struct m0_sm_state_descr iter_ut_fom_phases []
 
static const struct m0_sm_conf iter_ut_fom_conf
 
static const struct m0_fom_ops iter_ut_fom_ops
 
static const struct m0_fom_type_ops iter_ut_fom_type_ops
 
struct m0_ut_suite dix_cm_iter_ut
 

Macro Definition Documentation

◆ DATA_NR

#define DATA_NR   1

Definition at line 44 of file iter_ut.c.

◆ DEVS_ID_SHIFT

#define DEVS_ID_SHIFT   100

Definition at line 47 of file iter_ut.c.

◆ FAILURES_NR

#define FAILURES_NR   3

Definition at line 45 of file iter_ut.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_UT

Definition at line 23 of file iter_ut.c.

◆ NODES

#define NODES   10

Definition at line 43 of file iter_ut.c.

◆ POOL_WIDTH

#define POOL_WIDTH   10

Definition at line 42 of file iter_ut.c.

◆ SPARE_NR

#define SPARE_NR   3

Definition at line 46 of file iter_ut.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RPC_CUTOFF 

Definition at line 65 of file iter_ut.c.

◆ iter_ut_fom_op

Enumerator
ITER_UT_OP_META_INSERT 
ITER_UT_OP_META_DELETE 
ITER_UT_OP_META_LOOKUP 
ITER_UT_OP_CTIDX_INSERT 
ITER_UT_OP_CTIDX_DELETE 
ITER_UT_OP_KV_INSERT 
ITER_UT_OP_KV_DELETE 

Definition at line 69 of file iter_ut.c.

◆ iter_ut_fom_phase

Enumerator
ITER_UT_FOM_INIT 
ITER_UT_FOM_FINAL 
ITER_UT_FOM_DONE 
ITER_UT_FOM_INIT_WAIT 
ITER_UT_FOM_CTIDX_LOCK 
ITER_UT_FOM_META_LOCK 
ITER_UT_FOM_EXEC 
ITER_UT_FOM_TX_COMMIT 

Definition at line 79 of file iter_ut.c.

Function Documentation

◆ buf_value()

static uint64_t buf_value ( const struct m0_buf buf)
static

Definition at line 814 of file iter_ut.c.

Here is the caller graph for this function:

◆ cctg_not_found()

static void cctg_not_found ( void  )
static

Definition at line 789 of file iter_ut.c.

Here is the call graph for this function:

◆ ctg_del_concur_rep1()

static void ctg_del_concur_rep1 ( void  )
static

Definition at line 2298 of file iter_ut.c.

Here is the call graph for this function:

◆ ctg_del_concur_rep2()

static void ctg_del_concur_rep2 ( void  )
static

Definition at line 2394 of file iter_ut.c.

Here is the call graph for this function:

◆ device_rebalancing_set()

static void device_rebalancing_set ( uint64_t  pool_device_id)
static

Definition at line 557 of file iter_ut.c.

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

◆ device_repaired_set()

static void device_repaired_set ( uint64_t  pool_device_id)
static

Definition at line 529 of file iter_ut.c.

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

◆ device_repairing_set()

static void device_repairing_set ( uint64_t  pool_device_id)
static

Definition at line 543 of file iter_ut.c.

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

◆ device_state_set()

static void device_state_set ( uint64_t  pool_device_id,
int  dev_state 
)
static

Definition at line 518 of file iter_ut.c.

Here is the caller graph for this function:

◆ empty_cctg()

static void empty_cctg ( void  )
static

Definition at line 764 of file iter_ut.c.

Here is the call graph for this function:

◆ empty_spare_fail()

static void empty_spare_fail ( void  )
static

Definition at line 1405 of file iter_ut.c.

Here is the call graph for this function:

◆ empty_store()

static void empty_store ( void  )
static

Definition at line 745 of file iter_ut.c.

Here is the call graph for this function:

◆ filled_spare_fail()

static void filled_spare_fail ( void  )
static

Definition at line 1600 of file iter_ut.c.

Here is the call graph for this function:

◆ iter_ut_ctidx_delete_async()

static void iter_ut_ctidx_delete_async ( struct iter_ut_fom fom,
struct m0_fid cctg_fid,
struct m0_semaphore sem 
)
static

Definition at line 464 of file iter_ut.c.

Here is the caller graph for this function:

◆ iter_ut_ctidx_insert()

static void iter_ut_ctidx_insert ( struct m0_fid cctg_fid)
static

Definition at line 444 of file iter_ut.c.

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

◆ iter_ut_delete()

static void iter_ut_delete ( struct m0_cas_ctg cctg,
uint64_t  key,
uint64_t  val 
)
static

Definition at line 496 of file iter_ut.c.

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

◆ iter_ut_devs_setup()

static void iter_ut_devs_setup ( )
static

Definition at line 583 of file iter_ut.c.

Here is the caller graph for this function:

◆ iter_ut_fini()

static void iter_ut_fini ( struct m0_reqh_service svc)
static

Definition at line 700 of file iter_ut.c.

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

◆ iter_ut_fom_exec()

static int iter_ut_fom_exec ( struct iter_ut_fom fom)
static

Definition at line 228 of file iter_ut.c.

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

◆ iter_ut_fom_fini()

static void iter_ut_fom_fini ( struct m0_fom fom0)
static

Definition at line 161 of file iter_ut.c.

Here is the call graph for this function:

◆ iter_ut_fom_init()

static void iter_ut_fom_init ( struct iter_ut_fom fom)
static

Definition at line 179 of file iter_ut.c.

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

◆ iter_ut_fom_locality()

static uint64_t iter_ut_fom_locality ( const struct m0_fom fom)
static

Definition at line 174 of file iter_ut.c.

◆ iter_ut_fom_op()

static void iter_ut_fom_op ( struct iter_ut_fom fom,
struct m0_semaphore sem 
)
static

Definition at line 415 of file iter_ut.c.

Here is the call graph for this function:

◆ iter_ut_fom_op_sync()

static void iter_ut_fom_op_sync ( struct iter_ut_fom fom)
static

Definition at line 402 of file iter_ut.c.

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

◆ iter_ut_fom_result()

static void iter_ut_fom_result ( struct iter_ut_fom fom)
static

Definition at line 275 of file iter_ut.c.

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

◆ iter_ut_fom_tick()

static int iter_ut_fom_tick ( struct m0_fom fom0)
static

Definition at line 295 of file iter_ut.c.

Here is the call graph for this function:

◆ iter_ut_init()

static void iter_ut_init ( struct m0_reqh_service **  svc,
struct m0_reqh_service_type stype 
)
static

Definition at line 646 of file iter_ut.c.

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

◆ iter_ut_insert()

static void iter_ut_insert ( struct m0_cas_ctg cctg,
uint64_t  key,
uint64_t  val 
)
static

Definition at line 474 of file iter_ut.c.

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

◆ iter_ut_iter()

static struct m0_dix_cm_iter* iter_ut_iter ( struct m0_reqh_service svc)
static

Definition at line 152 of file iter_ut.c.

Here is the caller graph for this function:

◆ iter_ut_meta_delete_async()

static void iter_ut_meta_delete_async ( struct iter_ut_fom fom,
struct m0_fid cctg_fid,
struct m0_semaphore sem 
)
static

Definition at line 454 of file iter_ut.c.

Here is the caller graph for this function:

◆ iter_ut_meta_insert()

static void iter_ut_meta_insert ( struct m0_fid cctg_fid)
static

Definition at line 423 of file iter_ut.c.

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

◆ iter_ut_meta_lookup()

static struct m0_cas_ctg* iter_ut_meta_lookup ( struct m0_fid cctg_fid)
static

Definition at line 433 of file iter_ut.c.

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

◆ iter_ut_next_sync()

static int iter_ut_next_sync ( struct m0_dix_cm_iter iter,
struct m0_buf key,
struct m0_buf val,
uint32_t *  sdev_id 
)
static

Definition at line 726 of file iter_ut.c.

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

◆ iter_ut_pool_fini()

static void iter_ut_pool_fini ( )
static

Definition at line 684 of file iter_ut.c.

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

◆ iter_ut_pool_init()

static void iter_ut_pool_init ( )
static
Todo:
Ugly workaround to do finalisation successfully.

Definition at line 599 of file iter_ut.c.

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

◆ iter_ut_reqh_fini()

static void iter_ut_reqh_fini ( )
static

Definition at line 693 of file iter_ut.c.

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

◆ iter_ut_reqh_init()

static void iter_ut_reqh_init ( void  )
static

Definition at line 624 of file iter_ut.c.

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

◆ many_keys_reb()

static void many_keys_reb ( void  )
static

Definition at line 3117 of file iter_ut.c.

Here is the call graph for this function:

◆ many_keys_rep()

static void many_keys_rep ( void  )
static

Definition at line 1970 of file iter_ut.c.

Here is the call graph for this function:

◆ multi_rec()

static void multi_rec ( void  )
static

Definition at line 857 of file iter_ut.c.

Here is the call graph for this function:

◆ one_dev_fail()

static void one_dev_fail ( void  )
static

Definition at line 1078 of file iter_ut.c.

Here is the call graph for this function:

◆ one_dev_reb()

static void one_dev_reb ( void  )
static

Definition at line 2486 of file iter_ut.c.

Here is the call graph for this function:

◆ one_rec()

static void one_rec ( void  )
static

Definition at line 820 of file iter_ut.c.

Here is the call graph for this function:

◆ outside_dev_fail()

static void outside_dev_fail ( void  )
static

Definition at line 1231 of file iter_ut.c.

Here is the call graph for this function:

◆ outside_dev_reb()

static void outside_dev_reb ( void  )
static

Definition at line 2727 of file iter_ut.c.

Here is the call graph for this function:

◆ reb_coordinator()

static void reb_coordinator ( void  )
static

Definition at line 2557 of file iter_ut.c.

Here is the call graph for this function:

◆ reb_unused()

static void reb_unused ( void  )
static

Definition at line 2901 of file iter_ut.c.

Here is the call graph for this function:

◆ rep_coordinator()

static void rep_coordinator ( void  )
static

Definition at line 911 of file iter_ut.c.

Here is the call graph for this function:

◆ spare_slot_unused_set()

static void spare_slot_unused_set ( )
static

Definition at line 571 of file iter_ut.c.

Here is the caller graph for this function:

◆ start_stop()

static void start_stop ( void  )
static

Definition at line 712 of file iter_ut.c.

Here is the call graph for this function:

◆ two_devs_fail()

static void two_devs_fail ( void  )
static

Definition at line 1150 of file iter_ut.c.

Here is the call graph for this function:

◆ user_concur_reb()

static void user_concur_reb ( void  )
static

Definition at line 3210 of file iter_ut.c.

Here is the call graph for this function:

◆ user_concur_rep()

static void user_concur_rep ( void  )
static

Definition at line 2064 of file iter_ut.c.

Here is the call graph for this function:

Variable Documentation

◆ be

struct m0_be_ut_backend be
static

Definition at line 50 of file iter_ut.c.

◆ dix_cm_iter_ut

struct m0_ut_suite dix_cm_iter_ut

Definition at line 3385 of file iter_ut.c.

◆ iter_ut_fom_conf

const struct m0_sm_conf iter_ut_fom_conf
static
Initial value:
= {
.scf_name = "iter_ut_fom",
.scf_nr_states = ARRAY_SIZE(iter_ut_fom_phases),
.scf_state = iter_ut_fom_phases,
}
#define ARRAY_SIZE(a)
Definition: misc.h:45
static struct m0_sm_state_descr iter_ut_fom_phases[]
Definition: iter_ut.c:105

Definition at line 146 of file iter_ut.c.

◆ iter_ut_fom_ops

const struct m0_fom_ops iter_ut_fom_ops
static
Initial value:
= {
.fo_fini = iter_ut_fom_fini,
.fo_tick = iter_ut_fom_tick,
.fo_home_locality = iter_ut_fom_locality
}
static void iter_ut_fom_fini(struct m0_fom *fom0)
Definition: iter_ut.c:161
static uint64_t iter_ut_fom_locality(const struct m0_fom *fom)
Definition: iter_ut.c:174
static int iter_ut_fom_tick(struct m0_fom *fom0)
Definition: iter_ut.c:295

Definition at line 392 of file iter_ut.c.

◆ iter_ut_fom_phases

struct m0_sm_state_descr iter_ut_fom_phases[]
static

Definition at line 105 of file iter_ut.c.

◆ iter_ut_fom_type_ops

const struct m0_fom_type_ops iter_ut_fom_type_ops
static
Initial value:
= {
.fto_create = NULL
}
#define NULL
Definition: misc.h:38

Definition at line 398 of file iter_ut.c.

◆ pc

struct m0_pools_common pc
static

Definition at line 59 of file iter_ut.c.

◆ pool

struct m0_pool pool
static

Definition at line 58 of file iter_ut.c.

◆ pv

struct m0_pool_version pv
static

Definition at line 60 of file iter_ut.c.

◆ pv_fid

struct m0_fid pv_fid = M0_FID_TINIT('v', 1, 1)
static

Definition at line 62 of file iter_ut.c.

◆ rebalance_svc

struct m0_reqh_service* rebalance_svc
static

Definition at line 53 of file iter_ut.c.

◆ repair_svc

struct m0_reqh_service* repair_svc
static

Definition at line 52 of file iter_ut.c.

◆ reqh

struct m0_reqh reqh
static

Definition at line 49 of file iter_ut.c.

◆ seg0

struct m0_be_seg* seg0
static

Definition at line 51 of file iter_ut.c.

◆ spare_usage_pos

int spare_usage_pos = 0
static

Definition at line 63 of file iter_ut.c.

◆ ut_fom_type

struct m0_fom_type ut_fom_type
static

Definition at line 54 of file iter_ut.c.

◆ ut_fom_type_reb

struct m0_fom_type ut_fom_type_reb
static

Definition at line 56 of file iter_ut.c.

◆ ut_fom_type_rep

struct m0_fom_type ut_fom_type_rep
static

Definition at line 55 of file iter_ut.c.