Motr  M0
Copy Machine
Collaboration diagram for Copy Machine:

Modules

 Copy Packet
 
 Copy machine aggregation group
 
 DIX copy machine
 
 SNS copy machine
 
 copy machine proxy
 
 copy machine sliding window
 
 copy machine store
 

Data Structures

struct  m0_cm_type
 
struct  m0_cm_ast_run
 
struct  m0_cm
 
struct  m0_cm_ops
 
struct  m0_fom_trigger_ops
 
struct  m0_trigger_fom
 
struct  failure_data
 
struct  trigger_fop
 
struct  trigger_rep_fop
 
struct  m0_status_rep_fop
 

Macros

#define M0_CM_TYPE_DECLARE(cmtype, id, ops, name, typecode)
 
#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CM
 

Enumerations

enum  m0_cm_state {
  M0_CMS_INIT, M0_CMS_IDLE, M0_CMS_PREPARE, M0_CMS_READY,
  M0_CMS_ACTIVE, M0_CMS_FAIL, M0_CMS_STOP, M0_CMS_FINI,
  M0_CMS_NR
}
 
enum  { CM_RPC_TIMEOUT = 20, CM_MAX_NR_RPC_IN_FLIGHT = 100 }
 
enum  cm_cp_pump_fom_phase {
  CPP_ALLOC = M0_FOM_PHASE_INIT, CPP_FINI = M0_FOM_PHASE_FINISH, CPP_DATA_NEXT, CPP_COMPLETE,
  CPP_STOP, CPP_FAIL, CPP_NR
}
 
enum  { CM_PUMP_MAGIX = 0x330FF1CE0FF1CE77 }
 
enum  m0_trigger_phases { M0_TPH_PREPARE = M0_FOPH_NR + 1, M0_TPH_READY, M0_TPH_START, M0_TPH_FINI = M0_FOM_PHASE_FINISH }
 

Functions

 M0_TL_DESCR_DEFINE (cmtypes, "copy machine types", static, struct m0_cm_type, ct_linkage, ct_magix, CM_TYPE_LINK_MAGIX, CM_TYPE_HEAD_MAGIX)
 
 M0_TL_DEFINE (cmtypes, static, struct m0_cm_type)
 
 M0_BOB_DEFINE (static, &cmtypes_bob, m0_cm_type)
 
M0_INTERNAL struct m0_cmm0_cmsvc2cm (struct m0_reqh_service *cmsvc)
 
M0_INTERNAL int m0_ha_cm_err_send (struct m0_cm *cm, int rc)
 
M0_INTERNAL void m0_cm_fail (struct m0_cm *cm, int rc)
 
