Motr  M0
Fop state Machine

Data Structures

struct  m0_loc_thread
 
struct  fom_wait_data
 
struct  m0_fom_locality
 
struct  m0_fom_domain
 
struct  m0_fom_domain_ops
 
struct  m0_fom_callback
 
struct  m0_fom
 
struct  m0_fom_type
 
struct  m0_fom_type_ops
 
struct  m0_fom_ops
 
struct  m0_fom_timeout
 
struct  fom_phase_desc
 
struct  m0_fom_simple
 

Macros

#define FOM_PHASE_DEBUG   (1)
 
#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FOP
 
#define FOM_SIMPLE(fom)   (container_of(fom, struct m0_fom_simple, si_fom))
 
#define M0_FOM_SIMPLE_POST(s, r, c, t, f, d, l)
 

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 }
 
enum  m0_fom_state {
  M0_FOS_INIT, M0_FOS_READY, M0_FOS_RUNNING, M0_FOS_WAITING,
  M0_FOS_FINISH
}
 
enum  { M0_FOS_TRANS_NR = 8 }
 
enum  m0_fom_phase { M0_FOM_PHASE_INIT, M0_FOM_PHASE_FINISH, M0_FOM_PHASE_NR }
 
enum  m0_fc_state { M0_FCS_ARMED = 1, M0_FCS_DONE }
 
enum  m0_fom_phase_outcome { M0_FSO_WAIT = 1, M0_FSO_AGAIN, M0_FSO_NR }
 
enum  { M0_FOM_SIMPLE_HERE = 0xbedabedabedabeda }
 

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)
 
M0_INTERNAL void m0_fom_locality_post_stats (struct m0_fom_locality *loc)
 
static struct m0_be_txm0_fom_tx (struct m0_fom *fom)
 
static struct m0_be_tx_creditm0_fom_tx_credit (struct m0_fom *fom)
 
M0_INTERNAL int m0_fom_addb2_init (struct m0_fom_type *type, uint64_t id)
 
M0_INTERNAL void m0_fom_generic_fini (void)
 
M0_INTERNAL int m0_fom_generic_init (void)
 
M0_INTERNAL void m0_fom_mod_rep_fill (struct m0_fop_mod_rep *rep, struct m0_fom *fom)
 
bool m0_rpc_item_is_generic_reply_fop (const struct m0_rpc_item *item)
 
int32_t m0_rpc_item_generic_reply_rc (const struct m0_rpc_item *reply)
 
static bool fom_is_update (const struct m0_fom *fom)
 
static int fom_phase_init (struct m0_fom *fom)
 
static int fom_authen (struct m0_fom *fom)
 
static int fom_authen_wait (struct m0_fom *fom)
 
static int fom_loc_resource (struct m0_fom *fom)
 
static int fom_loc_resource_wait (struct m0_fom *fom)
 
static int fom_dist_resource (struct m0_fom *fom)
 
static int fom_dist_resource_wait (struct m0_fom *fom)
 
static int fom_obj_check (struct m0_fom *fom)
 
static int fom_obj_check_wait (struct m0_fom *fom)
 
static int fom_auth (struct m0_fom *fom)
 
static int fom_auth_wait (struct m0_fom *fom)
 
static int fom_tx_init (struct m0_fom *fom)
 
static int fom_tx_open (struct m0_fom *fom)
 
static int fom_tx_wait (struct m0_fom *fom)
 
static void generic_reply_build (struct m0_fom *fom)
 
static int fom_failure (struct m0_fom *fom)
 
static int fom_success (struct m0_fom *fom)
 
static int fom_fol_rec_add (struct m0_fom *fom)
 
static int fom_tx_commit (struct m0_fom *fom)
 
M0_INTERNAL int m0_fom_tx_logged_wait (struct m0_fom *fom)
 
M0_INTERNAL int m0_fom_tx_done_wait (struct m0_fom *fom)
 
static int fom_queue_reply (struct m0_fom *fom)
 
static int fom_queue_reply_wait (struct m0_fom *fom)
 
static int fom_timeout (struct m0_fom *fom)
 
 M0_BASSERT (ARRAY_SIZE(m0_generic_phases_trans)==M0_FOM_GENERIC_TRANS_NR)
 
int m0_fom_tick_generic (struct m0_fom *fom)
 
M0_INTERNAL void m0_fom_simple_post (struct m0_fom_simple *simpleton, struct m0_reqh *reqh, struct m0_sm_conf *conf, int(*tick)(struct m0_fom *, void *, int *), void(*free)(struct m0_fom_simple *sfom), void *data, size_t locality)
 
M0_INTERNAL void m0_fom_simple_hoard (struct m0_fom_simple *cat, size_t nr, struct m0_reqh *reqh, struct m0_sm_conf *conf, int(*tick)(struct m0_fom *, void *, int *), void(*free)(struct m0_fom_simple *sfom), void *data)
 
M0_INTERNAL int m0_fom_simples_init (void)
 
M0_INTERNAL void m0_fom_simples_fini (void)
 
static int fom_simple_tick (struct m0_fom *fom)
 
static size_t fom_simple_locality_get (const struct m0_fom *fom)
 
static void fom_simple_fini (struct m0_fom *fom)
 
static int fom_simple_service_start (struct m0_reqh_service *service)
 
static void fom_simple_service_prepare_to_stop (struct m0_reqh_service *service)
 
static void fom_simple_service_stop (struct m0_reqh_service *service)
 
static void fom_simple_service_fini (struct m0_reqh_service *service)
 
static int fom_simple_service_allocate (struct m0_reqh_service **out, const struct m0_reqh_service_type *stype)
 

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]
 
struct m0_fop_type m0_fop_generic_reply_fopt
 
static const struct fom_phase_desc fpd_table []
 
static struct m0_sm_state_descr generic_phases []
 
struct m0_sm_trans_descr m0_generic_phases_trans []
 
const struct m0_sm_conf m0_generic_conf
 
static const struct m0_fom_type_ops fom_simple_ft_ops
 
static struct m0_reqh_service_type fom_simple_rstype
 
static const struct m0_fom_ops fom_simple_ops
 
static struct m0_sm_conf fom_simple_conf
 
M0_EXTERN struct m0_sm_conf fom_states_conf
 
static struct m0_sm_state_descr fom_simple_phases []
 
static const struct m0_reqh_service_ops fom_simple_service_ops
 
static const struct m0_reqh_service_type_ops fom_simple_rsops
 

Detailed Description

Fop state machine (fom)

A fom is a non-blocking state machine. Almost all server-side Motr activities are implemented as foms. Specifically, all file system operation requests, received from clients are executed as foms (hence the name).

Fom execution is controlled by request handler (reqh) which can be thought of as a specialised scheduler. Request handler is similar to a typical OS kernel scheduler: it maintains lists of ready (runnable) and waiting foms. Motr request handler tries to optimise utilisation of processor caches. To this end, it is partitioned into a set of "localities", typically, one locality for a processor core. Each locality has its own ready and waiting lists and each fom is assigned to a locality.

A fom is not associated with any particular thread: each state transition is executed in the context of a certain handler thread, but the next state transition can be executed by a different thread. Usually, all these threads run in the same locality (on the same core), but a fom can be migrated between localities for load-balancing purposes (

Todo:
load balancing is not implemented at the moment).

The aim of interfaces defined below is to simplify construction of a non-blocking file server (see HLD referenced below for a more detailed exposition).

Fom phase and state

Fom operates by moving from "phase" to "phase". Current phase is recorded in m0_fom::fo_phase. Generic code in fom.c pays no attention to this field, except for special M0_FOM_PHASE_INIT and M0_FOM_PHASE_FINISH values used to control fom life-time. ->fo_phase value is interpreted by fom-type-specific code. fom_generic.[ch] defines some "standard phases", that a typical fom related to file operation processing passes through.

Each phase transition should be non-blocking. When a fom cannot move to the next phase immediately, it waits for an event that would make non-blocking phase transition possible.

Internally, request handler maintains, in addition to phase, a m0_fom::fo_state field, recording fom state, which can be RUNNING (M0_FOS_RUNNING), READY (M0_FOS_READY) and WAITING (M0_FOS_WAITING). A fom is in RUNNING state, when its phase transition is currently being executed. A fom is in READY state, when its phase transition can be executed immediately and a fom is in WAITING state, when no phase transition can be executed immediately.

