Motr  M0
Device command

Detailed functional Device command. More...

Data Structures

struct  m0_sss_dfom
 
struct  m0_sss_device_fop
 
struct  m0_sss_device_fop_rep
 

Enumerations

enum  sss_device_fom_stage { SSS_DEVICE_FOM_STAGE_STOB, SSS_DEVICE_FOM_STAGE_POOL_MACHINE }
 
enum  m0_sss_device_req_cmd { M0_DEVICE_ATTACH, M0_DEVICE_DETACH, M0_DEVICE_FORMAT, M0_DEVICE_CMDS_NR }
 

Functions

static int sss_device_fom_create (struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
 
static void sss_device_fom_fini (struct m0_fom *fom)
 
static bool sss_dfom_confc_ctx_check_cb (struct m0_clink *clink)
 
static uint32_t sss_dfom_device_cmd (struct m0_sss_dfom *dfom)
 
static void sss_device_fom_switch (struct m0_fom *fom)
 
static int sss_confc_ctx_init (struct m0_sss_dfom *dfom)
 
static int sss_device_fom_conf_obj_open (struct m0_sss_dfom *dfom, struct m0_fid *fid)
 
static int sss_device_fom_disk_opening (struct m0_fom *fom)
 
static bool sss_device_fom_conf_obj_ha_state_cb (struct m0_clink *link)
 
static void sss_device_fom_ha_init (struct m0_sss_dfom *dfom, struct m0_fid *fid)
 
static void sss_device_fom_ha_fini (struct m0_sss_dfom *dfom)
 
static void sss_device_fom_ha_update (struct m0_sss_dfom *dfom)
 
static int sss_device_fom_disk_ha_state_get (struct m0_fom *fom)
 
static int sss_disk_info_use (struct m0_sss_dfom *dfom)
 
static int sss_device_fom_disk_opened (struct m0_fom *fom)
 
static bool _obj_is_sdev (const struct m0_conf_obj *obj)
 
static bool sss_device_find_has_svc (struct m0_fom *fom, struct m0_fid *svc_fid)
 
static int sss_device_fom_sdev_iter (struct m0_fom *fom)
 
static bool sss_device_fom_sdev_iter_cb (struct m0_clink *clink)
 
static int sss_device_fom_root_info_use (struct m0_sss_dfom *dfom, struct m0_conf_obj **root_obj)
 
static int sss_device_fom_sdev_iter_init (struct m0_sss_dfom *dfom, struct m0_conf_obj *root_obj)
 
static int sss_device_fom_fs_opened (struct m0_fom *fom)
 
static int sss_device_fom_sdev_opening (struct m0_fom *fom)
 
static int sss_device_stob_attach (struct m0_fom *fom)
 
static int sss_device_pool_machine_attach (struct m0_fom *fom)
 
static int sss_device_pool_machine_detach (struct m0_fom *fom)
 
static int sss_device_stob_detach (struct m0_fom *fom, bool arm_wakeup)
 
static int sss_device_format (struct m0_fom *fom)
 
static int sss_device_fom_tick (struct m0_fom *fom)
 
static size_t sss_device_fom_home_locality (const struct m0_fom *fom)
 
struct m0_sss_device_fop M0_XCA_DOMAIN (rpc)
 
M0_INTERNAL struct m0_fopm0_sss_device_fop_create (struct m0_rpc_machine *mach, uint32_t cmd, const struct m0_fid *fid)
 
M0_INTERNAL bool m0_sss_fop_is_dev_req (const struct m0_fop *fop)
 
M0_INTERNAL struct m0_sss_device_fopm0_sss_fop_to_dev_req (struct m0_fop *fop)
 
M0_INTERNAL bool m0_sss_fop_is_dev_rep (const struct m0_fop *fop)
 
M0_INTERNAL struct m0_sss_device_fop_repm0_sss_fop_to_dev_rep (struct m0_fop *fop)
 
M0_INTERNAL int m0_sss_device_fops_init (void)
 
M0_INTERNAL void m0_sss_device_fops_fini (void)
 

Variables

static struct m0_fom_ops sss_device_fom_ops
 
const struct m0_fom_type_ops sss_device_fom_type_ops
 
struct m0_sm_state_descr sss_device_fom_phases_desc []
 
const struct m0_sm_conf sss_device_fom_conf
 
struct m0_fop_type m0_sss_fop_device_fopt
 
struct m0_fop_type m0_sss_fop_device_rep_fopt
 

Detailed Description

Detailed functional Device command.

All Device commands use one type of fop m0_sss_device_fop for send command to sss service and one type of fop m0_sss_device_fop_rep for reply. Command different command ID m0_sss_device_req_cmd only.

Device command FOM

Functional Specification

Device commands provides control of individual devices like attach, detach and format using directly creation/deletion stob and stob domain and pool events.

Generic TX fom phases start TX transaction. Its interfere to create and finalize AD stob domain. Work with AD stob domain made a separate stage. For work with AD stob domain need to get additional data. Read them from confc subsystem move to first stage too. Both stages can to diagnose error and can go to Failure phase. Fom phase SSS_DFOM_SWITCH switch to next dependence Device command ID and current stage.

First stage - before TX generic fom phases:

Second stage - after TX generic fom phases:

Data Structures

Device attach command

Create AD stob domain and main stob for device and start pool event with change device status on online.

State transition diagram for Device attach command

             Standard fom generic phases
    inits, authenticate, resources, authorization
                 |
                 v
    +<---------SSS_DFOM_DISK_OPENING---+
    |                           wait for opening m0_conf_drive
    |                    v--------------+
    +<-----SSS_DFOM_DISK_HA_STATE_GET--+
    |                          wait for HA state nvec reply
    |                    v--------------+
    |        SSS_DFOM_DISK_OPENED------+
    |                          accept HA state nvec,
    |                           read m0_conf_drive,
    |                           wait for opening m0_conf_root
    |                   v--------------+
    |         SSS_DFOM_FS_OPENED,
    |                   read m0_conf_root, start iterator m0_conf_sdev
    |                   v--------------+
    |         SSS_DFOM_SDEV_ITER,
    |                   search m0_conf_sdev,
    |                   check "sdev belong IO service of this node"
    |                   v--------------+
    +<--------SSS_DFOM_SWITCH
    |                   |
    |                   v
    +<-------- SSS_DFOM_SDEV_OPENING,
    |                   |
    |                   v
    +<--------SSS_DFOM_ATTACH_STOB
    |                    |
    |                    v
    +<--Standard fom generic phases TX context
    |                    |
    |                    v
    +<--------SSS_DFOM_SWITCH
    |                    |
    |                    v
    +<----SSS_DFOM_ATTACH_POOL_MACHINE
    |                    |
    |                    v
FOPH_FAILED        FOPH_SUCCESS
    +------------------>|
                 v
           Standard fom generic phases
              send reply and finish

Device detach command

Finalization AD stob domain and main stob for device and start pool event with change device status on offline. Note! Finalization of stob domain is not equal to its destruction. Finalization does not delete stob's meta-data in BE.

State transition diagram for Device detach command

             Standard fom generic phases
    inits, authenticate, resources, authorization
                 |
                 v
    +<---------SSS_DFOM_DISK_OPENING---+
    |                           wait for opening m0_conf_drive
    |                    v--------------+
    |      SSS_DFOM_DISK_HA_STATE_GET--+
    |                          just go next doing no query
    |                    v--------------+
    |        SSS_DFOM_DISK_OPENED------+
    |                   read m0_conf_drive, wait for opening m0_conf_root
    |                   v--------------+
    |         SSS_DFOM_FS_OPENED,
    |                   read m0_conf_root, start iterator m0_conf_sdev
    |                   v--------------+
    |         SSS_DFOM_SDEV_ITER,
    |                   search m0_conf_sdev,
    |                   check "sdev belong IO service of this node"
    |                   v--------------+
    +<--------SSS_DFOM_SWITCH
    |                    |
    |                    v
    +<--------SSS_DFOM_DETACH_STOB
    |                    |
    |                    v
    +<--Standard fom generic phases TX context
    |                    |
    |                    v
    +<--------SSS_DFOM_SWITCH
    |                    |
    |                    v
    +<----SSS_DFOM_DETACH_POOL_MACHINE
    |                    |
    |                    v
FOPH_FAILED        FOPH_SUCCESS
    +------------------>|
                 v
           Standard fom generic phases
              send reply and finish

Device format command

Format HW device

State transition diagram for Device format command

             Standard fom generic phases
    inits, authenticate, resources, authorization
                 |
                 v
    +<---------SSS_DFOM_DISK_OPENING---+
    |                           wait for opening m0_conf_drive
    |                    v--------------+
    |      SSS_DFOM_DISK_HA_STATE_GET--+
    |                          just go next doing no query
    |                    v--------------+
    |        SSS_DFOM_DISK_OPENED------+
    |                   read m0_conf_drive, wait for opening m0_conf_root
    |                   v--------------+
    |         SSS_DFOM_FS_OPENED,
    |                   read m0_conf_root, start iterator m0_conf_sdev
    |                   v--------------+
    |         SSS_DFOM_SDEV_ITER,
    |                   search m0_conf_sdev,
    |                   check "sdev belong IO service of this node"
    |                   v--------------+
    +<--------SSS_DFOM_SWITCH
    |                    |
    |                    v
    +<--Standard fom generic phases TX context
    |                    |
    |                    v
    +<-----------SSS_DFOM_SWITCH
    |                    |
    |                    v
    +<-----------SSS_DFOM_FORMAT
    |                    |
    |                    v
FOPH_FAILED        FOPH_SUCCESS
    +------------------>|
                 v
           Standard fom generic phases
              send reply and finish

Enumeration Type Documentation

◆ m0_sss_device_req_cmd

Device commands enumerated

Value of custom fop field ssd_cmd, determines device operation.

Enumerator
M0_DEVICE_ATTACH 

Attach command. Create AD stob domain, stob and change device status to online in Pool machine.

M0_DEVICE_DETACH 

Detach command. Finalization AD stob domain, stob and change device status to offline in Pool machine.

M0_DEVICE_FORMAT 

Format command. Format select device.

M0_DEVICE_CMDS_NR 

Number of device commands.

Definition at line 128 of file device_fops.h.

◆ sss_device_fom_stage

Stages of device fom.

All custom phases of device FOM are separated into two stages.

One part of custom phases is executed outside of FOM local transaction context (before M0_FOPH_TXN_INIT phase), the other part is executed as usual for FOMs in context of local transaction.

Separation is done to prevent dead-lock between two exclusively opened BE transactions: one is in FOM local transaction context and the other one created during adding stob domain in sss_device_stob_attach.

See also
sss_device_fom_phases_desc.
Enumerator
SSS_DEVICE_FOM_STAGE_STOB 

Stage incorporates AD stob domain and stob creation. Phases of this stage are executed before M0_FOPH_TXN_INIT phase.

SSS_DEVICE_FOM_STAGE_POOL_MACHINE 

Stage includes phases which works with pool machine and are executed as usual FOM-specific phases.

Definition at line 75 of file device_foms.c.

Function Documentation

◆ _obj_is_sdev()

static bool _obj_is_sdev ( const struct m0_conf_obj obj)
static

Definition at line 477 of file device_foms.c.

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

◆ m0_sss_device_fop_create()

M0_INTERNAL struct m0_fop* m0_sss_device_fop_create ( struct m0_rpc_machine mach,
uint32_t  cmd,
const struct m0_fid fid 
)

Definition at line 86 of file device_fops.c.

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

◆ m0_sss_device_fops_fini()

M0_INTERNAL void m0_sss_device_fops_fini ( void  )

Definition at line 80 of file device_fops.c.

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

◆ m0_sss_device_fops_init()

M0_INTERNAL int m0_sss_device_fops_init ( void  )

Definition at line 46 of file device_fops.c.

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

◆ m0_sss_fop_is_dev_rep()

M0_INTERNAL bool m0_sss_fop_is_dev_rep ( const struct m0_fop fop)

Definition at line 122 of file device_fops.c.

Here is the caller graph for this function:

◆ m0_sss_fop_is_dev_req()

M0_INTERNAL bool m0_sss_fop_is_dev_req ( const struct m0_fop fop)

Definition at line 108 of file device_fops.c.

Here is the caller graph for this function:

◆ m0_sss_fop_to_dev_rep()

M0_INTERNAL struct m0_sss_device_fop_rep* m0_sss_fop_to_dev_rep ( struct m0_fop fop)

Definition at line 129 of file device_fops.c.

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

◆ m0_sss_fop_to_dev_req()

M0_INTERNAL struct m0_sss_device_fop* m0_sss_fop_to_dev_req ( struct m0_fop fop)

Definition at line 114 of file device_fops.c.

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

◆ M0_XCA_DOMAIN()

struct m0_sss_device_fop M0_XCA_DOMAIN ( rpc  )

◆ sss_confc_ctx_init()

static int sss_confc_ctx_init ( struct m0_sss_dfom dfom)
static

Definition at line 309 of file device_foms.c.

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

◆ sss_device_find_has_svc()

static bool sss_device_find_has_svc ( struct m0_fom fom,
struct m0_fid svc_fid 
)
static

Definition at line 482 of file device_foms.c.

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

◆ sss_device_fom_conf_obj_ha_state_cb()

static bool sss_device_fom_conf_obj_ha_state_cb ( struct m0_clink link)
static

Definition at line 346 of file device_foms.c.

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

◆ sss_device_fom_conf_obj_open()

static int sss_device_fom_conf_obj_open ( struct m0_sss_dfom dfom,
struct m0_fid fid 
)
static

Definition at line 320 of file device_foms.c.

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

◆ sss_device_fom_create()

static int sss_device_fom_create ( struct m0_fop fop,
struct m0_fom **  out,
struct m0_reqh reqh 
)
static

Definition at line 199 of file device_foms.c.

Here is the call graph for this function:

◆ sss_device_fom_disk_ha_state_get()

static int sss_device_fom_disk_ha_state_get ( struct m0_fom fom)
static

Invokes device HA state retrieval using fid from request.

Definition at line 415 of file device_foms.c.

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

◆ sss_device_fom_disk_opened()

static int sss_device_fom_disk_opened ( struct m0_fom fom)
static

Initialises custom Device fom fields using information from m0_conf_drive object.

Definition at line 457 of file device_foms.c.

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

◆ sss_device_fom_disk_opening()

static int sss_device_fom_disk_opening ( struct m0_fom fom)
static

Definition at line 335 of file device_foms.c.

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

◆ sss_device_fom_fini()

static void sss_device_fom_fini ( struct m0_fom fom)
static

Definition at line 232 of file device_foms.c.

Here is the call graph for this function:

◆ sss_device_fom_fs_opened()

static int sss_device_fom_fs_opened ( struct m0_fom fom)
static

Initialize custom Device fom fields using information from obtained disk conf object.

Definition at line 577 of file device_foms.c.

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

◆ sss_device_fom_ha_fini()

static void sss_device_fom_ha_fini ( struct m0_sss_dfom dfom)
static

Definition at line 380 of file device_foms.c.

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

◆ sss_device_fom_ha_init()

static void sss_device_fom_ha_init ( struct m0_sss_dfom dfom,
struct m0_fid fid 
)
static

Definition at line 365 of file device_foms.c.

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

◆ sss_device_fom_ha_update()

static void sss_device_fom_ha_update ( struct m0_sss_dfom dfom)
static

Definition at line 390 of file device_foms.c.

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

◆ sss_device_fom_home_locality()

static size_t sss_device_fom_home_locality ( const struct m0_fom fom)
static

Definition at line 880 of file device_foms.c.

◆ sss_device_fom_root_info_use()

static int sss_device_fom_root_info_use ( struct m0_sss_dfom dfom,
struct m0_conf_obj **  root_obj 
)
static

Definition at line 541 of file device_foms.c.

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

◆ sss_device_fom_sdev_iter()

static int sss_device_fom_sdev_iter ( struct m0_fom fom)
static

Conf iterator for search storage device parent - IO service If storage device found then check "parent (IO service) has in current reqh"

Definition at line 495 of file device_foms.c.

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

◆ sss_device_fom_sdev_iter_cb()

static bool sss_device_fom_sdev_iter_cb ( struct m0_clink clink)
static

Definition at line 533 of file device_foms.c.

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

◆ sss_device_fom_sdev_iter_init()

static int sss_device_fom_sdev_iter_init ( struct m0_sss_dfom dfom,
struct m0_conf_obj root_obj 
)
static

Definition at line 553 of file device_foms.c.

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

◆ sss_device_fom_sdev_opening()

static int sss_device_fom_sdev_opening ( struct m0_fom fom)
static

Definition at line 594 of file device_foms.c.

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

◆ sss_device_fom_switch()

static void sss_device_fom_switch ( struct m0_fom fom)
static

Select next phase depending on device command and current stage. If command is unknown then return -ENOENT and fom state machine will go to M0_FOPH_FAILURE phase.

Definition at line 274 of file device_foms.c.

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

◆ sss_device_fom_tick()

static int sss_device_fom_tick ( struct m0_fom fom)
static

Device command fom tick

Besides derive custom phases, check M0_FOPH_TXN_INIT and M0_FOPH_TXN_OPEN phase.

If M0_FOPH_TXN_INIT phase expected and current stage is SSS_DEVICE_FOM_STAGE_STOB then switch fom to first custom phase.

Definition at line 752 of file device_foms.c.

Here is the call graph for this function:

◆ sss_device_format()

static int sss_device_format ( struct m0_fom fom)
static

Definition at line 716 of file device_foms.c.

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

◆ sss_device_pool_machine_attach()

static int sss_device_pool_machine_attach ( struct m0_fom fom)
static

Definition at line 656 of file device_foms.c.

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

◆ sss_device_pool_machine_detach()

static int sss_device_pool_machine_detach ( struct m0_fom fom)
static

Definition at line 667 of file device_foms.c.

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

◆ sss_device_stob_attach()

static int sss_device_stob_attach ( struct m0_fom fom)
static

Definition at line 603 of file device_foms.c.

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

◆ sss_device_stob_detach()

static int sss_device_stob_detach ( struct m0_fom fom,
bool  arm_wakeup 
)
static

Definition at line 682 of file device_foms.c.

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

◆ sss_dfom_confc_ctx_check_cb()

static bool sss_dfom_confc_ctx_check_cb ( struct m0_clink clink)
static

Confc callback. Is used when m0_confc_open or m0_confc_open_by_fid finished asyn for wakeup this FOM and finialize Conc query

Definition at line 250 of file device_foms.c.

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

◆ sss_dfom_device_cmd()

static uint32_t sss_dfom_device_cmd ( struct m0_sss_dfom dfom)
inlinestatic

Definition at line 264 of file device_foms.c.

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

◆ sss_disk_info_use()

static int sss_disk_info_use ( struct m0_sss_dfom dfom)
static

Definition at line 431 of file device_foms.c.

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

Variable Documentation

◆ m0_sss_fop_device_fopt

struct m0_fop_type m0_sss_fop_device_fopt

Definition at line 39 of file device_fops.c.

◆ m0_sss_fop_device_rep_fopt

struct m0_fop_type m0_sss_fop_device_rep_fopt

Definition at line 40 of file device_fops.c.

◆ sss_device_fom_conf

const struct m0_sm_conf sss_device_fom_conf
Initial value:
= {
.scf_name = "sss-device-fom-sm",
}
struct m0_sm_state_descr sss_device_fom_phases_desc[]
Definition: device_foms.c:129
#define ARRAY_SIZE(a)
Definition: misc.h:45

Definition at line 193 of file device_foms.c.

◆ sss_device_fom_ops

struct m0_fom_ops sss_device_fom_ops
static
Initial value:
= {
.fo_tick = sss_device_fom_tick,
.fo_home_locality = sss_device_fom_home_locality,
}
static void sss_device_fom_fini(struct m0_fom *fom)
Definition: device_foms.c:232
static int sss_device_fom_tick(struct m0_fom *fom)
Definition: device_foms.c:752
static size_t sss_device_fom_home_locality(const struct m0_fom *fom)
Definition: device_foms.c:880

Definition at line 119 of file device_foms.c.

◆ sss_device_fom_phases_desc

struct m0_sm_state_descr sss_device_fom_phases_desc[]

Definition at line 129 of file device_foms.c.

◆ sss_device_fom_type_ops

const struct m0_fom_type_ops sss_device_fom_type_ops
Initial value:
= {
.fto_create = sss_device_fom_create
}
static int sss_device_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: device_foms.c:199

Definition at line 125 of file device_foms.c.