Motr  M0
Motr Setup

Data Structures

struct  m0_proc_attr
 
struct  cs_args
 
struct  cs_endpoint_and_xprt
 
struct  cs_stob_file
 
struct  cs_stobs
 
struct  m0_reqh_context
 
struct  m0_motr
 
struct  cs_ad_stob
 
struct  cs_buffer_pool
 

Macros

#define CS_MODULE_LEVEL(level)
 
#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_M0D
 

Enumerations

enum  result_status { M0_RESULT_STATUS_WORK = 0, M0_RESULT_STATUS_STOP = 1, M0_RESULT_STATUS_RESTART = 2 }
 
enum  { M0_PROCESS_ATTRIBUTE_NO_MEMLIMIT = 0 }
 
enum  { M0_BC_REPAIR_ZONE_SAFETY_MUL = 1, M0_BC_REPAIR_ZONE_SAFETY_DIV = 1, M0_BC_REPAIR_ZONE_MAX_ALLOWED = 40 }
 
enum  cs_level {
  CS_LEVEL_MOTR_INIT, CS_LEVEL_BUFFER_POOL_AND_NET_DOMAINS_FINI_WORKAROUND, CS_LEVEL_REQH_CTX_INIT, CS_LEVEL_CS_INIT,
  CS_LEVEL_RWLOCK_LOCK, CS_LEVEL_ARGS_PARSE, CS_LEVEL_REQH_CTX_VALIDATE, CS_LEVEL_DAEMONIZE,
  CS_LEVEL_NET_DOMAINS_INIT, CS_LEVEL_BUFFER_POOL_SETUP, CS_LEVEL_REQH_START, CS_LEVEL_RPC_MACHINES_INIT,
  CS_LEVEL_HA_INIT, CS_LEVEL_HA_CONNECT_ATTEMPT1, CS_LEVEL_REQH_STOP_WORKAROUND, CS_LEVEL_RCONFC_INIT_START,
  CS_LEVEL_CONF_GET, CS_LEVEL_CONF_FULL_LOAD, CS_LEVEL_CONF_SERVICES_INIT, CS_LEVEL_CONF_TO_ARGS,
  CS_LEVEL_CONF_ARGS_PARSE, CS_LEVEL_HA_CONNECT_ATTEMPT2, CS_LEVEL_POOLS_COMMON_INIT, CS_LEVEL_POOLS_SETUP,
  CS_LEVEL_SET_OOSTORE, CS_LEVEL_REQH_CTX_SERVICES_VALIDATE, CS_LEVEL_CONF_FS_CONFC_CLOSE, CS_LEVEL_STORAGE_SETUP,
  CS_LEVEL_DTM0_INIT, CS_LEVEL_RWLOCK_UNLOCK, CS_LEVEL_STARTED_EVENT_FOR_MKFS, CS_LEVEL_RCONFC_FATAL_CALLBACK,
  CS_LEVEL_DIX_SETUP, CS_LEVEL_SETUP_ENV, CS_LEVEL_CHECK_CONFIG, CS_LEVEL_CONF_GET2,
  CS_LEVEL_POOLS_SERVICE_CTX_CREATE, CS_LEVEL_POOL_VERSIONS_SETUP, CS_LEVEL_REQH_SERVICES_START, CS_LEVEL_REQH_MDPOOL_LAYOUTS_SETUP,
  CS_LEVEL_CONF_CONFC_HA_UPDATE, CS_LEVEL_CONF_FS_CONFC_CLOSE2, CS_LEVEL_STARTED_EVENT_FOR_M0D, CS_LEVEL_START
}
 
enum  { M0_SETUP_DEFAULT_POOL_WIDTH = 10 }
 
enum  { M0_AD_STOB_DOM_KEY_DEFAULT = 0x1, M0_ADDB2_STOB_DOM_KEY = 0xaddbf11e, M0_BE_SEG_SIZE_DEFAULT = 128 * 1024 * 1024ULL }
 
enum  stob_type { M0_LINUX_STOB, M0_AD_STOB, M0_STOB_TYPE_NR }
 
enum  cs_reqh_ctx_states { RC_UNINITIALISED, RC_REQH_INITIALISED, RC_INITIALISED }
 
enum  { CS_MAX_EP_ADDR_LEN = 86 }
 

Functions

static void cs_term_sig_handler (int signum)
 
static int cs_register_signal (void)
 
static int cs_wait_signal (void)
 
M0_INTERNAL int main (int argc, char **argv)
 
static int reqh_memlimit_set (uint resource, uint64_t limit)
 
int m0_cs_memory_limits_setup (struct m0 *instance)
 
 M0_TL_DESCR_DEFINE (cs_buffer_pools, "buffer pools in the motr context", static, struct cs_buffer_pool, cs_bp_linkage, cs_bp_magic, M0_CS_BUFFER_POOL_MAGIC, M0_CS_BUFFER_POOL_HEAD_MAGIC)
 
 M0_TL_DEFINE (cs_buffer_pools, static, struct cs_buffer_pool)
 
 M0_TL_DESCR_DEFINE (cs_eps, "cs endpoints",, struct cs_endpoint_and_xprt, ex_linkage, ex_magix, M0_CS_ENDPOINT_AND_XPRT_MAGIC, M0_CS_EPS_HEAD_MAGIC)
 
 M0_TL_DEFINE (cs_eps, M0_INTERNAL, struct cs_endpoint_and_xprt)
 
 M0_BOB_DEFINE (extern, &cs_eps_bob, cs_endpoint_and_xprt)
 
static bool reqh_context_check (const void *bob)
 
 M0_BOB_DEFINE (static, &rhctx_bob, m0_reqh_context)
 
 M0_TL_DESCR_DEFINE (ndom, "network domains", static, struct m0_net_domain, nd_app_linkage, nd_magix, M0_NET_DOMAIN_MAGIC, M0_CS_NET_DOMAIN_HEAD_MAGIC)
 
 M0_TL_DEFINE (ndom, static, struct m0_net_domain)
 
 M0_BOB_DEFINE (static, &ndom_bob, m0_net_domain)
 
 M0_BOB_DEFINE (static inline, &cs_bob_type, m0_motr)
 
static bool reqh_ctx_services_are_valid (const struct m0_reqh_context *rctx)
 
static bool reqh_context_invariant (const struct m0_reqh_context *rctx)
 
static struct m0_reqhmotr2reqh (struct m0_motr *motr)
 
static struct m0_rconfcmotr2rconfc (struct m0_motr *motr)
 
M0_INTERNAL struct m0_confcm0_motr2confc (struct m0_motr *motr)
 
M0_INTERNAL struct m0_rpc_machinem0_motr_to_rmach (struct m0_motr *motr)
 
static struct m0_net_xprtcs_xprt_lookup (const char *xprt_name, struct m0_net_xprt **xprts, size_t xprts_nr)
 
static void cs_xprts_list (FILE *out, struct m0_net_xprt **xprts, size_t xprts_nr)
 
static void cs_stob_types_list (FILE *out)
 
static bool stype_is_valid (const char *stype)
 
static bool cs_endpoint_is_duplicate (const struct m0_reqh_context *rctx, const struct m0_net_xprt *xprt, const char *ep)
 
static int cs_endpoint_validate (struct m0_motr *cctx, const char *ep, const char *xprt_name)
 
M0_INTERNAL int m0_ep_and_xprt_extract (struct cs_endpoint_and_xprt *epx, const char *ep)
 
M0_INTERNAL void m0_ep_and_xprt_fini (struct cs_endpoint_and_xprt *epx)
 
static int ep_and_xprt_append (struct m0_tl *head, const char *ep)
 