Request handler, according to some policy, selects a fom in READY state, moves it to RUNNING state and calls its m0_fom_ops::fo_tick() function to execute phase transition. This function has 2 possible return values:

- M0_FSO_AGAIN: more phase transitions are possible immediately. When
  this value is returned, request handler returns the fom back to the
  READY state and guarantees that m0_fom_ops::fo_tick() will be called
  eventually as determined by policy. The reason to return M0_FSO_AGAIN
  instead of immediately executing the next phase transition right within
  ->fo_tick() is to get request handler a better chance to optimise
  performance globally, by selecting the "best" READY fom;

- M0_FSO_WAIT: no phase transitions are possible at the moment. As a
  special case, if m0_fom_phase(fom) == M0_FOM_PHASE_FINISH, request
  handler destroys the fom, by calling its m0_fom_ops::fo_fini()
  method. Otherwise, the fom is placed in WAITING state.

A fom moves WAITING to READY state by the following means:

- before returning M0_FSO_WAIT, its ->fo_tick() function can arrange a
  wakeup, by calling m0_fom_wait_on(fom, chan, cb). When chan is
  signalled, the fom is moved to READY state. More generally,
  m0_fom_callback_arm(fom, chan, cb) call arranges for an arbitrary
  call-back to be called when the chan is signalled. The call-back can
  wake up the fom by calling m0_fom_ready();

- a WAITING fom can be woken up by calling m0_fom_wakeup() function that
  moves it in READY state.

These two methods should not be mixed: internally they use the same data-structure m0_fom::fo_cb.fc_ast.

Typical ->fo_tick() function looks like

static int foo_tick(struct m0_fom *fom)
{
struct foo_fom *obj = container_of(fom, struct foo_fom, ff_base);
else if (m0_fom_phase(fom) == FOO_PHASE_0) {
...
if (!ready)
m0_fom_wait_on(fom, chan, &fom->fo_cb);
} else if (m0_fom_phase(fom) == FOO_PHASE_1) {
...
} else if (m0_fom_phase(fom) == FOO_PHASE_2) {
...
} else
M0_IMPOSSIBLE("Wrong phase.");
}
See also
fom_long_lock.h for a higher level fom synchronisation mechanism.

Concurrency

The following types of activity are associated with a fom:

- fom phase transition function: m0_fom_ops::fo_tick()

- "top-half" of a call-back armed for a fom: m0_fom_callback::fc_top()

- "bottom-half" of a call-back armed for a fom:
  m0_fom_callback::fc_bottom()

Phase transitions and bottom-halves are serialised: neither 2 phase transitions, nor 2 bottom-halves, nor state transition and bottom-halve can execute concurrently. Top-halves are not serialised and, moreover, executed in an "awkward context": they are not allowed to block or take locks. It is best to avoid using top-halves whenever possible.

If a bottom-half becomes ready to execute for a fom in READY or RUNNING state, the bottom-half remains pending until the fom goes into WAITING state. Similarly, if m0_fom_wakeup() is called for a non-WAITING fom, the wakeup remains pending until the fom moves into WAITING state.

Fom-type-specific code should make no assumptions about request handler threading model. Specifically, it is possible that phase transitions and call-back halves for the same fom are executed by different threads. In addition, no assumptions should be made about concurrency of call-backs and phase transitions of different foms.

Blocking phase transitions

Sometimes the non-blockingness requirement for phase transitions is difficult to satisfy, for example, if a fom has to call some external blocking code, like database. In these situations, phase transition function must notify request handler that it is about to block the thread executing the phase transition. This is achieved by m0_fom_block_enter() call. Matching m0_fom_block_leave() call notifies request handler that phase transition is no longer blocked. These calls do not nest.

Internally, m0_fom_block_enter() call hijacks the current request handler thread into exclusive use by this fom. The fom remains in RUNNING state while blocked. The code, executed between m0_fom_block_enter() and m0_fom_block_leave() can arm call-backs, their bottom-halves won't be executed until phase transition completes and fom returns back to WAITING state. Similarly, a m0_fom_wakeup() wakeup posted for a blocked fom, remains pending until fom moves into WAITING state. In other words, concurrency guarantees listed in the "Concurrency" section are upheld for blocking phase transitions.

Locality

Request handler partitions resources into "localities" to improve resource utilisation by increasing locality of reference. A locality, represented by m0_fom_locality owns a processor core and some other resources. Each locality runs its own fom scheduler and maintains lists of ready and waiting foms. A fom is assigned its "home" locality when it is created (m0_fom_ops::fo_home_locality()).

For documentation links, please refer to this file : doc/motr-design-doc-list.rst

Todo:
describe intended fom and reqh usage on client.

A simple helper fom type to execute a user specified phase transition function.

"Simple fom" is pre-configured fom type to execute user-supplied code in fom context.

Locality internals

A locality has 4 groups of threads associated with it:

- a handler thread: m0_fom_locality::fl_handler. This thread executes
  main handler loop (loc_handler_thread()), where it waits until there
  are foms in runqueue and executes their phase transitions. This thread
  keeps group lock (m0_fom_locality::fl_group::s_lock) all the
  time. As a result, if phase transitions do not block, group lock is
  rarely touched;

- blocked threads: threads that executed a m0_fom_block_enter(), but not
  yet a matching m0_fom_block_leave() call as part of phase transition;

- unblocking threads: threads that are executing a m0_fom_block_leave()
  call and trying to re-acquire the group lock to complete phase
  transition.

- idle threads: these are waiting on m0_fom_locality::fl_idle to
  become the new handler thread when the previous handler is blocked.

Transitions between thread groups are as following:

- the handler thread and a pool of idle threads are created when the
  locality is initialised;

- as part of m0_fom_block_leave() call, the blocked thread increments
  m0_fom_locality::fl_unblocking counter and acquires the group
  lock. When the group lock is acquired, the thread makes itself the
  handler thread;

- on each iteration of the main handler thread loop, the handler checks
  m0_fom_locality::fl_unblocking. If the counter is greater than 0, the
  handler releases the group lock and makes itself idle;

- as part of m0_fom_block_enter() call, current handler thread releases
  the group lock and checks m0_fom_locality::fl_unblocking. If the
  counter is 0, the handler wakes up one of idle threads (creating one if
  none exists), making it the new handler thread.
*
*      INIT----------------------->IDLE
*            loc_thr_create()      | ^
*             ^                    | |
*             .                    | |
*             .     signal(fl_idle)| |(unblocking > 0)
*             .        ^           | |       ^
*             .        .           | |       .
*             .        .           | |       .
*           m0_fom_block_enter()   V |       .
*        +-----------------------HANDLER     .
*        |                          ^        .
*        V                          |        .
*     BLOCKED                  UNBLOCKING    .
*        |                          ^        .
*        |                          |        .
*        +--------------------------+        .
*           m0_fom_block_leave()             .
*                    .                       .
*                    .........................
*
* 

In the diagram above, dotted arrow means that the state transition causes a change making state transition for other thread possible.

All threads are linked into m0_fom_locality::fl_threads. This list is used mostly for debugging and invariant checking purposes, but also for thread finalisation (loc_fini()).

Thread state transitions, associated lists and counters are protected by the group mutex.

Macro Definition Documentation

◆ FOM_PHASE_DEBUG

#define FOM_PHASE_DEBUG   (1)

Definition at line 236 of file fom.h.

◆ FOM_SIMPLE

#define FOM_SIMPLE (   fom)    (container_of(fom, struct m0_fom_simple, si_fom))

Definition at line 107 of file fom_simple.c.

◆ M0_FOM_SIMPLE_POST

#define M0_FOM_SIMPLE_POST (   s,
  r,
  c,
  t,
  f,
  d,
  l 
)
Value:
({ \
/* check that "t" and "d" match. */ \
(void)(sizeof((t)(NULL, (d), 0))); \
m0_fom_simple_post((s), (r), (c), \
(int (*)(struct m0_fom *, void *, int *))(t),\
(void (*)(struct m0_fom_simple *))(f), \
(void *)(d), (l)); \
})
#define NULL
Definition: misc.h:38
static FILE * f
Definition: adieu.c:79
static struct m0_addb2_callback c
Definition: consumer.c:41
static struct m0_thread t[8]
Definition: service_ut.c:1230
static struct m0_clink l[NR]
Definition: chan.c:37
Definition: fom.h:481
static int r[NR]
Definition: thread.c:46
static struct m0_addb2_source * s
Definition: consumer.c:39

