Motr  M0
cp.c File Reference
#include "cm/cp.h"
#include "cm/cp.c"
#include "cm/ut/common_service.h"
#include "sns/cm/cp.h"
#include "ioservice/fid_convert.h"
#include "lib/fs.h"
#include "ut/misc.h"
#include "ut/ut.h"
Include dependency graph for cp.c:

Go to the source code of this file.

Enumerations

enum  { THREADS_NR = 17 }
 

Functions

static int ut_cp_service_start (struct m0_reqh_service *service)
 
static void ut_cp_service_stop (struct m0_reqh_service *service)
 
static void ut_cp_service_fini (struct m0_reqh_service *service)
 
static int ut_cp_service_allocate (struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
 
static int dummy_cp_read (struct m0_cm_cp *cp)
 
static int dummy_cp_write_pre (struct m0_cm_cp *cp)
 
static int dummy_cp_write (struct m0_cm_cp *cp)
 
static int dummy_cp_phase (struct m0_cm_cp *cp)
 
static int dummy_cp_init (struct m0_cm_cp *cp)
 
static int dummy_cp_phase_next (struct m0_cm_cp *cp)
 
void dummy_cp_fom_fini (struct m0_fom *fom)
 
static void cp_post (struct m0_sns_cm_cp *sns_cp, struct m0_cm_aggr_group *ag, struct m0_net_buffer *nb)
 
static void test_cp_single_thread (void)
 
static void cp_op (const int tid)
 
static void test_cp_multi_thread (void)
 
static int cm_cp_init (void)
 
static int cm_cp_fini (void)
 

Variables

static struct m0_semaphore sem
 
static struct m0_sns_cm_cp s_sns_cp
 
struct m0_net_buffer s_nb
 
static struct m0_net_buffer_pool nbp
 
static struct m0_cm_aggr_group s_ag
 
static const struct m0_reqh_service_ops ut_cp_service_ops
 
static const struct m0_reqh_service_type_ops ut_cp_service_type_ops
 
struct m0_reqh_service_type ut_cp_service_type
 
static struct m0_sns_cm_cp m_sns_cp [THREADS_NR]
 
static struct m0_cm_aggr_group m_ag [THREADS_NR]
 
static struct m0_net_buffer m_nb [THREADS_NR]
 
const struct m0_cm_cp_ops m0_sns_cm_cp_dummy_ops
 
static struct m0_fom_ops dummy_cp_fom_ops
 
struct m0_ut_suite cm_cp_ut
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
THREADS_NR 

Definition at line 40 of file cp.c.

Function Documentation

◆ cm_cp_fini()

static int cm_cp_fini ( void  )
static

Definition at line 290 of file cp.c.

Here is the call graph for this function:

◆ cm_cp_init()

static int cm_cp_init ( void  )
static

Definition at line 271 of file cp.c.

Here is the call graph for this function:

◆ cp_op()

static void cp_op ( const int  tid)
static

Definition at line 230 of file cp.c.

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

◆ cp_post()

static void cp_post ( struct m0_sns_cm_cp sns_cp,
struct m0_cm_aggr_group ag,
struct m0_net_buffer nb 
)
static

Definition at line 189 of file cp.c.

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

◆ dummy_cp_fom_fini()

void dummy_cp_fom_fini ( struct m0_fom fom)

Definition at line 169 of file cp.c.

Here is the call graph for this function:

◆ dummy_cp_init()

static int dummy_cp_init ( struct m0_cm_cp cp)
static

Definition at line 122 of file cp.c.

Here is the call graph for this function:

◆ dummy_cp_phase()

static int dummy_cp_phase ( struct m0_cm_cp cp)
static

Definition at line 117 of file cp.c.

◆ dummy_cp_phase_next()

static int dummy_cp_phase_next ( struct m0_cm_cp cp)
static

Definition at line 130 of file cp.c.

Here is the call graph for this function:

◆ dummy_cp_read()

static int dummy_cp_read ( struct m0_cm_cp cp)
static

Definition at line 98 of file cp.c.

◆ dummy_cp_write()

static int dummy_cp_write ( struct m0_cm_cp cp)
static

Definition at line 110 of file cp.c.

◆ dummy_cp_write_pre()

static int dummy_cp_write_pre ( struct m0_cm_cp cp)
static

Definition at line 105 of file cp.c.

◆ test_cp_multi_thread()

static void test_cp_multi_thread ( void  )
static

Definition at line 242 of file cp.c.

Here is the call graph for this function:

◆ test_cp_single_thread()

static void test_cp_single_thread ( void  )
static

Definition at line 214 of file cp.c.

Here is the call graph for this function:

◆ ut_cp_service_allocate()

static int ut_cp_service_allocate ( struct m0_reqh_service **  service,
const struct m0_reqh_service_type stype 
)
static

Definition at line 67 of file cp.c.

◆ ut_cp_service_fini()

static void ut_cp_service_fini ( struct m0_reqh_service service)
static

Definition at line 55 of file cp.c.

Here is the call graph for this function:

◆ ut_cp_service_start()

static int ut_cp_service_start ( struct m0_reqh_service service)
static

Definition at line 44 of file cp.c.

◆ ut_cp_service_stop()

static void ut_cp_service_stop ( struct m0_reqh_service service)
static

Definition at line 50 of file cp.c.

Variable Documentation

◆ cm_cp_ut

struct m0_ut_suite cm_cp_ut
Initial value:
= {
.ts_name = "cm-cp-ut",
.ts_init = &cm_cp_init,
.ts_fini = &cm_cp_fini,
.ts_tests = {
{ "cp-single_thread", test_cp_single_thread },
{ "cp-multi_thread", test_cp_multi_thread },
{ NULL, NULL }
}
}
#define NULL
Definition: misc.h:38
static int cm_cp_fini(void)
Definition: cp.c:290
static void test_cp_single_thread(void)
Definition: cp.c:214
static int cm_cp_init(void)
Definition: cp.c:271
static void test_cp_multi_thread(void)
Definition: cp.c:242

Definition at line 298 of file cp.c.

◆ dummy_cp_fom_ops

struct m0_fom_ops dummy_cp_fom_ops
static
Initial value:
= {
.fo_fini = dummy_cp_fom_fini,
.fo_tick = cp_fom_tick,
.fo_home_locality = cp_fom_locality
}
static int cp_fom_tick(struct m0_fom *fom)
Definition: cp.c:431
void dummy_cp_fom_fini(struct m0_fom *fom)
Definition: cp.c:169
static uint64_t cp_fom_locality(const struct m0_fom *fom)
Definition: cp.c:424

Definition at line 179 of file cp.c.

◆ m0_sns_cm_cp_dummy_ops

const struct m0_cm_cp_ops m0_sns_cm_cp_dummy_ops
Initial value:
= {
.co_action = {
},
.co_action_nr = M0_CCP_NR,
.co_phase_next = &dummy_cp_phase_next,
.co_invariant = &m0_sns_cm_cp_invariant,
.co_home_loc_helper = &cp_home_loc_helper,
.co_complete = &m0_sns_cm_cp_complete,
.co_free = &m0_sns_cm_cp_free,
}
M0_INTERNAL void m0_sns_cm_cp_free(struct m0_cm_cp *cp)
Definition: cp.c:338
M0_INTERNAL void m0_sns_cm_cp_complete(struct m0_cm_cp *cp)
Definition: cp.c:307
static int dummy_cp_write(struct m0_cm_cp *cp)
Definition: cp.c:110
Definition: cp.h:151
M0_INTERNAL bool m0_sns_cm_cp_invariant(const struct m0_cm_cp *cp)
Definition: cp.c:62
static int dummy_cp_init(struct m0_cm_cp *cp)
Definition: cp.c:122
static int dummy_cp_phase_next(struct m0_cm_cp *cp)
Definition: cp.c:130
static int dummy_cp_write_pre(struct m0_cm_cp *cp)
Definition: cp.c:105
static int dummy_cp_read(struct m0_cm_cp *cp)
Definition: cp.c:98
static int dummy_cp_phase(struct m0_cm_cp *cp)
Definition: cp.c:117
M0_INTERNAL uint64_t cp_home_loc_helper(const struct m0_cm_cp *cp)
Definition: cp.c:80
M0_INTERNAL int m0_sns_cm_cp_fini(struct m0_cm_cp *cp)
Definition: cp.c:352

Definition at line 142 of file cp.c.

◆ m_ag

struct m0_cm_aggr_group m_ag[THREADS_NR]
static

Definition at line 95 of file cp.c.

◆ m_nb

struct m0_net_buffer m_nb[THREADS_NR]
static

Definition at line 96 of file cp.c.

◆ m_sns_cp

struct m0_sns_cm_cp m_sns_cp[THREADS_NR]
static

Definition at line 94 of file cp.c.

◆ nbp

struct m0_net_buffer_pool nbp
static

Definition at line 37 of file cp.c.

◆ s_ag

struct m0_cm_aggr_group s_ag
static

Definition at line 38 of file cp.c.

◆ s_nb

struct m0_net_buffer s_nb

Definition at line 36 of file cp.c.

◆ s_sns_cp

struct m0_sns_cm_cp s_sns_cp
static

Definition at line 35 of file cp.c.

◆ sem

struct m0_semaphore sem
static

Definition at line 32 of file cp.c.

◆ ut_cp_service_ops

const struct m0_reqh_service_ops ut_cp_service_ops
static
Initial value:
= {
.rso_start = ut_cp_service_start,
.rso_stop = ut_cp_service_stop,
.rso_fini = ut_cp_service_fini
}
static void ut_cp_service_stop(struct m0_reqh_service *service)
Definition: cp.c:50
static void ut_cp_service_fini(struct m0_reqh_service *service)
Definition: cp.c:55
static int ut_cp_service_start(struct m0_reqh_service *service)
Definition: cp.c:44

Definition at line 61 of file cp.c.

◆ ut_cp_service_type

struct m0_reqh_service_type ut_cp_service_type
Initial value:
= {
.rst_name = "ut-cp",
.rst_level = M0_RS_LEVEL_NORMAL,
}
static const struct m0_reqh_service_type_ops ut_cp_service_type_ops
Definition: cp.c:83

Definition at line 87 of file cp.c.

◆ ut_cp_service_type_ops

const struct m0_reqh_service_type_ops ut_cp_service_type_ops
static
Initial value:
= {
.rsto_service_allocate = ut_cp_service_allocate
}
static int ut_cp_service_allocate(struct m0_reqh_service **service, const struct m0_reqh_service_type *stype)
Definition: cp.c:67

Definition at line 83 of file cp.c.