static bool service_is_duplicate (const struct m0_reqh_context *rctx, const char *sname)
 
static int cs_reqh_ctx_init (struct m0_motr *cctx)
 
static void cs_reqh_ctx_fini (struct m0_reqh_context *rctx)
 
M0_INTERNAL struct m0_net_domainm0_cs_net_domain_locate (struct m0_motr *cctx, const char *xprt_name)
 
static struct m0_net_buffer_poolcs_buffer_pool_get (struct m0_motr *cctx, struct m0_net_domain *ndom)
 
static int cs_rpc_machine_init (struct m0_motr *cctx, const char *xprt_name, const char *ep, const uint32_t tm_colour, const uint32_t recv_queue_min_length, const uint32_t max_rpc_msg_size, struct m0_reqh *reqh)
 
static int cs_rpc_machines_init (struct m0_motr *cctx)
 
static void cs_rpc_machines_fini (struct m0_reqh *reqh)
 
static int cs_ha_init (struct m0_motr *cctx)
 
static bool bad_address (char *addr)
 
static void cs_ha_process_event (struct m0_motr *cctx, enum m0_conf_ha_process_event event)
 
static void cs_ha_stop (struct m0_motr *cctx)
 
static void cs_ha_fini (struct m0_motr *cctx)
 
static uint32_t cs_domain_tms_nr (struct m0_reqh_context *rctx, struct m0_net_domain *dom)
 
static uint32_t cs_dom_tm_min_recv_queue_total (struct m0_reqh_context *rctx, struct m0_net_domain *dom)
 
static void cs_buffer_pool_fini (struct m0_motr *cctx)
 
static int cs_buffer_pool_setup (struct m0_motr *cctx)
 
static int stob_file_id_get (yaml_document_t *doc, yaml_node_t *node, uint64_t *id)
 
static const char * stob_file_path_get (yaml_document_t *doc, yaml_node_t *node)
 
static int cs_stob_file_load (const char *dfile, struct cs_stobs *stob)
 
static void cs_storage_devs_fini (void)
 
static int cs_storage_devs_init (struct cs_stobs *stob, enum m0_storage_dev_type type, struct m0_be_seg *seg, const char *stob_path, bool force, bool disable_direct_io)
 
static char * cs_storage_ldom_location_gen (const char *stob_path)
 
static int cs_storage_ldom_destroy (const char *stob_path, const char *str_cfg_init)
 
static int cs_storage_bstore_prepare (const char *stob_path, const char *str_cfg_init, uint64_t dom_key, bool mkfs, struct m0_stob_domain **out)
 
static int cs_storage_init (const char *stob_type, const char *stob_path, uint64_t dom_key, struct cs_stobs *stob, struct m0_be_seg *seg, bool mkfs, bool force, bool disable_direct_io)
 
static void cs_storage_fini (struct cs_stobs *stob)
 
M0_INTERNAL int cs_service_init (const char *name, struct m0_reqh_context *rctx, struct m0_reqh *reqh, struct m0_fid *fid)
 
static int reqh_context_services_init (struct m0_reqh_context *rctx, struct m0_motr *cctx)
 
M0_INTERNAL void cs_service_fini (struct m0_reqh_service *service)
 
static void reqh_context_services_fini (struct m0_reqh_context *rctx, struct m0_motr *cctx)
 
static int reqh_services_start (struct m0_reqh_context *rctx, struct m0_motr *cctx)
 
static int cs_net_domain_init (struct cs_endpoint_and_xprt *ep, struct m0_motr *cctx)
 
static int cs_net_domains_init (struct m0_motr *cctx)
 
static void cs_net_domains_fini (struct m0_motr *cctx)
 
static int cs_storage_prepare (struct m0_reqh_context *rctx, bool erase)
 
static void be_seg_init (struct m0_be_ut_backend *be, m0_bcount_t size, bool preallocate, bool format, const char *stob_create_cfg, struct m0_be_seg **out)
 
static bool pver_is_actual (const struct m0_conf_obj *obj)
 
static int be_repair_zone_pcnt_get (struct m0_reqh *reqh, uint32_t *repair_zone_pcnt)
 
static int cs_be_dom_cfg_zone_pcnt_fill (struct m0_reqh *reqh, struct m0_be_domain_cfg *dom_cfg)
 
static int cs_be_init (struct m0_reqh_context *rctx, struct m0_be_ut_backend *be, const char *name, bool preallocate, bool format, struct m0_be_seg **out)
 
M0_INTERNAL void cs_be_fini (struct m0_be_ut_backend *be)
 
static int cs_reqh_start (struct m0_reqh_context *rctx)
 
static int cs_storage_setup (struct m0_motr *cctx)
 
static int cs_dtm0_init (struct m0_reqh_context *rctx)
 
static void cs_dtm0_fini (struct m0_reqh_context *rctx)
 
static void cs_reqh_shutdown (struct m0_reqh_context *rctx)
 
static void cs_reqh_stop (struct m0_reqh_context *rctx)
 
static void cs_reqh_storage_fini (struct m0_reqh_context *rctx)
 
struct m0_reqhm0_cs_reqh_get (struct m0_motr *cctx)
 
M0_INTERNAL struct m0_reqh_contextm0_cs_reqh_context (struct m0_reqh *reqh)
 
M0_INTERNAL struct m0_motrm0_cs_ctx_get (struct m0_reqh *reqh)
 
M0_INTERNAL struct m0_storage_devsm0_cs_storage_devs_get (void)
 
static void cs_motr_init (struct m0_motr *cctx)
 
static void cs_motr_fini (struct m0_motr *cctx)
 
static void cs_usage (FILE *out, const char *progname)
 
static void cs_help (FILE *out, const char *progname)
 
static int cs_reqh_ctx_validate (struct m0_motr *cctx)
 
static int cs_reqh_ctx_services_validate (struct m0_motr *cctx)
 
static int cs_daemonize (struct m0_motr *cctx)
 
static int process_fid_parse (const char *str, struct m0_fid *fid)
 
static void process_fid_generate_conditional (struct m0_reqh_context *rctx)
 
static int _args_parse (struct m0_motr *cctx, int argc, char **argv)
 
static int cs_args_parse (struct m0_motr *cctx, int argc, char **argv)
 
static void cs_ha_connect (struct m0_motr *cctx)
 
static int cs_conf_setup (struct m0_motr *cctx)
 
static void cs_conf_fini (struct m0_motr *cctx)
 
static int cs_reqh_mdpool_layouts_setup (struct m0_motr *cctx)
 
static void cs_rconfc_fatal_cb (struct m0_rconfc *rconfc)
 
M0_INTERNAL void m0_cs_gotsignal_reset (void)
 
static struct m0_motrcs_module2motr (struct m0_module *module)
 
static int cs_level_enter (struct m0_module *module)
 
static void cs_level_leave (struct m0_module *module)
 
int m0_cs_setup_env (struct m0_motr *cctx, int argc, char **argv)
 
int m0_cs_start (struct m0_motr *cctx)
 
int m0_cs_init (struct m0_motr *cctx, struct m0_net_xprt **xprts, size_t xprts_nr, FILE *out, bool mkfs)
 
void m0_cs_fini (struct m0_motr *cctx)
 
M0_INTERNAL int m0_motr_stob_reopen (struct m0_reqh *reqh, struct m0_poolmach *pm, uint32_t dev_id)
 
 M0_BASSERT (CS_MAX_EP_ADDR_LEN >=sizeof "lnet:"+M0_NET_LNET_XEP_ADDR_LEN)
 
 M0_TL_DESCR_DECLARE (cs_eps, extern)
 
 M0_TL_DECLARE (cs_eps, M0_INTERNAL, struct cs_endpoint_and_xprt)
 
 M0_BOB_DECLARE (M0_INTERNAL, cs_endpoint_and_xprt)
 