M0_INTERNAL void m0_cm_lock (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_unlock (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_trylock (struct m0_cm *cm)
 
M0_INTERNAL bool m0_cm_is_locked (const struct m0_cm *cm)
 
M0_INTERNAL enum m0_cm_state m0_cm_state_get (const struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_state_set (struct m0_cm *cm, enum m0_cm_state state)
 
static int cm_rc (struct m0_cm *cm)
 
M0_INTERNAL bool m0_cm_invariant (const struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_setup (struct m0_cm *cm)
 
static int cm_replicas_connect (struct m0_cm *cm, struct m0_rpc_machine *rmach, struct m0_reqh *reqh)
 
static void cm_replicas_destroy (struct m0_cm *cm)
 
static int cm_pre_start_cleanup (struct m0_cm *cm)
 
M0_INTERNAL struct m0_rpc_machinem0_cm_rpc_machine_find (struct m0_reqh *reqh)
 
M0_INTERNAL int m0_cm_prepare (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_ready (struct m0_cm *cm)
 
M0_INTERNAL bool m0_cm_is_ready (struct m0_cm *cm)
 
M0_INTERNAL bool m0_cm_is_active (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_start (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_proxies_fini (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_stop (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_module_init (void)
 
M0_INTERNAL void m0_cm_module_fini (void)
 
static uint64_t cm_id_generate (void)
 
M0_INTERNAL int m0_cm_init (struct m0_cm *cm, struct m0_cm_type *cm_type, const struct m0_cm_ops *cm_ops)
 
M0_INTERNAL void m0_cm_fini (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_type_register (struct m0_cm_type *cmtype)
 
M0_INTERNAL void m0_cm_type_deregister (struct m0_cm_type *cmtype)
 
M0_INTERNAL int m0_cm_data_next (struct m0_cm *cm, struct m0_cm_cp *cp)
 
M0_INTERNAL bool m0_cm_has_more_data (const struct m0_cm *cm)
 
M0_INTERNAL struct m0_net_bufferm0_cm_buffer_get (struct m0_net_buffer_pool *bp, uint64_t colour)
 
M0_INTERNAL void m0_cm_buffer_put (struct m0_net_buffer_pool *bp, struct m0_net_buffer *buf, uint64_t colour)
 
M0_INTERNAL void m0_cm_notify (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_wait (struct m0_cm *cm, struct m0_fom *fom)
 
M0_INTERNAL void m0_cm_wait_cancel (struct m0_cm *cm, struct m0_fom *fom)
 
M0_INTERNAL int m0_cm_complete (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_complete_notify (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_proxies_init_wait (struct m0_cm *cm, struct m0_fom *fom)
 
M0_INTERNAL void m0_cm_frozen_ag_cleanup (struct m0_cm *cm, struct m0_cm_proxy *proxy)
 
M0_INTERNAL void m0_cm_proxy_failed_cleanup (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_abort (struct m0_cm *cm, int rc)
 
M0_INTERNAL bool m0_cm_is_dirty (struct m0_cm *cm)
 
M0_INTERNAL bool m0_cm_proxies_updated (struct m0_cm *cm)
 
static void cm_ast_run_thread (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_ast_run_thread_init (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_ast_run_thread_fini (struct m0_cm *cm)
 
M0_INTERNAL int m0_cm_configure (struct m0_cm *cm, struct m0_fop *fop)
 
M0_INTERNAL void m0_cm_continue (struct m0_cm *cm)
 
 M0_BOB_DEFINE (static, &pump_bob, m0_cm_cp_pump)
 
static struct m0_cmpump2cm (const struct m0_cm_cp_pump *cp_pump)
 
static bool cm_cp_pump_invariant (const struct m0_cm_cp_pump *cp_pump)
 
static void pump_move (struct m0_cm_cp_pump *cp_fom, int rc, int phase)
 
static int cpp_alloc (struct m0_cm_cp_pump *cp_pump)
 
static int cpp_data_next (struct m0_cm_cp_pump *cp_pump)
 
static int cpp_complete (struct m0_cm_cp_pump *cp_pump)
 
static int cpp_stop (struct m0_cm_cp_pump *cp_pump)
 
static int cpp_fail (struct m0_cm_cp_pump *cp_pump)
 
static uint64_t cm_cp_pump_fom_locality (const struct m0_fom *fom)
 
static int cm_cp_pump_fom_tick (struct m0_fom *fom)
 
static void cm_cp_pump_fom_fini (struct m0_fom *fom)
 
bool m0_cm_cp_pump_is_complete (const struct m0_cm_cp_pump *cp_pump)
 
M0_INTERNAL void m0_cm_cp_pump_init (struct m0_cm_type *cmtype)
 
M0_INTERNAL void m0_cm_cp_pump_prepare (struct m0_cm *cm)
 
M0_INTERNAL void m0_cm_cp_pump_destroy (struct m0_cm *cm)
 
static void complete_wakeup (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static bool pump_cb (struct m0_clink *link)
 
M0_INTERNAL void m0_cm_cp_pump_start (struct m0_cm *cm)
 
static int trigger_fom_tick (struct m0_fom *fom)
 
static void trigger_fom_fini (struct m0_fom *fom)
 
static size_t trigger_fom_home_locality (const struct m0_fom *fom)
 
static int prepare (struct m0_fom *fom)
 
static int ready (struct m0_fom *fom)
 
static int start (struct m0_fom *fom)
 
M0_INTERNAL int m0_trigger_fom_create (struct m0_trigger_fom *tfom, struct m0_fop *fop, struct m0_reqh *reqh)
 
static struct m0_cmtrig2cm (const struct m0_fom *fom)
 
static struct m0_trigger_fomtrig2tfom (const struct m0_fom *fom)
 
static void trigger_rep_set (struct m0_fom *fom)
 
M0_INTERNAL void m0_cm_trigger_fop_fini (struct m0_fop_type *ft)
 
M0_INTERNAL void m0_cm_trigger_fop_init (struct m0_fop_type *ft, enum M0_RPC_OPCODES op, const char *name, const struct m0_xcode_type *xt, uint64_t rpc_flags, struct m0_cm_type *cmt, const struct m0_fom_type_ops *ops)
 
struct failure_data M0_XCA_DOMAIN (rpc)
 

Variables

static struct m0_tl cmtypes
 
static struct m0_mutex cmtypes_mutex
 
static struct m0_bob_type cmtypes_bob
 
static struct m0_sm_state_descr cm_state_descr [M0_CMS_NR]
 
static const struct m0_sm_conf cm_sm_conf
 
static const struct m0_bob_type pump_bob
 
static const struct m0_fom_type_ops cm_cp_pump_fom_type_ops
 
static struct m0_sm_state_descr cm_cp_pump_sd [CPP_NR]
 
struct m0_sm_trans_descr cm_cp_pump_td []
 
struct m0_sm_conf cm_cp_pump_conf
 
static int(* pump_action [])(struct m0_cm_cp_pump *cp_pump)
 
static const struct m0_fom_ops cm_cp_pump_fom_ops
 
static const struct m0_fom_ops trigger_fom_ops
 
struct m0_sm_state_descr m0_trigger_phases []
 
const struct m0_sm_conf m0_trigger_conf
 
static int(* trig_action [])(struct m0_fom *)
 
struct m0_fom_trigger_ops M0_XCA_DOMAIN
 

Detailed Description

Copy machine is a replicated state machine to restructure data in various ways (e.g. copying, moving, re-striping, reconstructing, encrypting, compressing, reintegrating, etc.).

Macro Definition Documentation

◆ M0_CM_TYPE_DECLARE

#define M0_CM_TYPE_DECLARE (   cmtype,
  id,
  ops,
  name,
  typecode 
)
Value:
M0_INTERNAL struct m0_cm_type cmtype ## _cmt = { \
.ct_fom_id = (id), \
.ct_stype = { \
.rst_name = (name), \
.rst_ops = (ops), \
.rst_level = M0_RS_LEVEL_NORMAL, \
.rst_typecode = (typecode) \
} \
}
uint64_t id
Definition: cob.h:2380
const char * name
Definition: trace.c:110
const char * rst_name
Definition: reqh_service.h:447
uint64_t ct_fom_id
Definition: cm.h:148
Definition: cm.h:143
struct m0_reqh_service_type ct_stype
Definition: cm.h:145
struct m0_fom_ops ops
Definition: io_foms.c:623

Definition at line 467 of file cm.h.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CM

Definition at line 30 of file trigger_fom.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CM_RPC_TIMEOUT 
CM_MAX_NR_RPC_IN_FLIGHT 

Definition at line 137 of file cm.h.

◆ anonymous enum

anonymous enum
Enumerator
CM_PUMP_MAGIX 

Definition at line 81 of file pump.c.

◆ cm_cp_pump_fom_phase

Enumerator
CPP_ALLOC 

New copy packets are allocated in this phase. m0_cm_cp_pump::p_fom is in CPP_ALLOC phase when it is initialised by m0_cm_cp_pump_start() and when m0_cm_sw_fill() is invoked from a copy packet FOM, during latter's finalisation, which sets the m0_cm_cp_pump::p_fom phase to CPP_ALLOC and calls m0_fom_wakeup().

CPP_FINI 
CPP_DATA_NEXT 

Copy packets allocated in CPP_ALLOC phase are configured in this phase.

CPP_COMPLETE 

m0_cm_cp_pump::p_fom is transitioned to CPP_COMPLETE phase, once m0_cm_data_next() returns -ENODATA (i.e. there's no more data to process for the iterator).

CPP_STOP 
CPP_FAIL 

Copy machine is notified about the failure, and m0_cm_cp_pump::p_fom remains in CPP_FAIL state. Once copy machine handles the failure pump FOM is resumed, else stopped if the copy machine operation is to be terminated.

CPP_NR 

Definition at line 49 of file pump.c.

◆ m0_cm_state

Copy machine states.

See also
The Copy Machine State diagram
Enumerator
M0_CMS_INIT 
M0_CMS_IDLE 
M0_CMS_PREPARE 
M0_CMS_READY 
M0_CMS_ACTIVE 
M0_CMS_FAIL 
M0_CMS_STOP 
M0_CMS_FINI 
M0_CMS_NR 

Definition at line 125 of file cm.h.

◆ m0_trigger_phases

Enumerator
M0_TPH_PREPARE 
M0_TPH_READY 
M0_TPH_START 
M0_TPH_FINI 

Definition at line 52 of file trigger_fom.h.

Function Documentation

◆ cm_ast_run_thread()

static void cm_ast_run_thread ( struct m0_cm cm)
static

Definition at line 1205 of file cm.c.

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

◆ cm_cp_pump_fom_fini()

static void cm_cp_pump_fom_fini ( struct m0_fom fom)
static

Definition at line 405 of file pump.c.

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

◆ cm_cp_pump_fom_locality()

static uint64_t cm_cp_pump_fom_locality ( const struct m0_fom fom)
static

Definition at line 386 of file pump.c.

◆ cm_cp_pump_fom_tick()

static int cm_cp_pump_fom_tick ( struct m0_fom fom)
static

Definition at line 391 of file pump.c.

Here is the call graph for this function:

◆ cm_cp_pump_invariant()

static bool cm_cp_pump_invariant ( const struct m0_cm_cp_pump cp_pump)
static

Definition at line 103 of file pump.c.

Here is the caller graph for this function:

◆ cm_id_generate()

static uint64_t cm_id_generate ( void  )
static

Temporary implementation to generate unique cm ids.

Todo:
Rewrite this when mechanism to generate unique ids is in place.

Definition at line 919 of file cm.c.

Here is the caller graph for this function:

◆ cm_pre_start_cleanup()

static int cm_pre_start_cleanup ( struct m0_cm cm)
static

Definition at line 699 of file cm.c.

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

◆ cm_rc()

static int cm_rc ( struct m0_cm cm)
static

Definition at line 580 of file cm.c.

Here is the caller graph for this function:

◆ cm_replicas_connect()

static int cm_replicas_connect ( struct m0_cm cm,
struct m0_rpc_machine rmach,
struct m0_reqh reqh 
)
static

Definition at line 627 of file cm.c.

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

◆ cm_replicas_destroy()

static void cm_replicas_destroy ( struct m0_cm cm)
static

Definition at line 686 of file cm.c.

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

◆ complete_wakeup()

static void complete_wakeup ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 451 of file pump.c.

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

◆ cpp_alloc()

static int cpp_alloc ( struct m0_cm_cp_pump cp_pump)
static

Definition at line 116 of file pump.c.

Here is the call graph for this function:

◆ cpp_complete()

static int cpp_complete ( struct m0_cm_cp_pump cp_pump)
static

Definition at line 190 of file pump.c.

Here is the call graph for this function:

◆ cpp_data_next()

static int cpp_data_next ( struct m0_cm_cp_pump cp_pump)
static

Definition at line 135 of file pump.c.

Here is the call graph for this function:

◆ cpp_fail()

static int cpp_fail ( struct m0_cm_cp_pump cp_pump)
static

Definition at line 287 of file pump.c.

Here is the call graph for this function:

◆ cpp_stop()

static int cpp_stop ( struct m0_cm_cp_pump cp_pump)
static

Definition at line 225 of file pump.c.

Here is the call graph for this function:

◆ M0_BOB_DEFINE() [1/2]

M0_BOB_DEFINE ( static  ,
pump_bob,
m0_cm_cp_pump   
)

◆ M0_BOB_DEFINE() [2/2]

M0_BOB_DEFINE ( static  ,
cmtypes_bob,
m0_cm_type   
)

◆ m0_cm_abort()

M0_INTERNAL void m0_cm_abort ( struct m0_cm cm,
int  rc 
)

Definition at line 1181 of file cm.c.

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

◆ m0_cm_ast_run_thread_fini()

M0_INTERNAL void m0_cm_ast_run_thread_fini ( struct m0_cm cm)

Definition at line 1223 of file cm.c.

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

◆ m0_cm_ast_run_thread_init()

M0_INTERNAL int m0_cm_ast_run_thread_init ( struct m0_cm cm)

Definition at line 1215 of file cm.c.

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

◆ m0_cm_buffer_get()

M0_INTERNAL struct m0_net_buffer * m0_cm_buffer_get ( struct m0_net_buffer_pool bp,
uint64_t  colour 
)

Definition at line 1057 of file cm.c.

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

◆ m0_cm_buffer_put()

M0_INTERNAL void m0_cm_buffer_put ( struct m0_net_buffer_pool bp,
struct m0_net_buffer buf,
uint64_t  colour 
)

Definition at line 1074 of file cm.c.

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

◆ m0_cm_complete()

M0_INTERNAL int m0_cm_complete ( struct m0_cm cm)

Definition at line 1100 of file cm.c.

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

◆ m0_cm_complete_notify()

M0_INTERNAL void m0_cm_complete_notify ( struct m0_cm cm)

Definition at line 1133 of file cm.c.

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

◆ m0_cm_configure()

M0_INTERNAL int m0_cm_configure ( struct m0_cm cm,
struct m0_fop fop 
)

Configures a copy machine replica.

Todo:
Pass actual configuration fop data structure once configuration interfaces and datastructures are available.
Precondition
m0_cm_state_get(cm) == M0_CMS_IDLE

◆ m0_cm_continue()

M0_INTERNAL void m0_cm_continue ( struct m0_cm cm)

Creates copy packets and adds aggregation groups to m0_cm::cm_aggr_grps, if required.

◆ m0_cm_cp_pump_destroy()

M0_INTERNAL void m0_cm_cp_pump_destroy ( struct m0_cm cm)

Definition at line 446 of file pump.c.

Here is the call graph for this function:

◆ m0_cm_cp_pump_init()

M0_INTERNAL void m0_cm_cp_pump_init ( struct m0_cm_type cmtype)

Definition at line 426 of file pump.c.

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

◆ m0_cm_cp_pump_is_complete()

bool m0_cm_cp_pump_is_complete ( const struct m0_cm_cp_pump cp_pump)

Definition at line 420 of file pump.c.

Here is the caller graph for this function:

◆ m0_cm_cp_pump_prepare()

M0_INTERNAL void m0_cm_cp_pump_prepare ( struct m0_cm cm)

Definition at line 433 of file pump.c.

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

◆ m0_cm_cp_pump_start()

M0_INTERNAL void m0_cm_cp_pump_start ( struct m0_cm cm)

Initialises pump FOM and submits it to reqh for processing. This is invoked from m0_cm_start()

Definition at line 479 of file pump.c.

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

◆ m0_cm_data_next()

M0_INTERNAL int m0_cm_data_next ( struct m0_cm cm,
struct m0_cm_cp cp 
)

Iterates over data to be re-structured.

Precondition
m0_cm_invariant(cm)
m0_cm_is_locked(cm)
cp != NULL
Postcondition
ergo(rc == 0, cp->c_data != NULL)

Definition at line 1034 of file cm.c.

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

◆ m0_cm_fail()

M0_INTERNAL void m0_cm_fail ( struct m0_cm cm,
int  rc 
)

Handles various type of copy machine failures based on the failure code and errno.

Todo:
Rewrite this function when new ADDB infrastucture is in place.
Parameters
cmFailed copy machine.
failureCopy machine failure code.
rcerrno to which sm rc will be set to.

Definition at line 527 of file cm.c.

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

◆ m0_cm_fini()

M0_INTERNAL void m0_cm_fini ( struct m0_cm cm)

Finalises a copy machine. This is invoked from copy machine specific service fini routine.

Precondition
cm != NULL && m0_cm_state_get(cm) == M0_CMS_IDLE
Postcondition
m0_cm_state_get(cm) == M0_CMS_FINI

Definition at line 964 of file cm.c.

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

◆ m0_cm_frozen_ag_cleanup()

M0_INTERNAL void m0_cm_frozen_ag_cleanup ( struct m0_cm cm,
struct m0_cm_proxy proxy 
)

Finds and destroys aggregation groups that are unable to progress further. SNS operation (repair/rebalance) specific implementation of struct m0_cm_aggr_group_ops::cago_is_frozen_on() helps check relevant parameters and identify if an aggregation group is frozen or not.

Parameters
cmCopy machine with frozen aggregation groups.
proxyRemote copy machine on which an aggregation group could be frozen on (in case expected incoming copy packets will not be arriving). Proxy can be NULL in case cleanup is invoked for local copy machine, this may be the case of single node setup, with no remote copy machines.

Definition at line 1148 of file cm.c.

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

◆ m0_cm_has_more_data()

M0_INTERNAL bool m0_cm_has_more_data ( const struct m0_cm cm)

Checks if copy machine pump FOM will be creating more copy packets or if its done. Once pump FOM is done creating copy packets, it sets m0_cm_cp_pump::p_fom.fo_sm_phase.sm_rc = -ENODATA, the same is checked by this function.

Definition at line 1052 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_init()

M0_INTERNAL int m0_cm_init ( struct m0_cm cm,
struct m0_cm_type cm_type,
const struct m0_cm_ops cm_ops 
)

Initialises a copy machine. This is invoked from copy machine specific service init routine. Transitions copy machine into M0_CMS_INIT state if the initialisation completes without any errors.

Precondition
cm != NULL
Postcondition
ergo(result == 0, m0_cm_state_get(cm) == M0_CMS_INIT)

Definition at line 925 of file cm.c.

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

◆ m0_cm_invariant()

M0_INTERNAL bool m0_cm_invariant ( const struct m0_cm cm)

Checks consistency of copy machine.

Definition at line 585 of file cm.c.

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

◆ m0_cm_is_active()

M0_INTERNAL bool m0_cm_is_active ( struct m0_cm cm)

Definition at line 799 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_is_dirty()

M0_INTERNAL bool m0_cm_is_dirty ( struct m0_cm cm)

Definition at line 1193 of file cm.c.

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

◆ m0_cm_is_locked()

M0_INTERNAL bool m0_cm_is_locked ( const struct m0_cm cm)

Returns true, iff the copy machine lock is held by the current thread. The lock should be released before returning from a fom state transition function. This function is used only in assertions.

Definition at line 560 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_is_ready()

M0_INTERNAL bool m0_cm_is_ready ( struct m0_cm cm)

Definition at line 793 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_lock()

M0_INTERNAL void m0_cm_lock ( struct m0_cm cm)

Locks copy machine replica. We use a state machine group per copy machine replica.

Definition at line 545 of file cm.c.

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

◆ m0_cm_module_fini()

M0_INTERNAL void m0_cm_module_fini ( void  )

Definition at line 907 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_module_init()

M0_INTERNAL int m0_cm_module_init ( void  )

Definition at line 895 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_notify()

M0_INTERNAL void m0_cm_notify ( struct m0_cm cm)

Definition at line 1081 of file cm.c.

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

◆ m0_cm_prepare()

M0_INTERNAL int m0_cm_prepare ( struct m0_cm cm)

Definition at line 717 of file cm.c.

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

◆ m0_cm_proxies_fini()

M0_INTERNAL int m0_cm_proxies_fini ( struct m0_cm cm)

Finalising a proxy can be a blocking operation as we wait until the correspoding remote replica has completed its operations.

Return values
0On success.
-EAGAINWhen proxy is not ready to be finalised.

Definition at line 840 of file cm.c.

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

◆ m0_cm_proxies_init_wait()

M0_INTERNAL void m0_cm_proxies_init_wait ( struct m0_cm cm,
struct m0_fom fom 
)

Definition at line 1142 of file cm.c.

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

◆ m0_cm_proxies_updated()

M0_INTERNAL bool m0_cm_proxies_updated ( struct m0_cm cm)

Definition at line 1198 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_proxy_failed_cleanup()

M0_INTERNAL void m0_cm_proxy_failed_cleanup ( struct m0_cm cm)

Definition at line 1172 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_ready()

M0_INTERNAL int m0_cm_ready ( struct m0_cm cm)

Definition at line 759 of file cm.c.

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

◆ m0_cm_rpc_machine_find()

M0_INTERNAL struct m0_rpc_machine * m0_cm_rpc_machine_find ( struct m0_reqh reqh)

Definition at line 712 of file cm.c.

Here is the caller graph for this function:

◆ m0_cm_setup()

M0_INTERNAL int m0_cm_setup ( struct m0_cm cm)

Perfoms copy machine setup tasks by calling copy machine specific setup routine. This is invoked from copy machine specific service start routine. On successful completion of the setup, a copy machine transitions to "IDLE" state where it waits for a data restructuring request.

Precondition
cm != NULL && m0_cm_state_get(cm) == M0_CMS_INIT
Postcondition
m0_cm_state_get(cm) == M0_CMS_IDLE

Definition at line 595 of file cm.c.

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

◆ m0_cm_start()

M0_INTERNAL int m0_cm_start ( struct m0_cm cm)

Starts the copy machine data restructuring process on receiving the "POST" fop. Internally invokes copy machine specific start routine. Starts pump FOM.

Precondition
cm != NULL && m0_cm_state_get(cm) == M0_CMS_IDLE
Postcondition
m0_cm_state_get(cm) == M0_CMS_ACTIVE

Definition at line 805 of file cm.c.

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

◆ m0_cm_state_get()

M0_INTERNAL enum m0_cm_state m0_cm_state_get ( const struct m0_cm cm)

Definition at line 565 of file cm.c.

Here is the caller graph for this function:

◆ m0_cm_state_set()

M0_INTERNAL void m0_cm_state_set ( struct m0_cm cm,
enum m0_cm_state  state 
)

Copy machine state mutators & accessors

Definition at line 570 of file cm.c.

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

◆ m0_cm_stop()

M0_INTERNAL int m0_cm_stop ( struct m0_cm cm)

Stops copy machine operation. Once operation completes successfully, copy machine performs required tasks, (e.g. updating layouts, cleanup, etc.) by invoking m0_cm_stop(), this transitions copy machine back to M0_CMS_IDLE state. Copy machine invokes m0_cm_stop() also in case of operational failure to broadcast STOP FOPs to its other replicas in the pool, indicating failure. This is handled specific to the copy machine type.

Precondition
cm!= NULL && M0_IN(m0_cm_state_get(cm), (M0_CMS_ACTIVE))
Postcondition
M0_IN(m0_cm_state_get(cm), (M0_CMS_IDLE, M0_CMS_FAIL))

Definition at line 866 of file cm.c.

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

◆ m0_cm_trigger_fop_fini()

M0_INTERNAL void m0_cm_trigger_fop_fini ( struct m0_fop_type ft)

Finalises copy machine trigger FOP type.

Definition at line 353 of file trigger_fom.c.

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

◆ m0_cm_trigger_fop_init()

M0_INTERNAL void m0_cm_trigger_fop_init ( struct m0_fop_type ft,
enum M0_RPC_OPCODES  op,
const char *  name,
const struct m0_xcode_type xt,
uint64_t  rpc_flags,
struct m0_cm_type cmt,
const struct m0_fom_type_ops ops 
)

Initialises copy machine trigger FOP type.

Definition at line 358 of file trigger_fom.c.

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

◆ m0_cm_trylock()

M0_INTERNAL int m0_cm_trylock ( struct m0_cm cm)

Definition at line 555 of file cm.c.

Here is the call graph for this function:

◆ m0_cm_type_deregister()

M0_INTERNAL void m0_cm_type_deregister ( struct m0_cm_type cmtype)

Definition at line 1019 of file cm.c.

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

◆ m0_cm_type_register()

M0_INTERNAL int m0_cm_type_register ( struct m0_cm_type cmtype)

Definition at line 995 of file cm.c.

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

◆ m0_cm_unlock()

M0_INTERNAL void m0_cm_unlock ( struct m0_cm cm)

Releases the lock over a copy machine replica.

Definition at line 550 of file cm.c.

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

◆ m0_cm_wait()

M0_INTERNAL void m0_cm_wait ( struct m0_cm cm,
struct m0_fom fom 
)

Definition at line 1086 of file cm.c.

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

◆ m0_cm_wait_cancel()

M0_INTERNAL void m0_cm_wait_cancel ( struct m0_cm cm,
struct m0_fom fom 
)

Definition at line 1093 of file cm.c.

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

◆ m0_cmsvc2cm()

M0_INTERNAL struct m0_cm * m0_cmsvc2cm ( struct m0_reqh_service cmsvc)

Definition at line 497 of file cm.c.

Here is the caller graph for this function:

◆ m0_ha_cm_err_send()

M0_INTERNAL int m0_ha_cm_err_send ( struct m0_cm cm,
int  rc 
)

Sends HA notification about cm failure.

Definition at line 502 of file cm.c.

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

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( cmtypes  ,
static  ,
struct m0_cm_type   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( cmtypes  ,
"copy machine types"  ,
static  ,
struct m0_cm_type  ,
ct_linkage  ,
ct_magix  ,
CM_TYPE_LINK_MAGIX  ,
CM_TYPE_HEAD_MAGIX   
)

◆ m0_trigger_fom_create()

M0_INTERNAL int m0_trigger_fom_create ( struct m0_trigger_fom tfom,
struct m0_fop fop,
struct m0_reqh reqh 
)

Definition at line 84 of file trigger_fom.c.

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

◆ M0_XCA_DOMAIN()

struct failure_data M0_XCA_DOMAIN ( rpc  )

◆ prepare()

static int prepare ( struct m0_fom fom)
static

Definition at line 185 of file trigger_fom.c.

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

◆ pump2cm()

static struct m0_cm* pump2cm ( const struct m0_cm_cp_pump cp_pump)
static

Definition at line 98 of file pump.c.

Here is the caller graph for this function:

◆ pump_cb()

static bool pump_cb ( struct m0_clink link)
static

Definition at line 464 of file pump.c.

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

◆ pump_move()

static void pump_move ( struct m0_cm_cp_pump cp_fom,
int  rc,
int  phase 
)
static

Definition at line 111 of file pump.c.

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

◆ ready()

static int ready ( struct m0_fom fom)
static

Definition at line 287 of file trigger_fom.c.

Here is the call graph for this function:

◆ start()

static int start ( struct m0_fom fom)
static

Definition at line 321 of file trigger_fom.c.

Here is the call graph for this function:

◆ trig2cm()

static struct m0_cm* trig2cm ( const struct m0_fom fom)
static

Definition at line 119 of file trigger_fom.c.

Here is the caller graph for this function:

◆ trig2tfom()

static struct m0_trigger_fom* trig2tfom ( const struct m0_fom fom)
static

Definition at line 124 of file trigger_fom.c.

Here is the caller graph for this function:

◆ trigger_fom_fini()

static void trigger_fom_fini ( struct m0_fom fom)
static

Definition at line 105 of file trigger_fom.c.

Here is the call graph for this function:

◆ trigger_fom_home_locality()

static size_t trigger_fom_home_locality ( const struct m0_fom fom)
static

Definition at line 112 of file trigger_fom.c.

Here is the call graph for this function:

◆ trigger_fom_tick()

static int trigger_fom_tick ( struct m0_fom fom)
static

Definition at line 139 of file trigger_fom.c.

Here is the call graph for this function:

◆ trigger_rep_set()

static void trigger_rep_set ( struct m0_fom fom)
static

Definition at line 129 of file trigger_fom.c.

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

Variable Documentation

◆ cm_cp_pump_conf

struct m0_sm_conf cm_cp_pump_conf
Initial value:
= {
.scf_name = "sm: cp pump conf",
.scf_nr_states = ARRAY_SIZE(cm_cp_pump_sd),
.scf_state = cm_cp_pump_sd,
.scf_trans_nr = ARRAY_SIZE(cm_cp_pump_td),
.scf_trans = cm_cp_pump_td
}
struct m0_sm_trans_descr cm_cp_pump_td[]
Definition: pump.c:337
#define ARRAY_SIZE(a)
Definition: misc.h:45
static struct m0_sm_state_descr cm_cp_pump_sd[CPP_NR]
Definition: pump.c:302

Definition at line 370 of file pump.c.

◆ cm_cp_pump_fom_ops

const struct m0_fom_ops cm_cp_pump_fom_ops
static
Initial value:
= {
.fo_fini = cm_cp_pump_fom_fini,
.fo_tick = cm_cp_pump_fom_tick,
.fo_home_locality = cm_cp_pump_fom_locality
}
static uint64_t cm_cp_pump_fom_locality(const struct m0_fom *fom)
Definition: pump.c:386
static void cm_cp_pump_fom_fini(struct m0_fom *fom)
Definition: pump.c:405
static int cm_cp_pump_fom_tick(struct m0_fom *fom)
Definition: pump.c:391

Definition at line 414 of file pump.c.

◆ cm_cp_pump_fom_type_ops

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

Definition at line 94 of file pump.c.

◆ cm_cp_pump_sd

struct m0_sm_state_descr cm_cp_pump_sd[CPP_NR]
static

Definition at line 302 of file pump.c.

◆ cm_cp_pump_td

struct m0_sm_trans_descr cm_cp_pump_td[]

Definition at line 337 of file pump.c.

◆ cm_sm_conf

const struct m0_sm_conf cm_sm_conf
static
Initial value:
= {
.scf_name = "sm:cm conf",
.scf_nr_states = M0_CMS_NR,
.scf_state = cm_state_descr
}
static struct m0_sm_state_descr cm_state_descr[M0_CMS_NR]
Definition: cm.c:446
Definition: cm.h:134

Definition at line 491 of file cm.c.

◆ cm_state_descr

struct m0_sm_state_descr cm_state_descr[M0_CMS_NR]
static

Definition at line 446 of file cm.c.

◆ cmtypes

struct m0_tl cmtypes
static

List containing the copy machines registered on a motr server.

Definition at line 432 of file cm.c.

◆ cmtypes_bob

struct m0_bob_type cmtypes_bob
static

Definition at line 443 of file cm.c.

◆ cmtypes_mutex

struct m0_mutex cmtypes_mutex
static

Protects access to the list m0_cmtypes.

Definition at line 435 of file cm.c.

◆ m0_trigger_conf

const struct m0_sm_conf m0_trigger_conf
Initial value:
= {
.scf_name = "Trigger",
.scf_nr_states = ARRAY_SIZE(m0_trigger_phases),
.scf_state = m0_trigger_phases
}
m0_trigger_phases
Definition: trigger_fom.h:52
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 72 of file trigger_fom.c.

◆ m0_trigger_phases

Initial value:
= {
.sd_name = "Prepare copy machine",
},
.sd_name = "Send ready fops",
},
.sd_name = "Start repair/rebalance",
},
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 55 of file trigger_fom.c.

◆ M0_XCA_DOMAIN

struct m0_fom_trigger_ops M0_XCA_DOMAIN

◆ pump_action

int(* pump_action[])(struct m0_cm_cp_pump *cp_pump)
static
Initial value:
= {
}
static int cpp_fail(struct m0_cm_cp_pump *cp_pump)
Definition: pump.c:287
Definition: pump.c:70
Definition: pump.c:77
Definition: pump.c:57
static int cpp_complete(struct m0_cm_cp_pump *cp_pump)
Definition: pump.c:190
static int cpp_stop(struct m0_cm_cp_pump *cp_pump)
Definition: pump.c:225
static int cpp_data_next(struct m0_cm_cp_pump *cp_pump)
Definition: pump.c:135
static int cpp_alloc(struct m0_cm_cp_pump *cp_pump)
Definition: pump.c:116

Definition at line 378 of file pump.c.

◆ pump_bob

const struct m0_bob_type pump_bob
static
Initial value:
= {
.bt_name = "copy packet pump",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_cm_cp_pump, p_magix),
.bt_magix = CM_PUMP_MAGIX,
.bt_check = NULL
}
#define NULL
Definition: misc.h:38
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 85 of file pump.c.

◆ trig_action

int(* trig_action[])(struct m0_fom *)
static
Initial value:
= {
}
static int prepare(struct m0_fom *fom)
Definition: trigger_fom.c:185
static int start(struct m0_fom *fom)
Definition: trigger_fom.c:321
static int ready(struct m0_fom *fom)
Definition: trigger_fom.c:287

Definition at line 78 of file trigger_fom.c.

◆ trigger_fom_ops

const struct m0_fom_ops trigger_fom_ops
static
Initial value:
= {
.fo_fini = trigger_fom_fini,
.fo_tick = trigger_fom_tick,
.fo_home_locality = trigger_fom_home_locality
}
static size_t trigger_fom_home_locality(const struct m0_fom *fom)
Definition: trigger_fom.c:112
static void trigger_fom_fini(struct m0_fom *fom)
Definition: trigger_fom.c:105
static int trigger_fom_tick(struct m0_fom *fom)
Definition: trigger_fom.c:139

Definition at line 49 of file trigger_fom.c.