Motr  M0
fsync_foms.c File Reference
#include "fop/fop.h"
#include "lib/assert.h"
#include "lib/errno.h"
#include "lib/memory.h"
#include "lib/trace.h"
#include "mdservice/fsync_foms.h"
#include "mdservice/fsync_fops.h"
#include "ioservice/io_fops.h"
#include "cas/cas.h"
#include "rpc/rpc_opcodes.h"
#include "ioservice/storage_dev.h"
#include "motr/setup.h"
#include "fop/fom_generic.h"
#include "be/domain.h"
#include "be/engine.h"
#include "reqh/reqh.h"
Include dependency graph for fsync_foms.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB
 

Enumerations

enum  fsync_fom_phase { M0_FOPH_FSYNC_FOM_START = M0_FOPH_NR + 1, M0_FOPH_FSYNC_FOM_WAIT, M0_FOPH_FSYNC_DATASYNC }
 

Functions

static void fsync_fom_fini (struct m0_fom *fom)
 
static int fsync_fom_tick (struct m0_fom *fom)
 
static size_t fsync_fom_locality_get (const struct m0_fom *fom)
 
static struct m0_be_txfsync_target_tx_get (struct m0_fom *fom, uint64_t txid)
 
M0_INTERNAL int m0_fsync_req_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 

Variables

static const struct m0_fom_ops fsync_fom_ops
 
struct m0_sm_state_descr m0_fsync_fom_phases []
 
static struct m0_sm_trans_descr fsync_fom_phases_trans []
 
M0_INTERNAL struct m0_sm_conf m0_fsync_fom_conf
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_COB

Definition at line 22 of file fsync_foms.c.

Enumeration Type Documentation

◆ fsync_fom_phase

Phase names of an fsync fom

Enumerator
M0_FOPH_FSYNC_FOM_START 
M0_FOPH_FSYNC_FOM_WAIT 
M0_FOPH_FSYNC_DATASYNC 

Definition at line 60 of file fsync_foms.c.

Function Documentation

◆ fsync_fom_fini()

static void fsync_fom_fini ( struct m0_fom fom)
static

Finalizes and releases an fsync fom.

Parameters
fomfsync fom to be released.

Definition at line 321 of file fsync_foms.c.

Here is the call graph for this function:

◆ fsync_fom_locality_get()

static size_t fsync_fom_locality_get ( const struct m0_fom fom)
static

Returns the locality of an fsync fom. This affects the processor where the fom is to be processed.

Parameters
fomfom whose locality is to be retrieved.
Returns
A locality ID.

Definition at line 308 of file fsync_foms.c.

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

◆ fsync_fom_tick()

static int fsync_fom_tick ( struct m0_fom fom)
static

Controls the simple logic of the fsync fom's state machine. If the target transaction is already logged, the processing of the fsync fop is finished. If, on the contrary, the target transaction has not been logged yet, the fsync fom performs the following actions depending on the phase of the fsync state machine:

  • M0_FOPH_FSYNC_FOM_START: If the fop request includes the M0_BT_ACTIVE mode flag, the target transaction gets forced. The fom's phase then changes to M0_FOPH_FSYNC_FOM_WAIT.
  • M0_FOPH_FSYNC_FOM_WAIT: The fsync fom registers itself to be notified when the state of the target transaction changes and then waits. Whenever the target transaction gets finally logged, the fsync fom gets woken up so it can complete the processing of the fsync request and send the corresponding fsync reply.
Parameters
fomfsync fom processing the fsync FOP request.
Returns
Always M0_FSO_WAIT. Note that if the processing of the fsync fop is considered completed, the phase of the fsync fom is set to M0_FOPH_FSYNC_FOM_FINISH. In this later case, a return code is included in the fsync fop reply.

Definition at line 174 of file fsync_foms.c.

Here is the call graph for this function:

◆ fsync_target_tx_get()

static struct m0_be_tx* fsync_target_tx_get ( struct m0_fom fom,
uint64_t  txid 
)
static

Gets the transaction an fsync fop request is targeted to.

Parameters
fomfom associated to the fsync fop request being processed.
txidID of the target transaction.
Returns
A pointer to the target transaction or NULL if the operation failed.
Remarks
This function acquires a reference on the target transaction. Call m0_be_tx_put once you are done with the tx, so it can be eventually completed.

Definition at line 141 of file fsync_foms.c.

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

◆ m0_fsync_req_fom_create()

M0_INTERNAL int m0_fsync_req_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)

Creates a new fsync fom for a given fsync fop request.

Definition at line 330 of file fsync_foms.c.

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

Variable Documentation

◆ fsync_fom_ops

const struct m0_fom_ops fsync_fom_ops
static
Initial value:
= {
.fo_fini = fsync_fom_fini,
.fo_tick = fsync_fom_tick,
.fo_home_locality = fsync_fom_locality_get
}
static void fsync_fom_fini(struct m0_fom *fom)
Definition: fsync_foms.c:321
static size_t fsync_fom_locality_get(const struct m0_fom *fom)
Definition: fsync_foms.c:308
static int fsync_fom_tick(struct m0_fom *fom)
Definition: fsync_foms.c:174

fsync fom operations

Definition at line 51 of file fsync_foms.c.

◆ fsync_fom_phases_trans

struct m0_sm_trans_descr fsync_fom_phases_trans[]
static
Initial value:

Valid phase transitions for an fsync fom.

Definition at line 94 of file fsync_foms.c.

◆ m0_fsync_fom_conf

M0_INTERNAL struct m0_sm_conf m0_fsync_fom_conf
Initial value:
= {
.scf_name = "fsync",
.scf_nr_states = ARRAY_SIZE(m0_fsync_fom_phases),
.scf_state = m0_fsync_fom_phases,
.scf_trans = fsync_fom_phases_trans,
}
struct m0_sm_state_descr m0_fsync_fom_phases[]
Definition: fsync_foms.c:69
static struct m0_sm_trans_descr fsync_fom_phases_trans[]
Definition: fsync_foms.c:94
#define ARRAY_SIZE(a)
Definition: misc.h:45

This object defines the phases of an fsync fom. It is used when initializing an fsync fom.

An fsync fom has two different phases:

 - M0_FOPH_FSYNC_FOM_START: This is the initial state for any fsync fom.
 In this phase, the fom knows its tick function has not been invoked
 before. Only if the fsync request includes the M0_FSYNC_MODE_ACTIVE
 mode, the target transaction is forced. In any case, after the first
 tick the machine's phase changes to M0_FOPH_FSYNC_FOM_WAIT.

 - M0_FOPH_FSYNC_FOM_WAIT: The fom waits on the target transaction until
 its state changes to M0_BTS_LOGGED.

Definition at line 123 of file fsync_foms.c.

◆ m0_fsync_fom_phases

struct m0_sm_state_descr m0_fsync_fom_phases[]
Initial value:

Phases of an fsync fom

Definition at line 69 of file fsync_foms.c.