Wrapper around m0_fom_simple_post() supporting flexible typing of "data".

Definition at line 165 of file fom_simple.h.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_FOP

Definition at line 29 of file fom_simple.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
LOC_IDLE_NR 
HUNG_FOP_SEC_PERIOD 
HUNG_FOP_TIME_SEC_MAX 
HUNG_FOP_TIME_SEC_IEM 

Definition at line 136 of file fom.c.

◆ anonymous enum

anonymous enum

The number of fom state transitions (see fom_trans[] at fom.c).

Enumerator
M0_FOS_TRANS_NR 

Definition at line 370 of file fom.h.

◆ anonymous enum

anonymous enum
Enumerator
M0_FOM_SIMPLE_HERE 

Pass this as "locality" argument to m0_fom_simple_post() to bind the fom to the current locality.

Definition at line 132 of file fom_simple.h.

◆ loc_thread_state

Locality thread states. Used for correctness checking.

Enumerator
HANDLER 
BLOCKED 
UNBLOCKING 
IDLE 

Definition at line 146 of file fom.c.

◆ m0_fc_state

Fom call-back states

Enumerator
M0_FCS_ARMED 

Armed

M0_FCS_DONE 

Bottom-half done

Definition at line 432 of file fom.h.

◆ m0_fom_phase

Enumerator
M0_FOM_PHASE_INIT 
M0_FOM_PHASE_FINISH 
M0_FOM_PHASE_NR 

Definition at line 372 of file fom.h.

◆ m0_fom_phase_outcome

Potential outcome of a fom phase transition.

See also
m0_fom_ops::fo_tick().
Enumerator
M0_FSO_WAIT 

Phase transition completed. The next phase transition would be possible when some future event happens.

When M0_FSO_WAIT is returned, the fom is put on locality wait-list.

M0_FSO_AGAIN 

Phase transition completed and another phase transition is immediately possible.

When M0_FSO_AGAIN is returned, either the next phase transition is immediately executed (by the same or by a different handler thread) or the fom is placed in the run-queue, depending on the scheduling constraints.

M0_FSO_NR 

Must be the last.

Definition at line 625 of file fom.h.

◆ m0_fom_state

States a fom can be in.

Enumerator
M0_FOS_INIT 
M0_FOS_READY 

Fom is dequeued from wait queue and put in run queue.

M0_FOS_RUNNING 

Fom state transition function is being executed by a locality handler thread. The fom is not on any queue in this state.

M0_FOS_WAITING 

FOM is enqueued into a locality wait list.

M0_FOS_FINISH 

Definition at line 355 of file fom.h.

Function Documentation

◆ addb2_introduce()

static void addb2_introduce ( struct m0_fom fom)
static

Definition at line 454 of file fom.c.

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

◆ cb_cancel()

static void cb_cancel ( struct m0_fom_callback cb)
static

Definition at line 1503 of file fom.c.

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

◆ cb_done()

static void cb_done ( struct m0_fom_callback cb)
static

Helper function advancing a fom call-back from ARMED to DONE state.

Definition at line 747 of file fom.c.

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

◆ cb_next()

static void* cb_next ( struct m0_fom_callback cb)
static

Definition at line 770 of file fom.c.

Here is the caller graph for this function:

◆ cb_run()

static void cb_run ( struct m0_fom_callback cb)
static

Helper to execute the bottom half of a fom call-back.

Definition at line 762 of file fom.c.

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

◆ core_mask_apply()

static void core_mask_apply ( struct m0_bitmap onln_cpu_map)
static

Definition at line 1145 of file fom.c.

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

◆ fom_addb2_push()

static void fom_addb2_push ( struct m0_fom fom)
static

Definition at line 448 of file fom.c.

Here is the caller graph for this function:

◆ fom_ast_cb()

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

Definition at line 1426 of file fom.c.

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

◆ fom_auth()

static int fom_auth ( struct m0_fom fom)
static

Performs authorisation checks on behalf of the user, accessing the file system objects affected by the fop.

Definition at line 229 of file fom_generic.c.

◆ fom_auth_wait()

static int fom_auth_wait ( struct m0_fom fom)
static

Resumes fom execution after completing a blocking operation M0_FOPH_AUTHORISATION phase.

Definition at line 238 of file fom_generic.c.

◆ fom_authen()

static int fom_authen ( struct m0_fom fom)
static

Performs authenticity checks on fop, executed by the fom.

Definition at line 157 of file fom_generic.c.

◆ fom_authen_wait()

static int fom_authen_wait ( struct m0_fom fom)
static

Resumes fom execution after completing a blocking operation in M0_FOPH_AUTHENTICATE phase.

Definition at line 166 of file fom_generic.c.

◆ fom_callback_is_armed()

static bool fom_callback_is_armed ( const struct m0_fom_callback cb)
static

Definition at line 1475 of file fom.c.

Here is the caller graph for this function:

◆ fom_clink_cb()

static bool fom_clink_cb ( struct m0_clink link)
static

Definition at line 1413 of file fom.c.

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

◆ fom_dequeue()

static struct m0_fom* fom_dequeue ( struct m0_fom_locality loc)
static

Dequeues a fom from runq list of the locality.

Return values
m0_fomif queue is not empty, NULL otherwise

Definition at line 851 of file fom.c.

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

◆ fom_dist_resource()

static int fom_dist_resource ( struct m0_fom fom)
static

Identifies distributed resources required for fom execution.

Definition at line 192 of file fom_generic.c.

◆ fom_dist_resource_wait()

static int fom_dist_resource_wait ( struct m0_fom fom)
static

Resumes fom execution after completing blocking operation in M0_FOPH_RESOURCE_DISTRIBUTED_PHASE.

Definition at line 201 of file fom_generic.c.

◆ fom_exec()

static void fom_exec ( struct m0_fom fom)
static

Invokes fom phase transition method, which transitions fom through various phases of its execution without blocking.

Postcondition
m0_fom_invariant(fom)

Definition at line 780 of file fom.c.

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

◆ fom_failure()

static int fom_failure ( struct m0_fom fom)
static

Handles fom execution failure, if fom fails in one of the standard phases, then we construct a generic error reply fop and assign it to m0_fom::fo_rep_fop, else if fom fails in fop specific operation, then fom should already contain a fop specific error reply provided by fop specific operation.

Todo:
workaround to move be transaction into FAILED state, so that it can be finalised.

Fom phase is set to M0_FOPH_FOL_REC_ADD here so that when function returns to m0_fom_tick_generic() phase is again set to M0_FOPH_TXN_COMMIT, which does nothing and then phase is set to M0_FOPH_QUEUE_REPLY. This way execution of M0_FOPH_FOL_REC_ADD is skipped and M0_FOPH_TXN_COMMIT does nothing, exactly as needed when there is no BE transaction to close.

Technically it's possible to set the phase directly to M0_FOPH_TXN_COMMIT (which will be skipped), but it's better to clearly state that there is no state transition to M0_FOPH_TXN_COMMIT without going through M0_FOPH_FOL_REC_ADD first, which means that FOL record is added for every BE transactions.

Definition at line 342 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_fol_rec_add()

static int fom_fol_rec_add ( struct m0_fom fom)
static

Make a FOL transaction record

Definition at line 407 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_is_blocked()

static bool fom_is_blocked ( const struct m0_fom fom)
static

Definition at line 298 of file fom.c.

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

◆ fom_is_update()

static bool fom_is_update ( const struct m0_fom fom)
static

Definition at line 100 of file fom_generic.c.

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

◆ fom_loc_resource()

static int fom_loc_resource ( struct m0_fom fom)
static

Identifies local resources required for fom execution.

Definition at line 175 of file fom_generic.c.

◆ fom_loc_resource_wait()

static int fom_loc_resource_wait ( struct m0_fom fom)
static

Resumes fom execution after completing a blocking operation in M0_FOPH_RESOURCE_LOCAL phase.

