Motr  M0
drlink.c File Reference
#include "lib/trace.h"
#include "addb2/identifier.h"
#include "dtm0/fop.h"
#include "dtm0/service.h"
#include "dtm0/svc_internal.h"
#include "lib/coroutine.h"
#include "lib/memory.h"
#include "reqh/reqh.h"
#include "rpc/rpc.h"
#include "rpc/rpc_machine.h"
#include "rpc/rpc_opcodes.h"
Include dependency graph for drlink.c:

Go to the source code of this file.

Data Structures

struct  drlink_fom
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_DTM0
 
#define _ST(name, allowed)
 
#define F   M0_CO_FRAME_DATA
 

Enumerations

enum  drlink_fom_state {
  DRF_INIT = M0_FOM_PHASE_INIT, DRF_DONE = M0_FOM_PHASE_FINISH, DRF_LOCKING = M0_FOM_PHASE_NR, DRF_CONNECTING,
  DRF_SENDING, DRF_WAITING_FOR_REPLY, DRF_FAILED, DRF_NR
}
 
enum  dpr_state { DPR_TRANSIENT, DPR_ONLINE, DPR_FAILED }
 

Functions

static struct drlink_fomfom2drlink_fom (struct m0_fom *fom)
 
static size_t drlink_fom_locality (const struct m0_fom *fom)
 
static void drlink_fom_fini (struct m0_fom *fom)
 
static int drlink_fom_tick (struct m0_fom *fom)
 
M0_INTERNAL int m0_dtm0_rpc_link_mod_init (void)
 
M0_INTERNAL void m0_dtm0_rpc_link_mod_fini (void)
 
static struct dtm0_req_fopdtm0_req_fop_dup (const struct dtm0_req_fop *src)
 
static void dtm0_req_fop_fini (struct dtm0_req_fop *req)
 
static int drlink_fom_init (struct drlink_fom *fom, struct m0_dtm0_service *svc, struct m0_be_op *op, const struct m0_fid *tgt, const struct dtm0_req_fop *req, const struct m0_fom *parent_fom, bool wait_for_ack)
 
static void co_long_write_lock (struct m0_co_context *context, struct m0_long_lock *lk, struct m0_long_lock_link *link, int next_phase)
 
static void co_rpc_link_connect (struct m0_co_context *context, struct m0_rpc_link *rlink, struct m0_fom *fom, int next_phase)
 
static int find_or_add (struct m0_dtm0_service *dtms, const struct m0_fid *tgt, struct dtm0_process **out)
 
static struct drlink_fomitem2drlink_fom (struct m0_rpc_item *item)
 
static void dtm0_rlink_rpc_item_reply_cb (struct m0_rpc_item *item)
 
static int dtm0_process_rlink_reinit (struct dtm0_process *proc, struct drlink_fom *df)
 
static int dtm0_process_rlink_send (struct dtm0_process *proc, struct drlink_fom *drf)
 
static enum dpr_state dpr_state_infer (struct dtm0_process *proc)
 
static void drlink_addb_drf2item_relate (struct drlink_fom *drf)
 
static void drlink_addb_drf2parent_relate (struct drlink_fom *drf)
 
static void drlink_coro_fom_tick (struct m0_co_context *context)
 
M0_INTERNAL int m0_dtm0_req_post (struct m0_dtm0_service *svc, struct m0_be_op *op, const struct dtm0_req_fop *req, const struct m0_fid *tgt, const struct m0_fom *parent_fom, bool wait_for_ack)
 

Variables

static const struct m0_fom_ops drlink_fom_ops
 
static struct m0_fom_type drlink_fom_type
 
static const struct m0_fom_type_ops drlink_fom_type_ops = {}
 
static const struct m0_sm_conf drlink_fom_conf
 
static struct m0_sm_state_descr drlink_fom_states []
 
const struct m0_rpc_item_ops dtm0_req_fop_rlink_rpc_item_ops
 

Macro Definition Documentation

◆ _ST

#define _ST (   name,
  allowed 
)
Value:
[name] = { \
.sd_name = #name, \
.sd_allowed = allowed \
}
const char * name
Definition: trace.c:110

◆ F

#define F   M0_CO_FRAME_DATA

Definition at line 433 of file drlink.c.

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_DTM0

Definition at line 22 of file drlink.c.

Enumeration Type Documentation

◆ dpr_state

enum dpr_state

An aggregated status of a dtm0_process:dop_rlink

Enumerator
DPR_TRANSIENT 

Link is not alive but we can resurrect it.

DPR_ONLINE 

Link is alive and ready to transfer items.

DPR_FAILED 

Link is permanently dead.

Definition at line 375 of file drlink.c.

◆ drlink_fom_state

Enumerator
DRF_INIT 
DRF_DONE 
DRF_LOCKING 
DRF_CONNECTING 
DRF_SENDING 
DRF_WAITING_FOR_REPLY 
DRF_FAILED 
DRF_NR 

Definition at line 253 of file drlink.c.

Function Documentation

◆ co_long_write_lock()

static void co_long_write_lock ( struct m0_co_context context,
struct m0_long_lock lk,
struct m0_long_lock_link link,
int  next_phase 
)
static

Definition at line 198 of file drlink.c.

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

◆ co_rpc_link_connect()

static void co_rpc_link_connect ( struct m0_co_context context,
struct m0_rpc_link rlink,
struct m0_fom fom,
int  next_phase 
)
static

Definition at line 210 of file drlink.c.

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

◆ dpr_state_infer()

static enum dpr_state dpr_state_infer ( struct dtm0_process proc)
static

Definition at line 384 of file drlink.c.

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

◆ drlink_addb_drf2item_relate()

