Motr  M0
fom.c File Reference
#include "lib/trace.h"
#include "lib/misc.h"
#include "lib/errno.h"
#include "lib/assert.h"
#include "lib/memory.h"
#include "lib/locality.h"
#include "lib/processor.h"
#include "lib/time.h"
#include "lib/timer.h"
#include "lib/arith.h"
#include "lib/uuid.h"
#include "lib/semaphore.h"
#include "lib/finject.h"
#include "addb2/net.h"
#include "addb2/addb2.h"
#include "addb2/storage.h"
#include "addb2/identifier.h"
#include "addb2/sys.h"
#include "addb2/global.h"
#include "motr/magic.h"
#include "fop/fop.h"
#include "fop/fom_long_lock.h"
#include "module/instance.h"
#include "reqh/reqh.h"
#include "reqh/reqh_service.h"
#include "sm/sm.h"
#include "rpc/rpc_machine.h"
#include "rpc/rpc_opcodes.h"
#include "fdmi/fol_fdmi_src.h"
#include "motr/iem.h"
Include dependency graph for fom.c:

Go to the source code of this file.

Data Structures

struct  m0_loc_thread
 
struct  fom_wait_data
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FOP
 

Enumerations

enum  { LOC_IDLE_NR = 1, HUNG_FOP_SEC_PERIOD = 5, HUNG_FOP_TIME_SEC_MAX = 2*60, HUNG_FOP_TIME_SEC_IEM = 5*60 }
 
enum  loc_thread_state { HANDLER = 1, BLOCKED, UNBLOCKING, IDLE }
 

Functions

 M0_TL_DESCR_DEFINE (thr, "fom thread", static, struct m0_loc_thread, lt_linkage, lt_magix, M0_FOM_THREAD_MAGIC, M0_FOM_THREAD_HEAD_MAGIC)
 
 M0_TL_DEFINE (thr, static, struct m0_loc_thread)
 
 M0_TL_DESCR_DEFINE (runq, "runq fom", static, struct m0_fom, fo_linkage, fo_magic, M0_FOM_MAGIC, M0_FOM_RUNQ_MAGIC)
 
 M0_TL_DEFINE (runq, static, struct m0_fom)
 
 M0_TL_DESCR_DEFINE (wail, "wail fom", static, struct m0_fom, fo_linkage, fo_magic, M0_FOM_MAGIC, M0_FOM_WAIL_MAGIC)
 
 M0_TL_DEFINE (wail, static, struct m0_fom)
 
static bool fom_wait_time_is_out (const struct m0_fom_domain *dom, const struct m0_fom *fom)
 
static int loc_thr_create (struct m0_fom_locality *loc)
 