static void cs_dix_cas_id_make (struct m0_cas_id *cid, struct m0_dix *index, uint32_t sdev_idx)
 
static int cs_dix_create_sync (struct m0_dix *index, uint32_t sdev_idx, struct m0_rpc_link *link)
 
static int cs_dix_keys_vals_init (struct m0_bufvec *keys, struct m0_bufvec *vals, const char *key, const struct m0_fid *fid, struct m0_dix_ldesc *dld)
 
static void cs_dix_keys_vals_fini (struct m0_bufvec *keys, struct m0_bufvec *vals)
 
static int cs_dix_put_sync (struct m0_dix *index, uint32_t sdev_idx, struct m0_bufvec *keys, struct m0_bufvec *vals, struct m0_rpc_link *link)
 
static int cs_dix_put_one (struct m0_dix *index, const char *keystr, const struct m0_fid *fid, struct m0_dix_ldesc *dld, struct m0_pools_common *pc, struct m0_pool_version *pver, struct m0_layout_domain *ldom, struct m0_fid *cas_fid, struct m0_rpc_link *link)
 
static bool cs_dix_pver_is_valid (struct m0_pools_common *pc, struct m0_pool_version *pver)
 
M0_INTERNAL int m0_cs_dix_setup (struct m0_motr *cctx)
 
M0_INTERNAL int cs_conf_to_args (struct cs_args *dest, struct m0_conf_root *r)
 
M0_INTERNAL int cs_conf_storage_init (struct cs_stobs *stob, struct m0_storage_devs *devs, bool force)
 
M0_INTERNAL int cs_conf_device_reopen (struct m0_poolmach *pm, struct cs_stobs *stob, uint32_t dev_id)
 
M0_INTERNAL int cs_conf_services_init (struct m0_motr *cctx)
 

Variables

volatile sig_atomic_t gotsignal
 
static bool regsignal = false
 
struct m0_reqh_service_type m0_ss_svc_type
 
static struct m0_bob_type cs_eps_bob
 
M0_INTERNAL const char * m0_cs_stypes [M0_STOB_TYPE_NR]
 
static struct m0_bob_type rhctx_bob
 
static struct m0_bob_type ndom_bob
 
static const struct m0_bob_type cs_bob_type
 
volatile sig_atomic_t gotsignal
 
static const struct m0_modlev cs_module_levels []
 
M0_EXTERN const char * m0_cs_stypes [M0_STOB_TYPE_NR]
 

Detailed Description

Motr setup program configures a user space motr context on a node in a cluster. There exist a list of network transports supported by a node, which is used to initialise corresponding network domains per motr context, so there exist a network domain per network transport. There can exist multiple request handlers per motr context. Every motr context configures one or more request handler contexts, one per request handler, each containing a storage domain, data base, cob domain, fol and request handler to be initialised. Every request handler contains a list of rpc machines, each configured per given endpoint per network domain. Network domains are shared between multiple request handlers in a motr context. There exist multiple services within a motr context. Each service identifies a particular set of operations that can be executed on a particular node. Services are registered with the request handler which performs the execution of requests directed to a particular service. Thus the services run under request handler context.

Motr setup can be done internally through motr code or externally through cli using m0d program. As motr setup configures the server it should be used in server side initialisation. if done through code, Following has to be done to configure a motr context:

Note
Also user should pass a output file descriptor to which the error messages will be directed.
struct m0_motr motr_ctx;
static struct m0_net_xprt *xprts[] = {
...
};
m0_cs_init(&motr_ctx, xprts, ARRAY_SIZE(xprts), outfile);

Define parameters for motr setup and setup environment as below,

static char *cmd[] = { "m0d", "-T", "AD",
"-D", "cs_db", "-S", "cs_stob",
"-e", "lnet:172.18.50.40@o2ib1:12345:34:1",
"-s", "dummy"};
m0_cs_setup_env(&motr_ctx, ARRAY_SIZE(cs_cmd), cs_cmd);

Once the environment is setup successfully, the services can be started as below,

m0_cs_start(&srv_motr_ctx);
Note
The specified services to be started should be registered before startup.

Failure handling for m0d is done as follows,

Similarly, to setup motr externally, using m0d program along with parameters specified as above. e.g. ./m0d -T linux -D dbpath -S stobfile \ -e xport:172.18.50.40:12345:34:1 -s 'service:ServiceFID'

Below image gives an overview of entire motr context.

Note
This image is borrowed from the "New developer guide for motr" document in section "Starting Motr services".
DS-Reqh.gif

For reconfigure (see m0_ss_process_req) some process attributes save into m0 instance and apply on initialize module phase.

Macro Definition Documentation

◆ CS_MODULE_LEVEL

#define CS_MODULE_LEVEL (   level)
Value:
[level] = { \
.ml_name = #level, \
.ml_enter = cs_level_enter, \
.ml_leave = cs_level_leave, \
}
static int cs_level_enter(struct m0_module *module)
Definition: setup.c:2516
enum m0_trace_level level
Definition: trace.c:111
static void cs_level_leave(struct m0_module *module)
Definition: setup.c:2753

Definition at line 2918 of file setup.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_M0D

Definition at line 29 of file setup_dix.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_PROCESS_ATTRIBUTE_NO_MEMLIMIT 

Default value of Process attribute. Attribute not reply if set to this value.

Definition at line 40 of file process_attr.h.

◆ anonymous enum

anonymous enum

The space for M0_BAP_REPAIR zone in BE allocator is calculated based on distributed index replication factor and total number of target disks. But due to fragmentation or some other reasons it may be not sufficient, so special "safety" coefficient is introduced to increase space in repair zone. Safety coefficient is defined as "safety mul"/"safety div".

If repair zone percentage crosses M0_BC_REPAIR_ZONE_MAX_ALLOWED, user has to choose appropriate spare value.

Todo:
We need to revisit the need of spare space reservation once DIX direct rebalance is implemented.
Enumerator
M0_BC_REPAIR_ZONE_SAFETY_MUL 

Multiplier of a repair zone safety coefficient.

M0_BC_REPAIR_ZONE_SAFETY_DIV 

Divider of a repair zone safety coefficient.

M0_BC_REPAIR_ZONE_MAX_ALLOWED 

Maximum allowed repair zone percentage

Definition at line 91 of file setup.c.

◆ anonymous enum

anonymous enum
Enumerator
M0_SETUP_DEFAULT_POOL_WIDTH 

Definition at line 134 of file setup.h.

◆ anonymous enum

anonymous enum
Enumerator
M0_AD_STOB_DOM_KEY_DEFAULT 
M0_ADDB2_STOB_DOM_KEY 
M0_BE_SEG_SIZE_DEFAULT 

Definition at line 138 of file setup.h.

◆ anonymous enum

anonymous enum
Enumerator
CS_MAX_EP_ADDR_LEN 

Definition at line 472 of file setup.h.

◆ cs_level

enum cs_level

motr/setup initialisation levels.

