Motr  M0
isc.c File Reference
#include "lib/trace.h"
#include "lib/hash.h"
#include "lib/memory.h"
#include "lib/chan.h"
#include "lib/finject.h"
#include "fop/fom.h"
#include "fop/fom_generic.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "rpc/rpc_opcodes.h"
#include "rpc/rpc_machine.h"
#include "ioservice/fid_convert.h"
#include "ioservice/storage_dev.h"
#include "motr/setup.h"
#include "conf/helpers.h"
#include "conf/diter.h"
#include "conf/obj_ops.h"
#include "spiel/spiel.h"
#include "iscservice/isc.h"
#include "iscservice/isc_service.h"
Include dependency graph for isc.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_ISCS
 

Enumerations

enum  m0_isc_fom_phases {
  ISC_PREPARE = M0_FOPH_TYPE_SPECIFIC, ISC_LOAD_ARGS, ISC_ARGS_LOAD_DONE, ISC_COMP_LAUNCH,
  ISC_RET_VAL, ISC_RET_VAL_DONE, ISC_DONE
}
 
enum  exec_fom_phases {
  EP_PREPARE = M0_FOM_PHASE_INIT, EP_FINI = M0_FOM_PHASE_FINISH, EP_EXEC, EP_FAIL,
  EP_COMPLETE
}
 

Functions

static void isc_comp_cleanup (struct m0_fom *fom, int rc, int next_phase)
 
static int comp_ref_get (struct m0_htable *comp_ht, struct m0_isc_comp_req *req)
 
static void comp_ref_put (struct m0_htable *comp_ht, struct m0_isc_comp *comp)
 
static size_t fom_home_locality (const struct m0_fom *fom)
 
static struct m0_rpc_machinefom_rmach (const struct m0_fom *fom)
 
static bool is_alignment_required (struct m0_isc_comp_req *comp_req)
 
static int isc_comp_launch (struct m0_isc_comp_req *comp_req, struct m0_fom *fom, int next_phase)
 
static void isc_comp_prepare (struct m0_isc_comp_req *comp_req, struct m0_fom *fom, int next_phase0, int next_phase1)
 
static int isc_fom_tick (struct m0_fom *fom)
 
static void isc_fom_fini (struct m0_fom *fom)
 
static int isc_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void comp_cleanup (struct m0_htable *comp_ht, struct m0_isc_comp *comp)
 
static int ce_fom_tick (struct m0_fom *fom)
 
static void ce_fom_fini (struct m0_fom *fom)
 
M0_INTERNAL void m0_isc_fom_type_init (void)
 
static bool isc_comp_req_invariant (const struct m0_isc_comp_req *comp_req)
 
M0_INTERNAL int m0_isc_comp_req_exec (struct m0_isc_comp_req *comp_req)
 
M0_INTERNAL int m0_isc_comp_req_exec_sync (struct m0_isc_comp_req *comp_req)
 
M0_INTERNAL void m0_isc_comp_req_init (struct m0_isc_comp_req *comp_req, const struct m0_buf *comp_args, const struct m0_fid *comp_fid, const struct m0_cookie *comp_cookie, enum m0_isc_comp_req_type comp_req_type, struct m0_reqh *reqh)
 
static bool is_request_local (struct m0_isc_comp_req *comp_req)
 
M0_INTERNAL void m0_isc_comp_req_fini (struct m0_isc_comp_req *comp_req)
 
static int comp_register (struct m0_htable *comp_ht, int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc), char *comp_name, const struct m0_fid *fid)
 
M0_INTERNAL int m0_isc_comp_register (int(*ftn)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc), const char *f_name, const struct m0_fid *ftn_fid)
 
static void comp_unregister (struct m0_htable *comp_ht, const struct m0_fid *fid)
 
M0_INTERNAL void m0_isc_comp_unregister (const struct m0_fid *fid)
 
M0_INTERNAL int m0_isc_comp_state_probe (const struct m0_fid *fid)
 
static int isc_spiel_prepare (struct m0_spiel *spiel, struct m0_fid *profile, struct m0_reqh *reqh)
 
static void isc_spiel_destroy (struct m0_spiel *spiel)
 
static bool conf_obj_is_svc (const struct m0_conf_obj *obj)
 
M0_INTERNAL int m0_isc_lib_register (const char *libpath, struct m0_fid *profile, struct m0_reqh *reqh)
 
static void bufvec_pack (struct m0_bufvec *bv, uint32_t shift)
 
static void bufvec_open (struct m0_bufvec *bv, uint32_t shift)
 
static int bufvec_alloc_init (struct m0_bufvec *bv, struct m0_io_indexvec *iiv, uint32_t shift)
 
M0_INTERNAL int m0_isc_io_launch (struct m0_stob_io *stio, struct m0_fid *cob, struct m0_io_indexvec *iv, struct m0_fom *fom)
 
M0_INTERNAL int64_t m0_isc_io_res (struct m0_stob_io *stio, char **buf)
 
M0_INTERNAL void m0_isc_io_fini (struct m0_stob_io *stio)
 

Variables