Definition at line 184 of file fom_generic.c.

◆ fom_obj_check()

static int fom_obj_check ( struct m0_fom fom)
static

Locates and loads filesystem objects affected by fop executed by this fom.

Definition at line 210 of file fom_generic.c.

◆ fom_obj_check_wait()

static int fom_obj_check_wait ( struct m0_fom fom)
static

Resumes fom execution after completing blocking operation in M0_FOPH_OBJECT_CHECK.

Definition at line 219 of file fom_generic.c.

◆ fom_phase_init()

static int fom_phase_init ( struct m0_fom fom)
static

Begins fom execution, transitions fom to its first standard phase.

See also
m0_fom_tick_generic()
Return values
M0_FSO_AGAIN,toexecute next fom phase

Definition at line 148 of file fom_generic.c.

◆ fom_queue_reply()

static int fom_queue_reply ( struct m0_fom fom)
static

Posts reply fop, if the fom execution was done locally, reply fop is cached until the changes are integrated with the server.

Precondition
fom->fo_rep_fop != NULL if fom is not local
Todo:
Implement write back cache, during which we may perform updates on local objects and re-integrate with the server later, in that case we may block while, we caching fop, this requires more additions to the routine.

Definition at line 520 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_queue_reply_wait()

static int fom_queue_reply_wait ( struct m0_fom fom)
static

Resumes fom execution after completing a blocking operation in M0_FOPH_QUEUE_REPLY phase.

Definition at line 543 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_ready()

static void fom_ready ( struct m0_fom fom)
static

Enqueues fom into locality runq list and increments number of items in runq, m0_fom_locality::fl_runq_nr. This function is invoked when a new fom is submitted for execution or a waiting fom is re-scheduled for processing.

Postcondition
m0_fom_invariant(fom)

Definition at line 413 of file fom.c.

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

◆ fom_ready_cb()

static void fom_ready_cb ( struct m0_fom_callback cb)
static

Definition at line 1485 of file fom.c.

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

◆ fom_simple_fini()

static void fom_simple_fini ( struct m0_fom fom)
static

Definition at line 138 of file fom_simple.c.

Here is the call graph for this function:

◆ fom_simple_locality_get()

static size_t fom_simple_locality_get ( const struct m0_fom fom)
static

Definition at line 133 of file fom_simple.c.

◆ fom_simple_service_allocate()

static int fom_simple_service_allocate ( struct m0_reqh_service **  out,
const struct m0_reqh_service_type stype 
)
static

Definition at line 204 of file fom_simple.c.

Here is the call graph for this function:

◆ fom_simple_service_fini()

static void fom_simple_service_fini ( struct m0_reqh_service service)
static

Definition at line 192 of file fom_simple.c.

Here is the call graph for this function:

◆ fom_simple_service_prepare_to_stop()

static void fom_simple_service_prepare_to_stop ( struct m0_reqh_service service)
static

Definition at line 184 of file fom_simple.c.

◆ fom_simple_service_start()

static int fom_simple_service_start ( struct m0_reqh_service service)
static

Definition at line 179 of file fom_simple.c.

◆ fom_simple_service_stop()

static void fom_simple_service_stop ( struct m0_reqh_service service)
static

Definition at line 188 of file fom_simple.c.

◆ fom_simple_tick()

static int fom_simple_tick ( struct m0_fom fom)
static

Definition at line 109 of file fom_simple.c.

Here is the call graph for this function:

◆ fom_state()

static enum m0_fom_state fom_state ( const struct m0_fom fom)
inlinestatic

Definition at line 288 of file fom.c.

Here is the caller graph for this function:

◆ fom_state_set()

static void fom_state_set ( struct m0_fom fom,
enum m0_fom_state  state 
)
inlinestatic

Definition at line 293 of file fom.c.

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

◆ fom_success()

static int fom_success ( struct m0_fom fom)
static

Fom execution is successful.

Definition at line 399 of file fom_generic.c.

◆ fom_timeout()

static int fom_timeout ( struct m0_fom fom)
static

Definition at line 553 of file fom_generic.c.

Here is the caller graph for this function:

◆ fom_timeout_cb()

static void fom_timeout_cb ( struct m0_sm_timer timer)
static

Definition at line 1545 of file fom.c.

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

◆ fom_timeout_start()

static int fom_timeout_start ( struct m0_fom_timeout to,
struct m0_fom fom,
void(*)(struct m0_fom_callback *)  cb,
m0_time_t  deadline 
)
static

Definition at line 1555 of file fom.c.

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

◆ fom_tx_commit()

static int fom_tx_commit ( struct m0_fom fom)
static

Commits local fom transactional context if fom execution is successful.

Definition at line 441 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_tx_init()

static int fom_tx_init ( struct m0_fom fom)
static

Initialize fom local transactional context, the fom operations are executed in this context. After fom execution is completed the transaction is committed.

Definition at line 248 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_tx_open()

static int fom_tx_open ( struct m0_fom fom)
static

Creates fom local transactional context. Add a fol record fragment for the fop to the transaction.

Definition at line 268 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_tx_wait()

static int fom_tx_wait ( struct m0_fom fom)
static

Resumes fom execution after completing a blocking operation, issued at the M0_FOPH_TXN_OPEN phase.

Definition at line 289 of file fom_generic.c.

Here is the call graph for this function:

◆ fom_wait()

static void fom_wait ( struct m0_fom fom)
static

Puts fom on locality wait list if fom performs a blocking operation, this releases the handler thread to start executing another fom from the runq, thus making the reqh non blocking.

Fom state is changed to M0_FOS_WAITING. m0_fom_locality::fl_group.s_lock should be held before putting fom on the locality wait list.

This function is invoked from fom_exec(), if the fom is performing a blocking operation and m0_fom_ops::fo_tick() returns M0_FSO_WAIT.

Postcondition
m0_fom_invariant(fom)

Definition at line 654 of file fom.c.

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

◆ fom_wait_cb()

static bool fom_wait_cb ( struct m0_clink clink)
static

Definition at line 684 of file fom.c.

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

◆ fom_wait_fini()

static int fom_wait_fini ( void *  data)
static

Definition at line 715 of file fom.c.

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

◆ fom_wait_init()

static int fom_wait_init ( void *  data)
static

Definition at line 701 of file fom.c.

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

◆ fom_wait_is_completed()

static bool fom_wait_is_completed ( const struct fom_wait_data wd)
static

Definition at line 666 of file fom.c.

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

◆ fom_wait_rc()

static int fom_wait_rc ( const struct fom_wait_data wd)
static

Definition at line 672 of file fom.c.

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

◆ fom_wait_time_is_out()

static bool fom_wait_time_is_out ( const struct m0_fom_domain dom,
const struct m0_fom fom 
)
static

Definition at line 399 of file fom.c.

Here is the call graph for this function:

◆ generic_reply_build()

static void generic_reply_build ( struct m0_fom fom)
static

Allocates generic reqh error reply fop and sets the same into fom->fo_rep_fop.

Definition at line 318 of file fom_generic.c.

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

◆ group_lock()

static void group_lock ( struct m0_fom_locality loc)
static

Definition at line 219 of file fom.c.

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

◆ group_unlock()

static void group_unlock ( struct m0_fom_locality loc)
static

Definition at line 224 of file fom.c.

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

◆ hung_fom_notify()

static bool hung_fom_notify ( const struct m0_fom fom)
static

Definition at line 341 of file fom.c.

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

◆ hung_foms_notify()

static void hung_foms_notify ( struct m0_locality_chore chore,
struct m0_locality loc,
void *  place 
)
static

Definition at line 1160 of file fom.c.

◆ is_in_runq()

static bool is_in_runq ( const struct m0_fom fom)
static

Definition at line 234 of file fom.c.

Here is the caller graph for this function:

◆ is_in_wail()

static bool is_in_wail ( const struct m0_fom fom)
static

Definition at line 239 of file fom.c.

Here is the caller graph for this function:

◆ is_loc_locker_empty()

static bool is_loc_locker_empty ( struct m0_fom_locality loc,
uint32_t  key 
)
static

Definition at line 1276 of file fom.c.

Here is the caller graph for this function:

◆ loc_addb2_fini()