static void hung_foms_notify (struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
 
static void group_lock (struct m0_fom_locality *loc)
 
static void group_unlock (struct m0_fom_locality *loc)
 
M0_INTERNAL bool m0_fom_group_is_locked (const struct m0_fom *fom)
 
static bool is_in_runq (const struct m0_fom *fom)
 
static bool is_in_wail (const struct m0_fom *fom)
 
static bool thread_invariant (const struct m0_loc_thread *t)
 
M0_INTERNAL bool m0_fom_domain_invariant (const struct m0_fom_domain *dom)
 
M0_INTERNAL bool m0_locality_invariant (const struct m0_fom_locality *loc)
 
M0_INTERNAL struct m0_reqhm0_fom_reqh (const struct m0_fom *fom)
 
static enum m0_fom_state fom_state (const struct m0_fom *fom)
 
static void fom_state_set (struct m0_fom *fom, enum m0_fom_state state)
 
static bool fom_is_blocked (const struct m0_fom *fom)
 
static M0_UNUSED struct m0_fomsm2fom (struct m0_sm *sm)
 
M0_INTERNAL bool m0_fom_invariant (const struct m0_fom *fom)
 
static bool hung_fom_notify (const struct m0_fom *fom)
 
static void fom_ready (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_ready (struct m0_fom *fom)
 
static void readyit (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void fom_addb2_push (struct m0_fom *fom)
 
static void addb2_introduce (struct m0_fom *fom)
 
static void queueit (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void thr_addb2_enter (struct m0_loc_thread *thr, struct m0_fom_locality *loc)
 
static void thr_addb2_leave (struct m0_loc_thread *thr, struct m0_fom_locality *loc)
 
M0_INTERNAL void m0_fom_wakeup (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_block_enter (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_block_leave (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_queue (struct m0_fom *fom)
 
static void fom_wait (struct m0_fom *fom)
 
static bool fom_wait_is_completed (const struct fom_wait_data *wd)
 
static int fom_wait_rc (const struct fom_wait_data *wd)
 
static bool fom_wait_cb (struct m0_clink *clink)
 
static int fom_wait_init (void *data)
 
static int fom_wait_fini (void *data)
 
M0_INTERNAL int m0_fom_timedwait (struct m0_fom *fom, uint64_t phases, m0_time_t deadline)
 
static void cb_done (struct m0_fom_callback *cb)
 
static void cb_run (struct m0_fom_callback *cb)
 
static void * cb_next (struct m0_fom_callback *cb)
 
static void fom_exec (struct m0_fom *fom)
 
static struct m0_fomfom_dequeue (struct m0_fom_locality *loc)
 
static void loc_handler_thread (struct m0_loc_thread *th)
 
static int loc_thr_init (struct m0_loc_thread *th)
 
static void loc_thr_fini (struct m0_loc_thread *th)
 
static void loc_addb2_fini (struct m0_fom_locality *loc)
 
static void loc_fini (struct m0_fom_locality *loc)
 
static int loc_init (struct m0_fom_locality *loc, struct m0_fom_domain *dom, size_t idx)
 
static void core_mask_apply (struct m0_bitmap *onln_cpu_map)
 
M0_INTERNAL int m0_fom_domain_init (struct m0_fom_domain **out)
 
M0_INTERNAL void m0_fom_domain_fini (struct m0_fom_domain *dom)
 
static bool is_loc_locker_empty (struct m0_fom_locality *loc, uint32_t key)
 
M0_INTERNAL bool m0_fom_domain_is_idle_for (const struct m0_reqh_service *svc)
 
M0_INTERNAL bool m0_fom_domain_is_idle (const struct m0_fom_domain *dom)
 
M0_INTERNAL void m0_fom_locality_inc (struct m0_fom *fom)
 
M0_INTERNAL bool m0_fom_locality_dec (struct m0_fom *fom)
 
void m0_fom_fini (struct m0_fom *fom)
 
void m0_fom_init (struct m0_fom *fom, const struct m0_fom_type *fom_type, const struct m0_fom_ops *ops, struct m0_fop *fop, struct m0_fop *reply, struct m0_reqh *reqh)
 
static bool fom_clink_cb (struct m0_clink *link)
 
static void fom_ast_cb (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
M0_INTERNAL void m0_fom_callback_init (struct m0_fom_callback *cb)
 
M0_INTERNAL void m0_fom_callback_arm (struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
 
static bool fom_callback_is_armed (const struct m0_fom_callback *cb)
 
M0_INTERNAL bool m0_fom_is_waiting_on (const struct m0_fom *fom)
 
static void fom_ready_cb (struct m0_fom_callback *cb)
 
M0_INTERNAL void m0_fom_wait_on (struct m0_fom *fom, struct m0_chan *chan, struct m0_fom_callback *cb)
 
M0_INTERNAL void m0_fom_callback_fini (struct m0_fom_callback *cb)
 
static void cb_cancel (struct m0_fom_callback *cb)
 
M0_INTERNAL void m0_fom_callback_cancel (struct m0_fom_callback *cb)
 
M0_INTERNAL void m0_fom_timeout_init (struct m0_fom_timeout *to)
 
M0_INTERNAL void m0_fom_timeout_fini (struct m0_fom_timeout *to)
 
static void fom_timeout_cb (struct m0_sm_timer *timer)
 
static int fom_timeout_start (struct m0_fom_timeout *to, struct m0_fom *fom, void(*cb)(struct m0_fom_callback *), m0_time_t deadline)
 
M0_INTERNAL int m0_fom_timeout_wait_on (struct m0_fom_timeout *to, struct m0_fom *fom, m0_time_t deadline)
 
M0_INTERNAL int m0_fom_timeout_arm (struct m0_fom_timeout *to, struct m0_fom *fom, void(*cb)(struct m0_fom_callback *), m0_time_t deadline)
 
M0_INTERNAL void m0_fom_timeout_cancel (struct m0_fom_timeout *to)
 
M0_INTERNAL void m0_fom_type_init (struct m0_fom_type *type, uint64_t id, const struct m0_fom_type_ops *ops, const struct m0_reqh_service_type *svc_type, const struct m0_sm_conf *sm)
 
M0_INTERNAL int m0_foms_init (void)
 
M0_INTERNAL void m0_foms_fini (void)
 
M0_INTERNAL void m0_fom_sm_init (struct m0_fom *fom)
 
void m0_fom_phase_set (struct m0_fom *fom, int phase)
 
void m0_fom_phase_move (struct m0_fom *fom, int32_t rc, int phase)
 
void m0_fom_phase_moveif (struct m0_fom *fom, int32_t rc, int phase0, int phase1)
 
int m0_fom_phase (const struct m0_fom *fom)
 
M0_INTERNAL const char * m0_fom_phase_name (const struct m0_fom *fom, int phase)
 
M0_INTERNAL int m0_fom_rc (const struct m0_fom *fom)
 
M0_INTERNAL bool m0_fom_is_waiting (const struct m0_fom *fom)
 
M0_INTERNAL int m0_fom_fol_rec_add (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_fdmi_record_post (struct m0_fom *fom)
 
M0_INTERNAL struct m0_reqhm0_fom2reqh (const struct m0_fom *fom)
 

Variables

static struct m0_sm_conf fom_states_conf0
 
M0_INTERNAL struct m0_sm_conf fom_states_conf
 
static struct m0_fom_domain_ops m0_fom_dom_ops
 
static const struct m0_locality_chore_ops hung_foms_chore_ops
 
M0_INTERNAL struct m0_fom_typem0_fom__types [M0_OPCODES_NR]
 
static struct m0_sm_state_descr fom_states []
 
static struct m0_sm_trans_descr fom_trans [M0_FOS_TRANS_NR]
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FOP

Definition at line 23 of file fom.c.