struct m0_sm_state_descr isc_fom_phases []
 
static const struct m0_fom_ops isc_fom_ops
 
const struct m0_fom_type_ops m0_fom_isc_type_ops
 
struct m0_sm_conf isc_sm_conf
 
struct m0_sm_state_descr comp_exec_fom_states []
 
static const struct m0_sm_conf comp_exec_fom_states_conf
 
static struct m0_fom_type comp_exec_fom_type
 
static const struct m0_fom_type_ops comp_exec_fom_type_ops
 
static const struct m0_fom_ops comp_exec_fom_ops
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_ISCS

Definition at line 23 of file isc.c.

Enumeration Type Documentation

◆ exec_fom_phases

Enumerator
EP_PREPARE 
EP_FINI 
EP_EXEC 
EP_FAIL 
EP_COMPLETE 

Definition at line 392 of file isc.c.

◆ m0_isc_fom_phases

Enumerator
ISC_PREPARE 

Locates the computation in hash table.

ISC_LOAD_ARGS 

Fetches arguments for computation over network.

ISC_ARGS_LOAD_DONE 

Copies the fetched arguments to local buffer.

ISC_COMP_LAUNCH 

Launches the computation.

ISC_RET_VAL 

Returns the result to caller of the computation.

ISC_RET_VAL_DONE 

Ensures that returned value is sent over network.

ISC_DONE 

Finalizes relevant data structures.

Definition at line 56 of file isc.c.

Function Documentation

◆ bufvec_alloc_init()

static int bufvec_alloc_init ( struct m0_bufvec bv,
struct m0_io_indexvec iiv,
uint32_t  shift 
)
static

Definition at line 815 of file isc.c.

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

◆ bufvec_open()

static void bufvec_open ( struct m0_bufvec bv,
uint32_t  shift 
)
static

Definition at line 805 of file isc.c.

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

◆ bufvec_pack()

static void bufvec_pack ( struct m0_bufvec bv,
uint32_t  shift 
)
static

Definition at line 795 of file isc.c.

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

◆ ce_fom_fini()

static void ce_fom_fini ( struct m0_fom fom)
static

Definition at line 465 of file isc.c.

Here is the call graph for this function:

◆ ce_fom_tick()

static int ce_fom_tick ( struct m0_fom fom)
static

Definition at line 437 of file isc.c.

Here is the call graph for this function:

◆ comp_cleanup()

static void comp_cleanup ( struct m0_htable comp_ht,
struct m0_isc_comp comp 
)
static

Definition at line 366 of file isc.c.

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

◆ comp_ref_get()

static int comp_ref_get ( struct m0_htable comp_ht,
struct m0_isc_comp_req req 
)
static

Definition at line 340 of file isc.c.

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

◆ comp_ref_put()

static void comp_ref_put ( struct m0_htable comp_ht,
struct m0_isc_comp comp 
)
static

Definition at line 374 of file isc.c.

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

◆ comp_register()