static void loc_addb2_fini ( struct m0_fom_locality loc)
static

Definition at line 1004 of file fom.c.

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

◆ loc_fini()

static void loc_fini ( struct m0_fom_locality loc)
static

Finalises a given locality.

Definition at line 1019 of file fom.c.

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

◆ loc_handler_thread()

static void loc_handler_thread ( struct m0_loc_thread th)
static

Locality handler thread. See the "Locality internals" section.

Definition at line 867 of file fom.c.

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

◆ loc_init()

static int loc_init ( struct m0_fom_locality loc,
struct m0_fom_domain dom,
size_t  idx 
)
static

Initialises a locality in fom domain. Creates and adds threads to locality, every thread is confined to the cpus represented by the m0_fom_locality::fl_processors, this is done in the locality thread init function (loc_thr_init()).

A pool of LOC_IDLE_NR idle threads is created together with a handler thread.

See also
loc_thr_create()
loc_thr_init()
Parameters
locm0_fom_locality to be initialised
idxindex of locality within fom domain

Definition at line 1065 of file fom.c.

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

◆ loc_thr_create()

static int loc_thr_create ( struct m0_fom_locality loc)
static

Definition at line 976 of file fom.c.

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

◆ loc_thr_fini()

static void loc_thr_fini ( struct m0_loc_thread th)
static

Definition at line 965 of file fom.c.

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

◆ loc_thr_init()

static int loc_thr_init ( struct m0_loc_thread th)
static

Init function for a locality thread. Confines the thread to the locality core.

Definition at line 960 of file fom.c.

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

◆ M0_BASSERT()

◆ m0_fom2reqh()

M0_INTERNAL struct m0_reqh * m0_fom2reqh ( const struct m0_fom fom)

Definition at line 1749 of file fom.c.

Here is the caller graph for this function:

◆ m0_fom_addb2_init()

M0_INTERNAL int m0_fom_addb2_init ( struct m0_fom_type type,
uint64_t  id 
)

◆ m0_fom_block_enter()

M0_INTERNAL void m0_fom_block_enter ( struct m0_fom fom)

This function is called before potential blocking point.

Parameters
fomA fom executing a possible blocking operation
See also
m0_fom_locality

Definition at line 538 of file fom.c.

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

◆ m0_fom_block_leave()

M0_INTERNAL void m0_fom_block_leave ( struct m0_fom fom)

This function is called after potential blocking point.

Parameters
fomA fom done executing a blocking operation

Definition at line 582 of file fom.c.

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

◆ m0_fom_callback_arm()

M0_INTERNAL void m0_fom_callback_arm ( struct m0_fom fom,
struct m0_chan chan,
struct m0_fom_callback cb 
)

Registers AST call-back with the channel and a fom executing a blocking operation. Both, the channel and the call-back (with initialized fc_bottom) are provided by user. The channel must be protected with external lock. Callback will be called with locality lock held.

Parameters
fomA fom executing a blocking operation
chanwaiting channel registered with the fom during its blocking operation
cbAST call-back with initialized fc_bottom
See also
sm/sm.h

Definition at line 1460 of file fom.c.

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

◆ m0_fom_callback_cancel()

M0_INTERNAL void m0_fom_callback_cancel ( struct m0_fom_callback cb)

Cancels a pending call-back.

It is guaranteed that call-back function won't be executing after this function returns (either because it already completed, or because the call-back was cancelled).

Note
: the channel the callback was registered on must be protected by the user with external lock.

Definition at line 1514 of file fom.c.

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

◆ m0_fom_callback_fini()

M0_INTERNAL void m0_fom_callback_fini ( struct m0_fom_callback cb)

Finalises the call-back. This is only safe to be called when:

- the call-back was never armed, or

- the last arming completely finished (both top- and bottom- halves were
  executed) or,

- the call-back was armed and the call to m0_fom_callback_cancel()
  returned true.

Definition at line 1497 of file fom.c.

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

◆ m0_fom_callback_init()

M0_INTERNAL void m0_fom_callback_init ( struct m0_fom_callback cb)

Initialises the call-back structure.

Definition at line 1454 of file fom.c.

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

◆ m0_fom_domain_fini()

M0_INTERNAL void m0_fom_domain_fini ( struct m0_fom_domain dom)

Finalises fom domain. Also finalises the localities in fom domain and destroys the handler threads per locality.

Parameters
domfom domain to be finalised, all the
Precondition
dom != NULL && dom->fd_localities != NULL

Definition at line 1256 of file fom.c.

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

◆ m0_fom_domain_init()

M0_INTERNAL int m0_fom_domain_init ( struct m0_fom_domain **  dom)

Initialises m0_fom_domain object provided by the caller. Creates and initialises localities with handler threads.

Parameters
domfom domain to be initialised, provided by caller
Precondition
dom != NULL

Definition at line 1173 of file fom.c.

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

◆ m0_fom_domain_invariant()

M0_INTERNAL bool m0_fom_domain_invariant ( const struct m0_fom_domain dom)

This function iterates over m0_fom_domain members and checks if they are intialised.

Definition at line 255 of file fom.c.

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

◆ m0_fom_domain_is_idle()

M0_INTERNAL bool m0_fom_domain_is_idle ( const struct m0_fom_domain dom)

True iff no locality in the domain has a fom to execute.

This function is, by intention, racy. To guarantee that the domain is idle, the caller must first guarantee that no new foms can be queued.

Definition at line 1289 of file fom.c.

◆ m0_fom_domain_is_idle_for()

M0_INTERNAL bool m0_fom_domain_is_idle_for ( const struct m0_reqh_service svc)

Definition at line 1281 of file fom.c.

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

◆ m0_fom_fdmi_record_post()

M0_INTERNAL void m0_fom_fdmi_record_post ( struct m0_fom fom)

Post FDMI record for this fom. FDMI record in this case contains FOL record.

Definition at line 1742 of file fom.c.

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

◆ m0_fom_fini()

void m0_fom_fini ( struct m0_fom fom)

Finalises a fom after it completes its execution, i.e success or failure.

Decrements the number of foms under execution in the locality (m0_fom_locality::fl_foms). Signals m0_reqh::rh_sd_signal once this counter reaches 0.

Parameters
fomA fom to be finalised
Precondition
m0_fom_phase(fom) == M0_FOM_PHASE_FINISH

Definition at line 1324 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_fol_rec_add()

M0_INTERNAL int m0_fom_fol_rec_add ( struct m0_fom fom)

Adds the FOL record prepared from the list of FOL record fragments in fom->fo_tx.tx_fol_rec. Record can contain fop data from fom->fo_fop, fom->fo_rep_fop and other data added in FOL record fragment.

Definition at line 1737 of file fom.c.

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

◆ m0_fom_generic_fini()

M0_INTERNAL void m0_fom_generic_fini ( void  )

Definition at line 53 of file fom_generic.c.

Here is the call graph for this function:

◆ m0_fom_generic_init()

M0_INTERNAL int m0_fom_generic_init ( void  )

Definition at line 58 of file fom_generic.c.

◆ m0_fom_group_is_locked()

M0_INTERNAL bool m0_fom_group_is_locked ( const struct m0_fom fom)

Returns the state of SM group for AST call-backs of locality, given fom is associated with.

Definition at line 229 of file fom.c.

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

◆ m0_fom_init()

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 
)

Initialises fom allocated by caller.

Invoked from m0_fom_type_ops::fto_create implementation for corresponding fom.

Fom starts in M0_FOM_PHASE_INIT phase and M0_FOS_RUNNING state to begin its execution.

Parameters
fomA fom to be initialized
fom_typeFom type
opsFom operations structure
fopRequest fop object
replyReply fop object
reqhRequest handler that will execute this fom
Precondition
fom != NULL
reqh != NULL
Note
The service may be in M0_RST_STARTING state if the fom was launched on startup

Definition at line 1372 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_invariant()

M0_INTERNAL bool m0_fom_invariant ( const struct m0_fom fom)

Iterates over m0_fom members and check if they are consistent, and also checks if the fom resides on correct list (i.e runq or wait list) of the locality at any given instance. This function must be invoked with m0_fom_locality::fl_group.s_lock mutex held.

Definition at line 311 of file fom.c.

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

◆ m0_fom_is_waiting()