Future improvements:

  • fix CS_LEVEL_BUFFER_POOL_AND_NET_DOMAINS_FINI_WORKAROUND;
  • define m0_rconfc and m0_ha init order and call cs_ha_connect() only once;
  • finalise subsystems at the same level they were initialised. It would ensure the right finalisation order for the subsystems that depend on each other;
  • make m0_cs_init()/m0_cs_setup_env()/m0_cs_start() a single function;
  • group the relevant subsystem initialisers and finalisers into separate m0_modules. It's not possible to do this before the init/fini are not matched in the existing "single module for entire motr/setup" scheme;
  • fix double m0_confc_root_open()/m0_confc_close() for the filesystem conf obj;
  • fix "if (cctx->cc_no_conf) return M0_RC(0)" copy-paste one way or another;
  • pass parameters to m0_cs_init()/m0_cs_setup_env()/m0_cs_start() using m0_conf wherever possible;
  • make some steps (like storage) optional through configuration;
  • make platform-dependent code to a new abstraction or hide it under #ifdef KERNEL:
    • signal handling and kernel module load/unload handling;
    • setrlimit (take from m0d code);
    • process restart (currently implemented in motr/m0d.c and it's not used);
  • move m0t1fs, client and m0_halon_interface init/fini code to the new motr/setup;
  • reconsider m0_reqh/m0_rpc_machine/m0_net/m0_net_buffer_pool init/fini sequence.
Enumerator
CS_LEVEL_MOTR_INIT 
CS_LEVEL_BUFFER_POOL_AND_NET_DOMAINS_FINI_WORKAROUND 
CS_LEVEL_REQH_CTX_INIT 
CS_LEVEL_CS_INIT 
CS_LEVEL_RWLOCK_LOCK 
CS_LEVEL_ARGS_PARSE 
CS_LEVEL_REQH_CTX_VALIDATE 
CS_LEVEL_DAEMONIZE 
CS_LEVEL_NET_DOMAINS_INIT 
CS_LEVEL_BUFFER_POOL_SETUP 
CS_LEVEL_REQH_START 
CS_LEVEL_RPC_MACHINES_INIT 
CS_LEVEL_HA_INIT 
CS_LEVEL_HA_CONNECT_ATTEMPT1 
CS_LEVEL_REQH_STOP_WORKAROUND 
CS_LEVEL_RCONFC_INIT_START 
CS_LEVEL_CONF_GET 
CS_LEVEL_CONF_FULL_LOAD 
CS_LEVEL_CONF_SERVICES_INIT 
CS_LEVEL_CONF_TO_ARGS 
CS_LEVEL_CONF_ARGS_PARSE 
CS_LEVEL_HA_CONNECT_ATTEMPT2 
CS_LEVEL_POOLS_COMMON_INIT 
CS_LEVEL_POOLS_SETUP 
CS_LEVEL_SET_OOSTORE 
CS_LEVEL_REQH_CTX_SERVICES_VALIDATE 
CS_LEVEL_CONF_FS_CONFC_CLOSE 
CS_LEVEL_STORAGE_SETUP 
CS_LEVEL_DTM0_INIT 
CS_LEVEL_RWLOCK_UNLOCK 
CS_LEVEL_STARTED_EVENT_FOR_MKFS 
CS_LEVEL_RCONFC_FATAL_CALLBACK 
CS_LEVEL_DIX_SETUP 
CS_LEVEL_SETUP_ENV 
CS_LEVEL_CHECK_CONFIG 
CS_LEVEL_CONF_GET2 
CS_LEVEL_POOLS_SERVICE_CTX_CREATE 
CS_LEVEL_POOL_VERSIONS_SETUP 
CS_LEVEL_REQH_SERVICES_START 
CS_LEVEL_REQH_MDPOOL_LAYOUTS_SETUP 
CS_LEVEL_CONF_CONFC_HA_UPDATE 
CS_LEVEL_CONF_FS_CONFC_CLOSE2 
CS_LEVEL_STARTED_EVENT_FOR_M0D 
CS_LEVEL_START 

Definition at line 2455 of file setup.c.

◆ cs_reqh_ctx_states

States of m0_motr::cc_reqh_ctx.

Enumerator
RC_UNINITIALISED 
RC_REQH_INITIALISED 
RC_INITIALISED 

Definition at line 216 of file setup.h.

◆ result_status

Enumerator
M0_RESULT_STATUS_WORK 
M0_RESULT_STATUS_STOP 
M0_RESULT_STATUS_RESTART 

Definition at line 58 of file m0d.c.

◆ stob_type

enum stob_type
Enumerator
M0_LINUX_STOB 
M0_AD_STOB 
M0_STOB_TYPE_NR 

Definition at line 144 of file setup.h.

Function Documentation

◆ _args_parse()

static int _args_parse ( struct m0_motr cctx,
int  argc,
char **  argv 
)
static

Parses CLI arguments, filling m0_motr structure.

Definition at line 2048 of file setup.c.

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

◆ bad_address()

static bool bad_address ( char *  addr)
static

Definition at line 613 of file setup.c.

Here is the caller graph for this function:

◆ be_repair_zone_pcnt_get()

static int be_repair_zone_pcnt_get ( struct m0_reqh reqh,
uint32_t *  repair_zone_pcnt 
)
static

Read configuration and calculate percent for M0_BAP_REPAIR zone.

Definition at line 1398 of file setup.c.

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

◆ be_seg_init()

static void be_seg_init ( struct m0_be_ut_backend be,
m0_bcount_t  size,
bool  preallocate,
bool  format,
const char *  stob_create_cfg,
struct m0_be_seg **  out 
)
static

Definition at line 1362 of file setup.c.

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

◆ cs_args_parse()

static int cs_args_parse ( struct m0_motr cctx,
int  argc,
char **  argv 
)
static

Definition at line 2341 of file setup.c.

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

◆ cs_be_dom_cfg_zone_pcnt_fill()

static int cs_be_dom_cfg_zone_pcnt_fill ( struct m0_reqh reqh,
struct m0_be_domain_cfg dom_cfg 
)
static

Definition at line 1451 of file setup.c.

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

◆ cs_be_fini()

M0_INTERNAL void cs_be_fini ( struct m0_be_ut_backend be)

Definition at line 1551 of file setup.c.

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

◆ cs_be_init()

static int cs_be_init ( struct m0_reqh_context rctx,
struct m0_be_ut_backend be,
const char *  name,
bool  preallocate,
bool  format,
struct m0_be_seg **  out 
)
static

Definition at line 1468 of file setup.c.

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

◆ cs_buffer_pool_fini()

static void cs_buffer_pool_fini ( struct m0_motr cctx)
static

Definition at line 692 of file setup.c.

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

◆ cs_buffer_pool_get()

static struct m0_net_buffer_pool* cs_buffer_pool_get ( struct m0_motr cctx,
struct m0_net_domain ndom 
)
static

Definition at line 481 of file setup.c.

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

◆ cs_buffer_pool_setup()

static int cs_buffer_pool_setup ( struct m0_motr cctx)
static

Definition at line 705 of file setup.c.

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

◆ cs_conf_device_reopen()

M0_INTERNAL int cs_conf_device_reopen ( struct m0_poolmach pm,
struct cs_stobs stob,
uint32_t  dev_id 
)

Definition at line 520 of file conf.c.

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

◆ cs_conf_fini()

static void cs_conf_fini ( struct m0_motr cctx)
static

Definition at line 2384 of file setup.c.

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

◆ cs_conf_services_init()

M0_INTERNAL int cs_conf_services_init ( struct m0_motr cctx)

Definition at line 464 of file conf.c.

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

◆ cs_conf_setup()

static int cs_conf_setup ( struct m0_motr cctx)
static

Definition at line 2353 of file setup.c.

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

◆ cs_conf_storage_init()

M0_INTERNAL int cs_conf_storage_init ( struct cs_stobs stob,
struct m0_storage_devs devs,
bool  force 
)

Definition at line 398 of file conf.c.

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

◆ cs_conf_to_args()

M0_INTERNAL int cs_conf_to_args ( struct cs_args dest,
struct m0_conf_root r 
)

Uses confc API to generate CLI arguments, understood by _args_parse().

Definition at line 159 of file conf.c.

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

◆ cs_daemonize()

static int cs_daemonize ( struct m0_motr cctx)
static

Causes the process to run as a daemon if appropriate context flag is set. This involves forking, detaching from the keyboard if any, and ensuring SIGHUP will not affect the process.

Note
Must be called before any long-lived threads are created (i.e. at the time of calling, only the main thread should exist, although it is acceptable if threads are created and destroyed before going into daemon mode). There is no Linux API to enforce this requirement.
A trace log file opened before this function is called has a different process ID in the name than the process that continues to write to the file.

Definition at line 2019 of file setup.c.

Here is the caller graph for this function:

◆ cs_dix_cas_id_make()

static void cs_dix_cas_id_make ( struct m0_cas_id cid,
struct m0_dix index,
uint32_t  sdev_idx 
)
static

Definition at line 49 of file setup_dix.c.

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

◆ cs_dix_create_sync()

static int cs_dix_create_sync ( struct m0_dix index,
uint32_t  sdev_idx,
struct m0_rpc_link link 
)
static

Definition at line 65 of file setup_dix.c.

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

◆ cs_dix_keys_vals_fini()

static void cs_dix_keys_vals_fini ( struct m0_bufvec keys,
struct m0_bufvec vals 
)
static

Definition at line 125 of file setup_dix.c.

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

◆ cs_dix_keys_vals_init()

static int cs_dix_keys_vals_init ( struct m0_bufvec keys,
struct m0_bufvec vals,
const char *  key,
const struct m0_fid fid,
struct m0_dix_ldesc dld 
)
static

Definition at line 100 of file setup_dix.c.

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

◆ cs_dix_put_one()

static int cs_dix_put_one ( struct m0_dix index,
const char *  keystr,
const struct m0_fid fid,
struct m0_dix_ldesc dld,
struct m0_pools_common pc,
struct m0_pool_version pver,
struct m0_layout_domain ldom,
struct m0_fid cas_fid,
struct m0_rpc_link link 
)
static

Definition at line 171 of file setup_dix.c.

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

◆ cs_dix_put_sync()

static int cs_dix_put_sync ( struct m0_dix index,
uint32_t  sdev_idx,
struct m0_bufvec keys,
struct m0_bufvec vals,
struct m0_rpc_link link 
)
static

Definition at line 132 of file setup_dix.c.

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

◆ cs_dix_pver_is_valid()

static bool cs_dix_pver_is_valid ( struct m0_pools_common pc,
struct m0_pool_version pver 
)
static

Definition at line 230 of file setup_dix.c.

Here is the caller graph for this function:

◆ cs_dom_tm_min_recv_queue_total()

static uint32_t cs_dom_tm_min_recv_queue_total ( struct m0_reqh_context rctx,
struct m0_net_domain dom 
)
static

Definition at line 677 of file setup.c.

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

◆ cs_domain_tms_nr()

static uint32_t cs_domain_tms_nr ( struct m0_reqh_context rctx,
struct m0_net_domain dom 
)
static

Definition at line 663 of file setup.c.

Here is the caller graph for this function:

◆ cs_dtm0_fini()

static void cs_dtm0_fini ( struct m0_reqh_context rctx)
static

Definition at line 1698 of file setup.c.

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

◆ cs_dtm0_init()

static int cs_dtm0_init ( struct m0_reqh_context rctx)
static

Definition at line 1693 of file setup.c.

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

◆ cs_endpoint_is_duplicate()

static bool cs_endpoint_is_duplicate ( const struct m0_reqh_context rctx,
const struct m0_net_xprt xprt,
const char *  ep 
)
static

Checks if given network transport and network endpoint address are already in use in a request handler context.

Definition at line 263 of file setup.c.

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

◆ cs_endpoint_validate()

static int cs_endpoint_validate ( struct m0_motr cctx,
const char *  ep,
const char *  xprt_name 
)
static

Checks if given network endpoint address and network transport are valid and if they are already in use in given motr context.

Parameters
cctxMotr context
epNetwork endpoint address
xprt_nameNetwork transport name
Precondition
cctx != NULL && ep != NULL && xprt_name != NULL
Return values
0On success -EINVAL If endpoint is invalid -EADDRINUSE If endpoint is already in use

Definition at line 305 of file setup.c.

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

◆ cs_ha_connect()

static void cs_ha_connect ( struct m0_motr cctx)
static

Definition at line 2347 of file setup.c.

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

◆ cs_ha_fini()

static void cs_ha_fini ( struct m0_motr cctx)
static

Definition at line 655 of file setup.c.

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

◆ cs_ha_init()

static int cs_ha_init ( struct m0_motr cctx)
static

Establishes rpc session to HA service. The session is set up to be used globally across all motr modules.

Definition at line 581 of file setup.c.

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

◆ cs_ha_process_event()

static void cs_ha_process_event ( struct m0_motr cctx,
enum m0_conf_ha_process_event  event 
)
static

Definition at line 618 of file setup.c.

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

◆ cs_ha_stop()

static void cs_ha_stop ( struct m0_motr cctx)
static

Clears global HA session info and terminates rpc session to HA service.

Definition at line 637 of file setup.c.

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

◆ cs_help()

static void cs_help ( FILE *  out,
const char *  progname 
)
static

Definition at line 1849 of file setup.c.

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

◆ cs_level_enter()

static int cs_level_enter ( struct m0_module module)
static

If a signal is recieved in CS_LEVEL_REQH_STOP_WORKAROUND, m0_module_fini is called, In m0_module_fini CS_LEVEL_RPC_MACHINES_INIT would assert because there are active ongoing connection. ideally connections are closed in cs_ha_fini during cs_level_leave:: CS_LEVEL_REQH_STOP_WORKAROUND. In cs_level_enter::CS_LEVEL_REQH_STOP_WORKAROUND, it does nothing so just skip the error in CS_LEVEL_REQH_STOP_WORKAROUND which will be handled in the next state. during fini, cs_ha_fini is called before CS_LEVEL_RPC_MACHINES_INIT

During cs_level_enter, if signal is recieved, then signal handling is skipped and handled in the next state, before adding any change refer comments in gotsignal.

Definition at line 2516 of file setup.c.

Here is the call graph for this function:

◆ cs_level_leave()

static void cs_level_leave ( struct m0_module module)
static

Definition at line 2753 of file setup.c.

Here is the call graph for this function:

◆ cs_module2motr()

static struct m0_motr* cs_module2motr ( struct m0_module module)
static

Definition at line 2511 of file setup.c.

Here is the caller graph for this function:

◆ cs_motr_fini()

static void cs_motr_fini ( struct m0_motr cctx)
static

Definition at line 1807 of file setup.c.

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

◆ cs_motr_init()

static void cs_motr_init ( struct m0_motr cctx)
static

Definition at line 1788 of file setup.c.

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

◆ cs_net_domain_init()

static int cs_net_domain_init ( struct cs_endpoint_and_xprt ep,
struct m0_motr cctx 
)
static

Definition at line 1247 of file setup.c.

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

◆ cs_net_domains_fini()

static void cs_net_domains_fini ( struct m0_motr cctx)
static

Finalises all the network domains within a motr context.

Parameters
cctxMotr context to which the network domains belong

Definition at line 1306 of file setup.c.

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

◆ cs_net_domains_init()

static int cs_net_domains_init ( struct m0_motr cctx)
static

Initialises network domains per given distinct xport:endpoint pair in a motr context.

Definition at line 1285 of file setup.c.

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

◆ cs_rconfc_fatal_cb()

static void cs_rconfc_fatal_cb ( struct m0_rconfc rconfc)
static

The callback is installed to m0_rconfc::rc_fatal_cb intended to catch rconfc failure state, and because of that shut down m0d nicely. With rconfc failed motr instance becomes non-functional, as long as conf reading is impossible.

The callback sends SIGINT to itself resulting eventually in m0_cs_fini() call.

Definition at line 2405 of file setup.c.

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

◆ cs_register_signal()

static int cs_register_signal ( void  )
static

Registers signal handler to catch SIGTERM, SIGINT and SIGQUIT signals and pauses the Motr process. Registers signal handler to catch SIGUSR1 signals to restart the Motr process.

Definition at line 87 of file m0d.c.

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

◆ cs_reqh_ctx_fini()

static void cs_reqh_ctx_fini ( struct m0_reqh_context rctx)
static

Definition at line 444 of file setup.c.

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

◆ cs_reqh_ctx_init()

static int cs_reqh_ctx_init ( struct m0_motr cctx)
static

Definition at line 419 of file setup.c.

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

◆ cs_reqh_ctx_services_validate()

static int cs_reqh_ctx_services_validate ( struct m0_motr cctx)
static

Definition at line 1982 of file setup.c.

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

◆ cs_reqh_ctx_validate()

static int cs_reqh_ctx_validate ( struct m0_motr cctx)
static

Definition at line 1933 of file setup.c.

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

◆ cs_reqh_mdpool_layouts_setup()

static int cs_reqh_mdpool_layouts_setup ( struct m0_motr cctx)
static

Definition at line 2393 of file setup.c.

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

◆ cs_reqh_shutdown()

static void cs_reqh_shutdown ( struct m0_reqh_context rctx)
static

Definition at line 1703 of file setup.c.

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

◆ cs_reqh_start()

static int cs_reqh_start ( struct m0_reqh_context rctx)
static

Initialises a request handler context. A request handler context consists of the storage domain, database, cob domain, fol and request handler instance to be initialised. The request handler context is allocated and initialised per request handler in a motr process per node. So, there can exist multiple request handlers and thus multiple request handler contexts in a motr context.

Parameters
rctxRequest handler context to be initialised

Definition at line 1567 of file setup.c.

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

◆ cs_reqh_stop()

static void cs_reqh_stop ( struct m0_reqh_context rctx)
static

Finalises a request handler context. Sets m0_reqh::rh_shutdown true, and checks if the request handler can be shutdown by invoking m0_reqh_can_shutdown(). This waits until m0_reqh_can_shutdown() returns true and then proceeds for further cleanup.

Parameters
rctxRequest handler context to be finalised
Precondition
reqh_context_invariant()

Definition at line 1734 of file setup.c.

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

◆ cs_reqh_storage_fini()

static void cs_reqh_storage_fini ( struct m0_reqh_context rctx)
static

Definition at line 1748 of file setup.c.

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

◆ cs_rpc_machine_init()

static int cs_rpc_machine_init ( struct m0_motr cctx,
const char *  xprt_name,
const char *  ep,
const uint32_t  tm_colour,
const uint32_t  recv_queue_min_length,
const uint32_t  max_rpc_msg_size,
struct m0_reqh reqh 
)
static

Initialises rpc machine for the given endpoint address. Once the new rpc_machine is created it is added to list of rpc machines in given request handler. Request handler should be initialised before invoking this function.

Parameters
cctxMotr context
xprt_nameNetwork transport
epNetwork endpoint address
tm_colourUnique colour to be assigned to each TM in a domain
recv_queue_min_lengthMinimum number of buffers in TM receive queue
max_rpc_msg_sizeMaximum RPC message size
reqhRequest handler to which the newly created rpc_machine belongs
Precondition
cctx != NULL && xprt_name != NULL && ep != NULL && reqh != NULL

Definition at line 510 of file setup.c.

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

◆ cs_rpc_machines_fini()

static void cs_rpc_machines_fini ( struct m0_reqh reqh)
static

Definition at line 566 of file setup.c.

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

◆ cs_rpc_machines_init()

static int cs_rpc_machines_init ( struct m0_motr cctx)
static

Definition at line 542 of file setup.c.

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

◆ cs_service_fini()

M0_INTERNAL void cs_service_fini ( struct m0_reqh_service service)

Definition at line 1178 of file setup.c.

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

◆ cs_service_init()

M0_INTERNAL int cs_service_init ( const char *  name,
struct m0_reqh_context rctx,
struct m0_reqh reqh,
struct m0_fid fid 
)

Initialises and starts a particular service.

Once the service is initialised, it is started and registered with the appropriate request handler.

Definition at line 1117 of file setup.c.

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

◆ cs_stob_file_load()

static int cs_stob_file_load ( const char *  dfile,
struct cs_stobs stob 
)
static

Definition at line 778 of file setup.c.

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

◆ cs_stob_types_list()

static void cs_stob_types_list ( FILE *  out)
static

Lists supported stob types.

Definition at line 239 of file setup.c.

Here is the caller graph for this function:

◆ cs_storage_bstore_prepare()

static int cs_storage_bstore_prepare ( const char *  stob_path,
const char *  str_cfg_init,
uint64_t  dom_key,
bool  mkfs,
struct m0_stob_domain **  out 
)
static

Definition at line 997 of file setup.c.

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

◆ cs_storage_devs_fini()

static void cs_storage_devs_fini ( void  )
static

Definition at line 807 of file setup.c.

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

◆ cs_storage_devs_init()

static int cs_storage_devs_init ( struct cs_stobs stob,
enum m0_storage_dev_type  type,
struct m0_be_seg seg,
const char *  stob_path,
bool  force,
bool  disable_direct_io 
)
static

Initialise storage devices used by IO service.

Definition at line 820 of file setup.c.

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

◆ cs_storage_fini()

static void cs_storage_fini ( struct cs_stobs stob)
static

Finalises storage for a request handler in a motr context.

Definition at line 1102 of file setup.c.

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

◆ cs_storage_init()

static int cs_storage_init ( const char *  stob_type,
const char *  stob_path,
uint64_t  dom_key,
struct cs_stobs stob,
struct m0_be_seg seg,
bool  mkfs,
bool  force,
bool  disable_direct_io 
)
static

Initialises storage including database environment and stob domain of given type (e.g. linux or ad). There is a stob domain and a database environment created per request handler context.

Todo:
Use generic mechanism to generate stob ids

Definition at line 1047 of file setup.c.

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

◆ cs_storage_ldom_destroy()

static int cs_storage_ldom_destroy ( const char *  stob_path,
const char *  str_cfg_init 
)
static

Destroys linuxstob domain. This function is used when mkfs runs with the force option. Therefore, domain may not exist.

Definition at line 971 of file setup.c.

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

◆ cs_storage_ldom_location_gen()

static char* cs_storage_ldom_location_gen ( const char *  stob_path)
static

Generates linuxstob domain location which must be freed with m0_free().

Definition at line 955 of file setup.c.

Here is the caller graph for this function:

◆ cs_storage_prepare()

static int cs_storage_prepare ( struct m0_reqh_context rctx,
bool  erase 
)
static

Definition at line 1319 of file setup.c.

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

◆ cs_storage_setup()

static int cs_storage_setup ( struct m0_motr cctx)
static
Todo:
Have a generic mechanism to generate unique cob domain id. Handle error messages properly.

Definition at line 1582 of file setup.c.

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

◆ cs_term_sig_handler()

static void cs_term_sig_handler ( int  signum)
static

Signal handler registered so that pause() returns in order to trigger proper cleanup.

Definition at line 75 of file m0d.c.

Here is the caller graph for this function:

◆ cs_usage()

static void cs_usage ( FILE *  out,
const char *  progname 
)
static

Definition at line 1837 of file setup.c.

Here is the caller graph for this function:

◆ cs_wait_signal()

static int cs_wait_signal ( void  )
static

Definition at line 107 of file m0d.c.

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

◆ cs_xprt_lookup()

static struct m0_net_xprt* cs_xprt_lookup ( const char *  xprt_name,
struct m0_net_xprt **  xprts,
size_t  xprts_nr 
)
static

Looks up an xprt by the name.

Parameters
xprt_nameNetwork transport name
xprtsArray of network transports supported in a motr environment
xprts_nrSize of xprts array
Precondition
xprt_name != NULL && xprts != NULL && xprts_nr > 0

Definition at line 211 of file setup.c.

Here is the caller graph for this function:

◆ cs_xprts_list()

static void cs_xprts_list ( FILE *  out,
struct m0_net_xprt **  xprts,
size_t  xprts_nr 
)
static

Lists supported network transports.

Definition at line 226 of file setup.c.

Here is the caller graph for this function:

◆ ep_and_xprt_append()

static int ep_and_xprt_append ( struct m0_tl head,
const char *  ep 
)
static

Extracts network transport name and network endpoint address from given motr endpoint. Motr endpoint is of 2 parts network xprt:network endpoint.

Definition at line 375 of file setup.c.

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

◆ M0_BASSERT()

M0_BASSERT ( CS_MAX_EP_ADDR_LEN >=sizeof "lnet:"+  M0_NET_LNET_XEP_ADDR_LEN)

◆ M0_BOB_DECLARE()

M0_BOB_DECLARE ( M0_INTERNAL  ,
cs_endpoint_and_xprt   
)

◆ M0_BOB_DEFINE() [1/4]

M0_BOB_DEFINE ( extern  ,
cs_eps_bob,
cs_endpoint_and_xprt   
)

◆ M0_BOB_DEFINE() [2/4]

M0_BOB_DEFINE ( static  ,
rhctx_bob,
m0_reqh_context   
)

◆ M0_BOB_DEFINE() [3/4]

M0_BOB_DEFINE ( static  ,
ndom_bob,
m0_net_domain   
)

◆ M0_BOB_DEFINE() [4/4]

M0_BOB_DEFINE ( static  inline,
cs_bob_type,
m0_motr   
)

◆ m0_cs_ctx_get()

M0_INTERNAL struct m0_motr * m0_cs_ctx_get ( struct m0_reqh reqh)

Returns instance of struct m0_motr given a request handler instance.

Precondition
reqh != NULL.

Definition at line 1778 of file setup.c.

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

◆ m0_cs_dix_setup()

M0_INTERNAL int m0_cs_dix_setup ( struct m0_motr cctx)

Initialises DIX meta-indices locally.

Creates DIX meta-indices involving only local CAS. Returns immediately if there is no CAS service configured for the current process.

After running m0_cs_dix_setup() on all m0d's, the DIX state is the same as after running m0dixinit utility. In opposite to m0dixinit, this function can be used to re-initialise a single m0d.

XXX Current solution is temporary and contains copy-paste from DIX code. Proper solution must use DIX interface.

Definition at line 255 of file setup_dix.c.

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

◆ m0_cs_fini()

void m0_cs_fini ( struct m0_motr cs_motr)

Finalises motr context.

Definition at line 3029 of file setup.c.

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

◆ m0_cs_gotsignal_reset()

M0_INTERNAL void m0_cs_gotsignal_reset ( void  )

For the sake of UT framework. Possible signal value sent due to rconfc fell into failed state in the course of UT passage needs to be cleaned up.

Definition at line 2421 of file setup.c.

Here is the caller graph for this function:

◆ m0_cs_init()

int m0_cs_init ( struct m0_motr cs_motr,
struct m0_net_xprt **  xprts,
size_t  xprts_nr,
FILE *  out,
bool  mkfs 
)

Initialises motr context.

Parameters
cs_motrRepresents a motr context
xprtsArray or network transports supported in a motr context
xprts_nrSize of xprts array
outFile descriptor to which output is written
shouldthe storage be prepared just like mkfs does?

Definition at line 2999 of file setup.c.

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

◆ m0_cs_memory_limits_setup()

int m0_cs_memory_limits_setup ( struct m0 instance)

Set memory limits.

For each value of memory limit with non-default value from m0_proc_attr use pair getrlimit and setrlimit.

Returns
error code

Definition at line 54 of file process_attr.c.

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

◆ m0_cs_net_domain_locate()

M0_INTERNAL struct m0_net_domain * m0_cs_net_domain_locate ( struct m0_motr cctx,
const char *  xprtname 
)

Finds network domain for specified network transport in a given motr context.

Precondition
cctx != NULL && xprt_name != NULL

Definition at line 466 of file setup.c.

Here is the caller graph for this function:

◆ m0_cs_reqh_context()

M0_INTERNAL struct m0_reqh_context * m0_cs_reqh_context ( struct m0_reqh reqh)

Returns instance of struct m0_reqh_context given a request handler instance.

Precondition
reqh != NULL.

Definition at line 1773 of file setup.c.

Here is the caller graph for this function:

◆ m0_cs_reqh_get()

struct m0_reqh * m0_cs_reqh_get ( struct m0_motr cctx)

Accesses the request handler.

Note
Returned pointer is never NULL.

Definition at line 1762 of file setup.c.

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

◆ m0_cs_setup_env()

int m0_cs_setup_env ( struct m0_motr cs_motr,
int  argc,
char **  argv 
)

Configures motr context before starting the services. Parses the given arguments and allocates request handler contexts. Validates allocated request handler contexts which includes validation of given arguments and their values. Once all the arguments are validated, initialises network domains, creates and initialises request handler contexts, configures rpc machines each per request handler end point.

Parameters
cs_motrMotr context to be initialised

Definition at line 2972 of file setup.c.

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

◆ m0_cs_start()

int m0_cs_start ( struct m0_motr cs_motr)

Starts all the specified services in the motr context. Only once the motr environment is configured with network domains, request handlers and rpc machines, specified services are started.

Parameters
cs_motrMotr context in which services are started

Definition at line 2987 of file setup.c.

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

◆ m0_cs_storage_devs_get()

M0_INTERNAL struct m0_storage_devs * m0_cs_storage_devs_get ( void  )

Returns m0_storage_devs object from m0 instance. Returns NULL if the object is not initialised.

Definition at line 1783 of file setup.c.

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

◆ m0_ep_and_xprt_extract()

M0_INTERNAL int m0_ep_and_xprt_extract ( struct cs_endpoint_and_xprt epx,
const char *  ep 
)

Extract network layer endpoint and network transport from end point string.

Precondition
ep != NULL

Definition at line 326 of file setup.c.

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

◆ m0_ep_and_xprt_fini()

M0_INTERNAL void m0_ep_and_xprt_fini ( struct cs_endpoint_and_xprt epx)

Finalise previously extracted endpoint and network transport in m0_ep_and_xprt_extract.

Definition at line 361 of file setup.c.

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

◆ m0_motr2confc()

M0_INTERNAL struct m0_confc * m0_motr2confc ( struct m0_motr motr)

Definition at line 191 of file setup.c.

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

◆ m0_motr_stob_reopen()

M0_INTERNAL int m0_motr_stob_reopen ( struct m0_reqh reqh,
struct m0_poolmach pm,
uint32_t  dev_id 
)

Extract the path of the provided dev_id from the config file, create stob id for it and call m0_stob_linux_reopen() to reopen the stob.

Definition at line 3043 of file setup.c.

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

◆ m0_motr_to_rmach()

M0_INTERNAL struct m0_rpc_machine * m0_motr_to_rmach ( struct m0_motr motr)

Definition at line 196 of file setup.c.

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

◆ M0_TL_DECLARE()

M0_TL_DECLARE ( cs_eps  ,
M0_INTERNAL  ,
struct cs_endpoint_and_xprt   
)

◆ M0_TL_DEFINE() [1/3]

M0_TL_DEFINE ( cs_buffer_pools  ,
static  ,
struct cs_buffer_pool   
)

◆ M0_TL_DEFINE() [2/3]

M0_TL_DEFINE ( cs_eps  ,
M0_INTERNAL  ,
struct cs_endpoint_and_xprt   
)

◆ M0_TL_DEFINE() [3/3]

M0_TL_DEFINE ( ndom  ,
static  ,
struct m0_net_domain   
)

◆ M0_TL_DESCR_DECLARE()

M0_TL_DESCR_DECLARE ( cs_eps  ,
extern   
)

◆ M0_TL_DESCR_DEFINE() [1/3]

M0_TL_DESCR_DEFINE ( cs_buffer_pools  ,
"buffer pools in the motr context"  ,
static  ,
struct cs_buffer_pool  ,
cs_bp_linkage  ,
cs_bp_magic  ,
M0_CS_BUFFER_POOL_MAGIC  ,
M0_CS_BUFFER_POOL_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [2/3]

M0_TL_DESCR_DEFINE ( cs_eps  ,
"cs endpoints"  ,
struct cs_endpoint_and_xprt  ,
ex_linkage  ,
ex_magix  ,
M0_CS_ENDPOINT_AND_XPRT_MAGIC  ,
M0_CS_EPS_HEAD_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [3/3]

M0_TL_DESCR_DEFINE ( ndom  ,
"network domains"  ,
static  ,
struct m0_net_domain  ,
nd_app_linkage  ,
nd_magix  ,
M0_NET_DOMAIN_MAGIC  ,
M0_CS_NET_DOMAIN_HEAD_MAGIC   
)

◆ main()

M0_INTERNAL int main ( int  argc,
char **  argv 
)

Definition at line 119 of file m0d.c.

Here is the call graph for this function:

◆ motr2rconfc()

static struct m0_rconfc* motr2rconfc ( struct m0_motr motr)
static

Definition at line 186 of file setup.c.

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

◆ motr2reqh()

static struct m0_reqh* motr2reqh ( struct m0_motr motr)
static

Definition at line 181 of file setup.c.

Here is the caller graph for this function:

◆ process_fid_generate_conditional()

static void process_fid_generate_conditional ( struct m0_reqh_context rctx)
static

Definition at line 2039 of file setup.c.

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

◆ process_fid_parse()

static int process_fid_parse ( const char *  str,
struct m0_fid fid 
)
static

Definition at line 2028 of file setup.c.

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

◆ pver_is_actual()

static bool pver_is_actual ( const struct m0_conf_obj obj)
static
Todo:
XXX filter only actual pool versions till formulaic pool version creation in place.

Definition at line 1385 of file setup.c.

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

◆ reqh_context_check()

static bool reqh_context_check ( const void *  bob)
static

Definition at line 162 of file setup.c.

Here is the call graph for this function:

◆ reqh_context_invariant()

static bool reqh_context_invariant ( const struct m0_reqh_context rctx)
static

Definition at line 176 of file setup.c.

Here is the caller graph for this function:

◆ reqh_context_services_fini()

static void reqh_context_services_fini ( struct m0_reqh_context rctx,
struct m0_motr cctx 
)
static

Definition at line 1196 of file setup.c.

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

◆ reqh_context_services_init()

static int reqh_context_services_init ( struct m0_reqh_context rctx,
struct m0_motr cctx 
)
static

Definition at line 1145 of file setup.c.

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

◆ reqh_ctx_services_are_valid()

static bool reqh_ctx_services_are_valid ( const struct m0_reqh_context rctx)
static

Definition at line 146 of file setup.c.

Here is the caller graph for this function:

◆ reqh_memlimit_set()

static int reqh_memlimit_set ( uint  resource,
uint64_t  limit 
)
static

Definition at line 38 of file process_attr.c.

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

◆ reqh_services_start()

static int reqh_services_start ( struct m0_reqh_context rctx,
struct m0_motr cctx 
)
static
Todo:
XXX Handle errors properly.

Definition at line 1222 of file setup.c.

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

◆ service_is_duplicate()

static bool service_is_duplicate ( const struct m0_reqh_context rctx,
const char *  sname 
)
static

Checks if specified service has already a duplicate entry in given request handler context.

Definition at line 402 of file setup.c.

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

◆ stob_file_id_get()

static int stob_file_id_get ( yaml_document_t *  doc,
yaml_node_t *  node,
uint64_t *  id 
)
static

Definition at line 740 of file setup.c.

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

◆ stob_file_path_get()

static const char* stob_file_path_get ( yaml_document_t *  doc,
yaml_node_t *  node 
)
static

Definition at line 761 of file setup.c.

Here is the caller graph for this function:

◆ stype_is_valid()

static bool stype_is_valid ( const char *  stype)
static

Checks if the specified storage type is supported in a motr context.

Definition at line 251 of file setup.c.

Here is the caller graph for this function:

Variable Documentation

◆ cs_bob_type

const struct m0_bob_type cs_bob_type
static
Initial value:
= {
.bt_name = "m0_motr",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_motr, cc_magic),
.bt_magix = M0_CS_MOTR_MAGIC,
}
Definition: setup.h:354
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 138 of file setup.c.

◆ cs_eps_bob

struct m0_bob_type cs_eps_bob
static

Definition at line 111 of file setup.c.

◆ cs_module_levels

static const struct m0_modlev cs_module_levels
static

Definition at line 2509 of file setup.c.

◆ gotsignal [1/2]

volatile sig_atomic_t gotsignal

Definition at line 2415 of file setup.c.

◆ gotsignal [2/2]

volatile sig_atomic_t gotsignal

Definition at line 2415 of file setup.c.

◆ m0_cs_stypes [1/2]

M0_INTERNAL const char* m0_cs_stypes[M0_STOB_TYPE_NR]
Initial value:
= {
[M0_LINUX_STOB] = "Linux",
[M0_AD_STOB] = "AD"
}

Definition at line 114 of file setup.c.

◆ m0_cs_stypes [2/2]

M0_EXTERN const char* m0_cs_stypes[M0_STOB_TYPE_NR]

String representations corresponding to the stob types.

Definition at line 151 of file setup.h.

◆ m0_ss_svc_type

struct m0_reqh_service_type m0_ss_svc_type

Definition at line 159 of file ss_svc.c.

◆ ndom_bob

struct m0_bob_type ndom_bob
static

Definition at line 135 of file setup.c.

◆ regsignal

bool regsignal = false
static

Definition at line 69 of file m0d.c.

◆ rhctx_bob

struct m0_bob_type rhctx_bob
static
Initial value:
= {
.bt_name = "m0_reqh_context",
.bt_magix_offset = M0_MAGIX_OFFSET(struct m0_reqh_context, rc_magix),
.bt_magix = M0_CS_REQH_CTX_MAGIC,
.bt_check = reqh_context_check
}
static bool reqh_context_check(const void *bob)
Definition: setup.c:162
#define M0_MAGIX_OFFSET(type, field)
Definition: misc.h:356

Definition at line 121 of file setup.c.