static int comp_register ( struct m0_htable comp_ht,
int(*)(struct m0_buf *arg_in, struct m0_buf *args_out, struct m0_isc_comp_private *comp_data, int *rc ftn,
char *  comp_name,
const struct m0_fid fid 
)
static

Definition at line 579 of file isc.c.

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

◆ comp_unregister()

static void comp_unregister ( struct m0_htable comp_ht,
const struct m0_fid fid 
)
static

Definition at line 635 of file isc.c.

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

◆ conf_obj_is_svc()

static bool conf_obj_is_svc ( const struct m0_conf_obj obj)
static

Definition at line 725 of file isc.c.

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

◆ fom_home_locality()

static size_t fom_home_locality ( const struct m0_fom fom)
static

Definition at line 104 of file isc.c.

◆ fom_rmach()

static struct m0_rpc_machine* fom_rmach ( const struct m0_fom fom)
static

Definition at line 112 of file isc.c.

Here is the caller graph for this function:

◆ is_alignment_required()

static bool is_alignment_required ( struct m0_isc_comp_req comp_req)
static

Definition at line 117 of file isc.c.

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

◆ is_request_local()

static bool is_request_local ( struct m0_isc_comp_req comp_req)
static

Definition at line 562 of file isc.c.

Here is the caller graph for this function:

◆ isc_comp_cleanup()

static void isc_comp_cleanup ( struct m0_fom fom,
int  rc,
int  next_phase 
)
static

Definition at line 316 of file isc.c.

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

◆ isc_comp_launch()

static int isc_comp_launch ( struct m0_isc_comp_req comp_req,
struct m0_fom fom,
int  next_phase 
)
static

Definition at line 135 of file isc.c.

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

◆ isc_comp_prepare()

static void isc_comp_prepare ( struct m0_isc_comp_req comp_req,
struct m0_fom fom,
int  next_phase0,
int  next_phase1 
)
static

Definition at line 189 of file isc.c.

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

◆ isc_comp_req_invariant()

static bool isc_comp_req_invariant ( const struct m0_isc_comp_req comp_req)
static

Definition at line 487 of file isc.c.

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

◆ isc_fom_create()

static int isc_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 287 of file isc.c.

Here is the call graph for this function:

◆ isc_fom_fini()

static void isc_fom_fini ( struct m0_fom fom)
static

Definition at line 271 of file isc.c.

Here is the call graph for this function:

◆ isc_fom_tick()

static int isc_fom_tick ( struct m0_fom fom)
static

Definition at line 208 of file isc.c.

Here is the call graph for this function:

◆ isc_spiel_destroy()

static void isc_spiel_destroy ( struct m0_spiel spiel)
static

Definition at line 719 of file isc.c.

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

◆ isc_spiel_prepare()

static int isc_spiel_prepare ( struct m0_spiel spiel,
struct m0_fid profile,
struct m0_reqh reqh 
)
static

Definition at line 692 of file isc.c.

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

◆ m0_isc_fom_type_init()

M0_INTERNAL void m0_isc_fom_type_init ( void  )

Registers fom types of fop-less foms.

Definition at line 480 of file isc.c.

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

Variable Documentation

◆ comp_exec_fom_ops

const struct m0_fom_ops comp_exec_fom_ops
static
Initial value:
= {
.fo_home_locality = fom_home_locality,
.fo_tick = ce_fom_tick,
.fo_fini = ce_fom_fini
}
static int ce_fom_tick(struct m0_fom *fom)
Definition: isc.c:437
static size_t fom_home_locality(const struct m0_fom *fom)
Definition: isc.c:104
static void ce_fom_fini(struct m0_fom *fom)
Definition: isc.c:465

Definition at line 474 of file isc.c.

◆ comp_exec_fom_states

struct m0_sm_state_descr comp_exec_fom_states[]
Initial value:
= {
[EP_PREPARE] = {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "prepare",
},
[EP_EXEC] = {
.sd_name = "launch-computation",
.sd_allowed = M0_BITS(EP_COMPLETE, EP_FAIL)
},
.sd_name = "computation-completes",
.sd_allowed = M0_BITS(EP_FINI)
},
[EP_FAIL] = {
.sd_flags = M0_SDF_FAILURE,
.sd_name = "failure-in-launch",
.sd_allowed = M0_BITS(EP_FINI),
},
[EP_FINI] = {
.sd_flags = M0_SDF_TERMINAL,
.sd_name = "computation-finalize",
.sd_allowed = 0
}
}
Definition: isc.c:395
Definition: isc.c:394
#define M0_BITS(...)
Definition: misc.h:236
Definition: isc.c:396

Definition at line 400 of file isc.c.

◆ comp_exec_fom_states_conf

const struct m0_sm_conf comp_exec_fom_states_conf
static
Initial value:
= {
.scf_name = "computation-execution-fom",
.scf_nr_states = ARRAY_SIZE(comp_exec_fom_states),
.scf_state = comp_exec_fom_states,
}
struct m0_sm_state_descr comp_exec_fom_states[]
Definition: isc.c:400
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 426 of file isc.c.

◆ comp_exec_fom_type

struct m0_fom_type comp_exec_fom_type
static

Definition at line 432 of file isc.c.

◆ comp_exec_fom_type_ops

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

Definition at line 433 of file isc.c.

◆ isc_fom_ops

const struct m0_fom_ops isc_fom_ops
static
Initial value:
= {
.fo_tick = &isc_fom_tick,
.fo_home_locality = &fom_home_locality,
.fo_fini = &isc_fom_fini
}
static void isc_fom_fini(struct m0_fom *fom)
Definition: isc.c:271
static size_t fom_home_locality(const struct m0_fom *fom)
Definition: isc.c:104
static int isc_fom_tick(struct m0_fom *fom)
Definition: isc.c:208

Definition at line 281 of file isc.c.

◆ isc_fom_phases

struct m0_sm_state_descr isc_fom_phases[]
Initial value:
= {
.sd_name = "prepare",
},
.sd_name = "load-arguments",
.sd_allowed = M0_BITS(ISC_ARGS_LOAD_DONE)
},
.sd_name = "args-load-done",
},
.sd_name = "comp-launch",
},
.sd_name = "ret-val",
.sd_allowed = M0_BITS(ISC_RET_VAL_DONE)
},
.sd_name = "ret-val-done",
},
[ISC_DONE] = {
.sd_name = "done",
.sd_allowed = M0_BITS(M0_FOPH_SUCCESS)
}
}
#define M0_BITS(...)
Definition: misc.h:236
Definition: isc.c:70

Definition at line 73 of file isc.c.

◆ isc_sm_conf

struct m0_sm_conf isc_sm_conf
Initial value:
= {
.scf_name = "isc-fom",
.scf_nr_states = ARRAY_SIZE(isc_fom_phases),
.scf_state = isc_fom_phases,
}
struct m0_sm_state_descr isc_fom_phases[]
Definition: isc.c:73
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 386 of file isc.c.

◆ m0_fom_isc_type_ops

const struct m0_fom_type_ops m0_fom_isc_type_ops
Initial value:
= {
.fto_create = isc_fom_create
}
static int isc_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: isc.c:287

Definition at line 382 of file isc.c.