M0_INTERNAL bool m0_fom_is_waiting ( const struct m0_fom fom)

Definition at line 1732 of file fom.c.

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

◆ m0_fom_is_waiting_on()

M0_INTERNAL bool m0_fom_is_waiting_on ( const struct m0_fom fom)

Returns true iff struct m0_fom::fo_cb is armed.

Definition at line 1480 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_locality_dec()

M0_INTERNAL bool m0_fom_locality_dec ( struct m0_fom fom)

Decrement fom count stored in m0_fom_locality::fl_lockers for service (m0_fom::fo_service) corresponding to the given fom.

Returns true iff the count dropped to 0.

Definition at line 1309 of file fom.c.

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

◆ m0_fom_locality_inc()

M0_INTERNAL void m0_fom_locality_inc ( struct m0_fom fom)

Increment fom count stored in m0_fom_locality::fl_lockers for service (m0_fom::fo_service) corresponding to the given fom.

Definition at line 1295 of file fom.c.

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

◆ m0_fom_locality_post_stats()

M0_INTERNAL void m0_fom_locality_post_stats ( struct m0_fom_locality loc)

Triggers the posting of statistics

◆ m0_fom_mod_rep_fill()

M0_INTERNAL void m0_fom_mod_rep_fill ( struct m0_fop_mod_rep rep,
struct m0_fom fom 
)

Definition at line 68 of file fom_generic.c.

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

◆ m0_fom_phase()

int m0_fom_phase ( const struct m0_fom fom)

Definition at line 1716 of file fom.c.

Here is the caller graph for this function:

◆ m0_fom_phase_move()

void m0_fom_phase_move ( struct m0_fom fom,
int32_t  rc,
int  phase 
)

Definition at line 1699 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_phase_moveif()

void m0_fom_phase_moveif ( struct m0_fom fom,
int32_t  rc,
int  phase0,
int  phase1 
)

Definition at line 1710 of file fom.c.

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

◆ m0_fom_phase_name()

M0_INTERNAL const char * m0_fom_phase_name ( const struct m0_fom fom,
int  phase 
)

Definition at line 1722 of file fom.c.

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

◆ m0_fom_phase_set()

void m0_fom_phase_set ( struct m0_fom fom,
int  phase 
)

Definition at line 1688 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_queue()

M0_INTERNAL void m0_fom_queue ( struct m0_fom fom)

Queues a fom for the execution in a locality runq.

Increments the number of foms in execution (m0_fom_locality::fl_foms).

The fom is placed in the locality run-queue and scheduled for the execution. Possible errors are reported through fom state and phase, hence the return type is void.

Parameters
fomA fom to be submitted for execution
Precondition
m0_fom_group_is_locked(fom)
m0_fom_phase(fom) == M0_FOM_PHASE_INIT

Definition at line 624 of file fom.c.

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

◆ m0_fom_rc()

M0_INTERNAL int m0_fom_rc ( const struct m0_fom fom)

Definition at line 1727 of file fom.c.

Here is the caller graph for this function:

◆ m0_fom_ready()

M0_INTERNAL void m0_fom_ready ( struct m0_fom fom)

Dequeues fom from the locality waiting queue and enqueues it into locality runq list changing the state to M0_FOS_READY.

Precondition
fom->fo_state == M0_FOS_WAITING
m0_fom_group_is_locked(fom)
Parameters
fomReady to be executed fom, is put on locality runq

Definition at line 429 of file fom.c.

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

◆ m0_fom_reqh()

M0_INTERNAL struct m0_reqh * m0_fom_reqh ( const struct m0_fom fom)

Returns reqh the fom belongs to

Definition at line 283 of file fom.c.

Here is the caller graph for this function:

◆ m0_fom_simple_hoard()

M0_INTERNAL void m0_fom_simple_hoard ( struct m0_fom_simple cat,
size_t  nr,
struct m0_reqh reqh,
struct m0_sm_conf conf,
int(*)(struct m0_fom *, void *, int *)  tick,
void(*)(struct m0_fom_simple *sfom)  free,
void *  data 
)

Starts an army of "nr" simple foms, queued to localities 0 .. (nr - 1).

A fom thus created can query its locality in m0_fom_simple::si_locality.

Definition at line 81 of file fom_simple.c.

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

◆ m0_fom_simple_post()

M0_INTERNAL void m0_fom_simple_post ( struct m0_fom_simple simpleton,
struct m0_reqh reqh,
struct m0_sm_conf conf,
int(*)(struct m0_fom *, void *, int *)  tick,
void(*)(struct m0_fom_simple *sfom)  free,
void *  data,
size_t  locality 
)

Queues a simple fom.

Definition at line 49 of file fom_simple.c.

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

◆ m0_fom_simples_fini()

M0_INTERNAL void m0_fom_simples_fini ( void  )

Definition at line 100 of file fom_simple.c.

Here is the call graph for this function:

◆ m0_fom_simples_init()

M0_INTERNAL int m0_fom_simples_init ( void  )

Definition at line 95 of file fom_simple.c.

Here is the call graph for this function:

◆ m0_fom_sm_init()

M0_INTERNAL void m0_fom_sm_init ( struct m0_fom fom)

Initialises FOM state machines for phases and states.

See also
m0_fom::fo_sm_phase
m0_fom::fo_sm_state
Precondition
fom->fo_loc != NULL

Definition at line 1674 of file fom.c.

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

◆ m0_fom_tick_generic()

int m0_fom_tick_generic ( struct m0_fom fom)

Standard fom phase transition function.

This function handles standard fom phases from enum m0_fom_standard_phase.

First do "standard actions":

  • authenticity checks: reqh verifies that protected state in the fop is authentic. Various bits of information in M0 are protected by cryptographic signatures made by a node that issued this information: object identifiers (including container identifiers and fids), capabilities, locks, layout identifiers, other resources identifiers, etc. reqh verifies authenticity of such information by fetching corresponding node keys, re-computing the signature locally and checking it with one in the fop;
  • resource limits: reqh estimates local resources (memory, cpu cycles, storage and network bandwidths) necessary for operation execution. The execution of operation is delayed if it would overload the server or exhaust resource quotas associated with operation source (client, group of clients, user, group of users, job, etc.);
  • resource usage and conflict resolution: reqh determines what distributed resources will be consumed by the operation execution and call resource management infrastructure to request the resources and deal with resource usage conflicts (by calling RM if necessary);
  • object existence: reqh extracts identities of file system objects affected by the fop and requests appropriate stores to load object representations together with their basic attributes;
  • authorization control: reqh extracts the identity of a user (or users) on whose behalf the operation is executed. reqh then uses enterprise user data base to map user identities into internal form. Resulting internal user identifiers are matched against protection and authorization information stored in the file system objects (loaded on the previous step);
  • distributed transactions: for operations mutating file system state, reqh sets up local transaction context where the rest of the operation is executed.

Once the standard actions are performed successfully, request handler delegates the rest of operation execution to the fom type specific state transition function.

Fom execution proceeds as follows:

TODO update to reflect changes (FOPH_FOL_REC_ADD, FOPH_TXN_LOGGED_WAIT, absence of FOPH_FAILED)

     fop
      |
      v                fom->fo_state = FOS_READY
  m0_reqh_fop_handle()-------------->FOM
                                 | fom->fo_state = FOS_RUNNING
                                 v
                             FOPH_INIT
                                 |
                failed           v         fom->fo_state = FOS_WAITING
             +<-----------FOPH_AUTHETICATE------------->+
             |                   |           FOPH_AUTHENTICATE_WAIT
             |                   v<---------------------+
             +<----------FOPH_RESOURCE_LOCAL----------->+
             |                   |           FOPH_RESOURCE_LOCAL_WAIT
             |                   v<---------------------+
             +<-------FOPH_RESOURCE_DISTRIBUTED-------->+
             |                   |        FOPH_RESOURCE_DISTRIBUTED_WAIT
             |                   v<---------------------+
             +<---------FOPH_OBJECT_CHECK-------------->+
             |                   |              FOPH_OBJECT_CHECK
             |                   v<---------------------+
             +<---------FOPH_AUTHORISATION------------->+
             |                   |            FOPH_AUTHORISATION
                  |                      v<---------------------+
             +<---------FOPH_TXN_CONTEXT--------------->+
             |                   |            FOPH_TXN_CONTEXT_WAIT
             |                   v<---------------------+
             +<-------------FOPH_NR_+_1---------------->+
             |                   |            FOPH_NR_+_1_WAIT
             v                   v<---------------------+
         FOPH_FAILED        FOPH_SUCCESS
             |                   |
             |                   v
             +------------FOPH_TXN_COMMIT-------------->+
                                 |              FOPH_TXN_DONE_WAIT
                    send reply   v<---------------------+
                        FOPH_QUEUE_REPLY------------->+
                                 |            FOPH_QUEUE_REPLY_WAIT
                                 v<---------------------+
                           FOPH_FINISH ---> m0_fom_fini()