static void drlink_addb_drf2item_relate ( struct drlink_fom drf)
static

Definition at line 415 of file drlink.c.

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

◆ drlink_addb_drf2parent_relate()

static void drlink_addb_drf2parent_relate ( struct drlink_fom drf)
static

Definition at line 427 of file drlink.c.

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

◆ drlink_coro_fom_tick()

static void drlink_coro_fom_tick ( struct m0_co_context context)
static

Definition at line 434 of file drlink.c.

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

◆ drlink_fom_fini()

static void drlink_fom_fini ( struct m0_fom fom)
static

Definition at line 189 of file drlink.c.

Here is the call graph for this function:

◆ drlink_fom_init()

static int drlink_fom_init ( struct drlink_fom fom,
struct m0_dtm0_service svc,
struct m0_be_op op,
const struct m0_fid tgt,
const struct dtm0_req_fop req,
const struct m0_fom parent_fom,
bool  wait_for_ack 
)
static

Definition at line 126 of file drlink.c.

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

◆ drlink_fom_locality()

static size_t drlink_fom_locality ( const struct m0_fom fom)
static

Definition at line 54 of file drlink.c.

◆ drlink_fom_tick()

static int drlink_fom_tick ( struct m0_fom fom)
static

Definition at line 516 of file drlink.c.

Here is the call graph for this function:

◆ dtm0_process_rlink_reinit()

static int dtm0_process_rlink_reinit ( struct dtm0_process proc,
struct drlink_fom df 
)
static

Definition at line 341 of file drlink.c.

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

◆ dtm0_process_rlink_send()

static int dtm0_process_rlink_send ( struct dtm0_process proc,
struct drlink_fom drf 
)
static

Definition at line 356 of file drlink.c.

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

◆ dtm0_req_fop_dup()

static struct dtm0_req_fop* dtm0_req_fop_dup ( const struct dtm0_req_fop src)
static

Definition at line 92 of file drlink.c.

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

◆ dtm0_req_fop_fini()

static void dtm0_req_fop_fini ( struct dtm0_req_fop req)
static

Definition at line 120 of file drlink.c.

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

◆ dtm0_rlink_rpc_item_reply_cb()

static void dtm0_rlink_rpc_item_reply_cb ( struct m0_rpc_item item)
static

Definition at line 313 of file drlink.c.

Here is the call graph for this function:

◆ find_or_add()

static int find_or_add ( struct m0_dtm0_service dtms,
const struct m0_fid tgt,
struct dtm0_process **  out 
)
static

Definition at line 227 of file drlink.c.

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

◆ fom2drlink_fom()

static struct drlink_fom* fom2drlink_fom ( struct m0_fom fom)
static

Definition at line 47 of file drlink.c.

Here is the caller graph for this function:

◆ item2drlink_fom()

static struct drlink_fom* item2drlink_fom ( struct m0_rpc_item item)
static

Definition at line 308 of file drlink.c.

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

◆ m0_dtm0_req_post()

M0_INTERNAL int m0_dtm0_req_post ( struct m0_dtm0_service svc,
struct m0_be_op op,
const struct dtm0_req_fop req,
const struct m0_fid tgt,
const struct m0_fom parent_fom,
bool  wait_for_ack 
)

Asynchronously send a DTM0 message to a remote DTM0 service.

Parameters
svclocal DTM0 service.
opBE op to wait for completion. Could be NULL.
reqDTM0 message to be sent.
tgtFID of the remote DTM0 service.
parent_fomFOM that caused this DTM0 message (used by ADDB).
wait_for_ackDetermines whether the local service should wait for a reply from the counterpart. NOTE: it has nothing to do with blocking API. It just lets the FOM to revolve one more time. TODO: This flag will likely be removed after testing with HA. TODO: Add a co_op or clink to support blocking mode.
Returns
An error is returned if there is not enough resources (-ENOMEM) or if the remote service does not exist in the conf cache (-ENOENT).

Definition at line 536 of file drlink.c.

Here is the caller graph for this function:

◆ m0_dtm0_rpc_link_mod_fini()

M0_INTERNAL void m0_dtm0_rpc_link_mod_fini ( void  )

Definition at line 87 of file drlink.c.

Here is the caller graph for this function:

◆ m0_dtm0_rpc_link_mod_init()

M0_INTERNAL int m0_dtm0_rpc_link_mod_init ( void  )

Definition at line 77 of file drlink.c.

Here is the caller graph for this function:

Variable Documentation

◆ drlink_fom_conf

static const struct m0_sm_conf drlink_fom_conf
static
Initial value:
= {
.scf_name = "m0_dtm0_drlink_fom",
.scf_nr_states = ARRAY_SIZE(drlink_fom_states),
.scf_state = drlink_fom_states,
}
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 75 of file drlink.c.

◆ drlink_fom_ops

const struct m0_fom_ops drlink_fom_ops
static
Initial value:
= {
.fo_fini = drlink_fom_fini,
.fo_tick = drlink_fom_tick,
.fo_home_locality = drlink_fom_locality
}

Definition at line 67 of file drlink.c.

◆ drlink_fom_states

struct m0_sm_state_descr drlink_fom_states[]
static

Definition at line 264 of file drlink.c.

◆ drlink_fom_type

struct m0_fom_type drlink_fom_type
static

Definition at line 73 of file drlink.c.

◆ drlink_fom_type_ops

const struct m0_fom_type_ops drlink_fom_type_ops = {}
static

Definition at line 74 of file drlink.c.

◆ dtm0_req_fop_rlink_rpc_item_ops

const struct m0_rpc_item_ops dtm0_req_fop_rlink_rpc_item_ops
Initial value:
= {
}

Definition at line 337 of file drlink.c.