If a generic phase handler function fails while executing a fom, then it just sets the m0_fom::fo_rc to the result of the operation and returns M0_FSO_WAIT. m0_fom_tick_generic() then sets the m0_fom::fo_phase to M0_FOPH_FAILED, logs an ADDB event, and returns, later the fom execution proceeds as mentioned in above diagram.

If fom fails while executing fop specific operation, the m0_fom::fo_phase is set to M0_FOPH_FAILED already by the fop specific operation handler, and the m0_fom::fo_rc set to the result of the operation.

See also
m0_fom_phase
m0_fom_phase_outcome
Parameters
fom,fomunder execution
Return values
M0_FSO_AGAIN,iffom operation is successful, transition to next phase, M0_FSO_WAIT, if fom execution blocks and fom goes into corresponding wait phase, or if fom execution is complete, i.e success or failure
Todo:
standard fom phases implementation, depends on the support routines for handling various standard operations on fop as mentioned above

Definition at line 848 of file fom_generic.c.

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

◆ m0_fom_timedwait()

M0_INTERNAL int m0_fom_timedwait ( struct m0_fom fom,
uint64_t  phases,
m0_time_t  deadline 
)

Analogue of m0_sm_timedwait() for FOM.

The intended usage of this function:

  • user wakes up the FOM to perform some job;
  • user calls m0_fom_timedwait() and blocks waiting for FOM to finish the job;
  • FOM finishes the job and transit to one of the user defined states;
  • FOM remains in this state forever, waiting for new jobs;
  • m0_fom_timedwait() returns.

Caveats:

  • FOM should be queued since fom->fo_loc should be valid.
  • FOM structure shouldn't be deallocated before m0_fom_timedwait() returns.
  • FOM executes in a separate thread and the number of phase transitions happened before m0_fom_timedwait() starts listening for the transitions in general is unpredictable.

Definition at line 724 of file fom.c.

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

◆ m0_fom_timeout_arm()

M0_INTERNAL int m0_fom_timeout_arm ( struct m0_fom_timeout to,
struct m0_fom fom,
void(*)(struct m0_fom_callback *)  cb,
m0_time_t  deadline 
)

Arranges for the given call-back "cb" to be called after the specified (absolute) deadline.

"cb" will be called with m0_fom_callback structure, containing pointer to the fom in ->fc_fom field.

Precondition
m0_fom_group_is_locked(fom)

Definition at line 1573 of file fom.c.

Here is the call graph for this function:

◆ m0_fom_timeout_cancel()

M0_INTERNAL void m0_fom_timeout_cancel ( struct m0_fom_timeout to)

Attempts to cancel the fom timeout.

The timer call-back won't be executing by the time this function returns.

Precondition
m0_fom_group_is_locked(fom)

Definition at line 1581 of file fom.c.

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

◆ m0_fom_timeout_fini()

M0_INTERNAL void m0_fom_timeout_fini ( struct m0_fom_timeout to)

Definition at line 1539 of file fom.c.

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

◆ m0_fom_timeout_init()

M0_INTERNAL void m0_fom_timeout_init ( struct m0_fom_timeout to)

Definition at line 1532 of file fom.c.

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

◆ m0_fom_timeout_wait_on()

M0_INTERNAL int m0_fom_timeout_wait_on ( struct m0_fom_timeout to,
struct m0_fom fom,
m0_time_t  deadline 
)

Arranges for the fom to be woken up after a specified (absolute) timeout.

This must be called under the locality lock. If called from a tick function, the function should return M0_FSO_WAIT.

Precondition
m0_fom_group_is_locked(fom)

Definition at line 1566 of file fom.c.

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

◆ m0_fom_tx()

static struct m0_be_tx* m0_fom_tx ( struct m0_fom fom)
inlinestatic

Definition at line 537 of file fom.h.

Here is the caller graph for this function:

◆ m0_fom_tx_credit()

static struct m0_be_tx_credit* m0_fom_tx_credit ( struct m0_fom fom)
inlinestatic

Definition at line 542 of file fom.h.

Here is the caller graph for this function:

◆ m0_fom_tx_done_wait()

M0_INTERNAL int m0_fom_tx_done_wait ( struct m0_fom fom)

Resumes fom execution after completing a blocking operation in M0_FOPH_TXN_LOGGED_WAIT phase.

Definition at line 490 of file fom_generic.c.

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

◆ m0_fom_tx_logged_wait()

M0_INTERNAL int m0_fom_tx_logged_wait ( struct m0_fom fom)

Resumes fom execution after completing a blocking operation in M0_FOPH_TXN_COMMIT phase.

Definition at line 461 of file fom_generic.c.

Here is the call graph for this function:

◆ m0_fom_type_init()

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 
)

Definition at line 1596 of file fom.c.

Here is the caller graph for this function:

◆ m0_fom_wait_on()

M0_INTERNAL void m0_fom_wait_on ( struct m0_fom fom,
struct m0_chan chan,
struct m0_fom_callback cb 
)

The same as m0_fom_callback_arm(), but fc_bottom is initialized automatically with internal static routine which just wakes up the fom. Convenient when there is no need for custom fc_bottom.

Parameters
fomA fom executing a blocking operation
chanwaiting channel registered with the fom during its blocking operation
cbAST call-back
See also
sm/sm.h

Definition at line 1490 of file fom.c.

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

◆ m0_fom_wakeup()

M0_INTERNAL void m0_fom_wakeup ( struct m0_fom fom)

Moves the fom from waiting to ready queue. Similar to m0_fom_ready(), but callable from a locality different from fom's locality (i.e., with a different locality group lock held).

Definition at line 532 of file fom.c.

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

◆ m0_foms_fini()

M0_INTERNAL void m0_foms_fini ( void  )

Definition at line 1669 of file fom.c.

Here is the call graph for this function:

◆ m0_foms_init()

M0_INTERNAL int m0_foms_init ( void  )

Definition at line 1662 of file fom.c.

Here is the call graph for this function:

◆ m0_locality_invariant()

M0_INTERNAL bool m0_locality_invariant ( const struct m0_fom_locality loc)

Iterates over m0_fom_locality members and checks if they are intialised and consistent. This function must be invoked with m0_fom_locality::fl_group.s_lock mutex held.

Definition at line 266 of file fom.c.

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

◆ m0_rpc_item_generic_reply_rc()

int32_t m0_rpc_item_generic_reply_rc ( const struct m0_rpc_item item)

If item is of type m0_fop_generic_reply then m0_rpc_item_generic_reply_rc() extracts and returns error code contained in the fop; otherwise it returns 0.

Definition at line 81 of file fom_generic.c.

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

◆ m0_rpc_item_is_generic_reply_fop()

bool m0_rpc_item_is_generic_reply_fop ( const struct m0_rpc_item item)

Definition at line 75 of file fom_generic.c.

Here is the caller graph for this function:

◆ M0_TL_DEFINE() [1/3]

M0_TL_DEFINE ( thr  ,
static  ,
struct m0_loc_thread   
)

◆ M0_TL_DEFINE() [2/3]

M0_TL_DEFINE ( runq  ,
static  ,
struct m0_fom   
)

◆ M0_TL_DEFINE() [3/3]

M0_TL_DEFINE ( wail  ,
static  ,
struct m0_fom   
)

◆ M0_TL_DESCR_DEFINE() [1/3]

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_DESCR_DEFINE() [2/3]

M0_TL_DESCR_DEFINE ( runq  ,
"runq fom ,
static  ,
struct m0_fom  ,
fo_linkage  ,
fo_magic  ,
M0_FOM_MAGIC  ,
M0_FOM_RUNQ_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [3/3]

M0_TL_DESCR_DEFINE ( wail  ,
"wail fom ,
static  ,
struct m0_fom  ,
fo_linkage  ,
fo_magic  ,
M0_FOM_MAGIC  ,
M0_FOM_WAIL_MAGIC   
)

◆ queueit()

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

Definition at line 502 of file fom.c.

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

◆ readyit()

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

Definition at line 441 of file fom.c.

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

◆ sm2fom()

static M0_UNUSED struct m0_fom* sm2fom ( struct m0_sm sm)
inlinestatic

Definition at line 306 of file fom.c.

◆ thr_addb2_enter()

static void thr_addb2_enter ( struct m0_loc_thread thr,
struct m0_fom_locality loc 
)
static

Definition at line 514 of file fom.c.

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

◆ thr_addb2_leave()

static void thr_addb2_leave ( struct m0_loc_thread thr,
struct m0_fom_locality loc 
)
static

Definition at line 523 of file fom.c.

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

◆ thread_invariant()

static bool thread_invariant ( const struct m0_loc_thread t)
static

Definition at line 244 of file fom.c.

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

Variable Documentation

◆ fom_simple_conf

static struct m0_sm_conf fom_simple_conf
static
Initial value:
= {
.scf_name = "simple fom",
.scf_nr_states = ARRAY_SIZE(fom_simple_phases),
.scf_state = fom_simple_phases
}
static struct m0_sm_state_descr fom_simple_phases[]
Definition: fom_simple.c:158
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 45 of file fom_simple.c.

◆ fom_simple_ft_ops

static const struct m0_fom_type_ops fom_simple_ft_ops
static
Initial value:
= {
}

Definition at line 42 of file fom_simple.c.

◆ fom_simple_ops

static const struct m0_fom_ops fom_simple_ops
static
Initial value:
= {
.fo_fini = &fom_simple_fini,
.fo_tick = &fom_simple_tick,
.fo_home_locality = &fom_simple_locality_get
}
static void fom_simple_fini(struct m0_fom *fom)
Definition: fom_simple.c:138
static size_t fom_simple_locality_get(const struct m0_fom *fom)
Definition: fom_simple.c:133
static int fom_simple_tick(struct m0_fom *fom)
Definition: fom_simple.c:109

Definition at line 44 of file fom_simple.c.

◆ fom_simple_phases

struct m0_sm_state_descr fom_simple_phases[]
static
Initial value:
= {
.sd_name = "working",
.sd_flags = M0_SDF_INITIAL
},
.sd_name = "done",
.sd_flags = M0_SDF_TERMINAL
}
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 158 of file fom_simple.c.

◆ fom_simple_rsops

const struct m0_reqh_service_type_ops fom_simple_rsops
static
Initial value:
= {
.rsto_service_allocate = &fom_simple_service_allocate
}
static int fom_simple_service_allocate(struct m0_reqh_service **out, const struct m0_reqh_service_type *stype)
Definition: fom_simple.c:204

Definition at line 216 of file fom_simple.c.

◆ fom_simple_rstype

static struct m0_reqh_service_type fom_simple_rstype
static
Initial value:
= {
.rst_name = "simple-fom-service",
.rst_ops = &fom_simple_rsops,
.rst_level = M0_RS_LEVEL_NORMAL
}
static const struct m0_reqh_service_type_ops fom_simple_rsops
Definition: fom_simple.c:216

Definition at line 43 of file fom_simple.c.

◆ fom_simple_service_ops

const struct m0_reqh_service_ops fom_simple_service_ops
static
Initial value:
= {
.rso_start = &fom_simple_service_start,
.rso_prepare_to_stop = &fom_simple_service_prepare_to_stop,
}
static void fom_simple_service_stop(struct m0_reqh_service *service)
Definition: fom_simple.c:188
static void fom_simple_service_prepare_to_stop(struct m0_reqh_service *service)
Definition: fom_simple.c:184
static int fom_simple_service_start(struct m0_reqh_service *service)
Definition: fom_simple.c:179
static void fom_simple_service_fini(struct m0_reqh_service *service)
Definition: fom_simple.c:192

Definition at line 197 of file fom_simple.c.

◆ fom_states

struct m0_sm_state_descr fom_states[]
static
Initial value:
= {
.sd_flags = M0_SDF_INITIAL,
.sd_name = "Init",
},
.sd_name = "Ready",
.sd_allowed = M0_BITS(M0_FOS_RUNNING)
},
.sd_name = "Running",
},
.sd_name = "Waiting",
},
.sd_flags = M0_SDF_TERMINAL,
.sd_name = "Finished",
}
}
#define M0_BITS(...)
Definition: misc.h:236

Definition at line 1616 of file fom.c.

◆ fom_states_conf [1/2]

M0_EXTERN struct m0_sm_conf fom_states_conf

Definition at line 47 of file fom_simple.c.

◆ fom_states_conf [2/2]

M0_INTERNAL struct m0_sm_conf fom_states_conf
Initial value:
= {
.scf_name = "FOM states",
.scf_nr_states = ARRAY_SIZE(fom_states),
.scf_state = fom_states,
.scf_trans_nr = ARRAY_SIZE(fom_trans),
.scf_trans = fom_trans
}
static struct m0_sm_trans_descr fom_trans[M0_FOS_TRANS_NR]
Definition: fom.c:1641
static struct m0_sm_state_descr fom_states[]
Definition: fom.c:1616
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 202 of file fom.c.

◆ fom_states_conf0

static struct m0_sm_conf fom_states_conf0
static

Definition at line 201 of file fom.c.

◆ fom_trans

struct m0_sm_trans_descr fom_trans[M0_FOS_TRANS_NR]
static
Initial value:

Definition at line 1641 of file fom.c.

◆ fpd_table

const struct fom_phase_desc fpd_table[]
static

Fom phase operations table, this defines a fom_phase_desc object for every generic phase of the fom, containing a function pointer to the phase handler, the next phase fom should transition into and a phase name in user visible format in order to log addb event.

See also
struct fom_phase_desc

Definition at line 566 of file fom_generic.c.

◆ generic_phases

struct m0_sm_state_descr generic_phases[]
static

FOM generic phases, allowed transitions from each phase and their functions are assigned to a state machine descriptor. State name is used to log addb event.

Definition at line 642 of file fom_generic.c.

◆ hung_foms_chore_ops

const struct m0_locality_chore_ops hung_foms_chore_ops
static
Initial value:
= {
.co_tick = hung_foms_notify
}
static void hung_foms_notify(struct m0_locality_chore *chore, struct m0_locality *loc, void *place)
Definition: fom.c:1160

Chore which detects long-living foms.

Definition at line 215 of file fom.c.

◆ m0_fom__types

M0_INTERNAL struct m0_fom_type* m0_fom__types[M0_OPCODES_NR]

Definition at line 1594 of file fom.c.

◆ m0_fom_dom_ops

struct m0_fom_domain_ops m0_fom_dom_ops
static
Initial value:
= {
.fdo_time_is_out = fom_wait_time_is_out
}
static bool fom_wait_time_is_out(const struct m0_fom_domain *dom, const struct m0_fom *fom)
Definition: fom.c:399

Fom domain operations.

Todo:
Support fom timeout functionality.

Definition at line 208 of file fom.c.

◆ m0_fop_generic_reply_fopt

struct m0_fop_type m0_fop_generic_reply_fopt

Definition at line 50 of file fom_generic.c.

◆ m0_generic_conf

const struct m0_sm_conf m0_generic_conf
Initial value:
= {
.scf_magic = M0_SM_CONF_MAGIC,
.scf_name = "standard-phases",
.scf_nr_states = ARRAY_SIZE(generic_phases),
.scf_state = generic_phases,
}
struct m0_sm_trans_descr m0_generic_phases_trans[]
Definition: fom_generic.c:765
static struct m0_sm_state_descr generic_phases[]
Definition: fom_generic.c:642
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 838 of file fom_generic.c.

◆ m0_generic_phases_trans

struct m0_sm_trans_descr m0_generic_phases_trans[]

Definition at line 765 of file fom_generic.c.