Detailed functional Device command.
More...
|
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_fop * | m0_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_fop * | m0_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_rep * | m0_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) |
|
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:
- initiate fom - check device by disk fid, read additional data: cid, storage device fid from confc
- work with AD stob domain and stob
Second stage - after TX generic fom phases:
- work with Pool machine and Pool events
Data Structures
- m0_sss_device_fom Represents fom with additional fields describing device such as index in pool machine table, cid, storage device fid and current stage of command.
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
◆ 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.
◆ _obj_is_sdev()
static bool _obj_is_sdev |
( |
const struct m0_conf_obj * |
obj | ) |
|
|
static |
◆ m0_sss_device_fop_create()
◆ m0_sss_device_fops_fini()
M0_INTERNAL void m0_sss_device_fops_fini |
( |
void |
| ) |
|
◆ m0_sss_device_fops_init()
M0_INTERNAL int m0_sss_device_fops_init |
( |
void |
| ) |
|
◆ m0_sss_fop_is_dev_rep()
M0_INTERNAL bool m0_sss_fop_is_dev_rep |
( |
const struct m0_fop * |
fop | ) |
|
◆ m0_sss_fop_is_dev_req()
M0_INTERNAL bool m0_sss_fop_is_dev_req |
( |
const struct m0_fop * |
fop | ) |
|
◆ m0_sss_fop_to_dev_rep()
◆ m0_sss_fop_to_dev_req()
◆ M0_XCA_DOMAIN()
◆ sss_confc_ctx_init()
static int sss_confc_ctx_init |
( |
struct m0_sss_dfom * |
dfom | ) |
|
|
static |
◆ sss_device_find_has_svc()
static bool sss_device_find_has_svc |
( |
struct m0_fom * |
fom, |
|
|
struct m0_fid * |
svc_fid |
|
) |
| |
|
static |
◆ sss_device_fom_conf_obj_ha_state_cb()
static bool sss_device_fom_conf_obj_ha_state_cb |
( |
struct m0_clink * |
link | ) |
|
|
static |
◆ sss_device_fom_conf_obj_open()
static int sss_device_fom_conf_obj_open |
( |
struct m0_sss_dfom * |
dfom, |
|
|
struct m0_fid * |
fid |
|
) |
| |
|
static |
◆ sss_device_fom_create()
static int sss_device_fom_create |
( |
struct m0_fop * |
fop, |
|
|
struct m0_fom ** |
out, |
|
|
struct m0_reqh * |
reqh |
|
) |
| |
|
static |
◆ 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.
◆ sss_device_fom_disk_opened()
static int sss_device_fom_disk_opened |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_fom_disk_opening()
static int sss_device_fom_disk_opening |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_fom_fini()
static void sss_device_fom_fini |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ 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.
◆ sss_device_fom_ha_fini()
static void sss_device_fom_ha_fini |
( |
struct m0_sss_dfom * |
dfom | ) |
|
|
static |
◆ sss_device_fom_ha_init()
static void sss_device_fom_ha_init |
( |
struct m0_sss_dfom * |
dfom, |
|
|
struct m0_fid * |
fid |
|
) |
| |
|
static |
◆ sss_device_fom_ha_update()
static void sss_device_fom_ha_update |
( |
struct m0_sss_dfom * |
dfom | ) |
|
|
static |
◆ sss_device_fom_home_locality()
static size_t sss_device_fom_home_locality |
( |
const struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_fom_root_info_use()
◆ 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.
◆ sss_device_fom_sdev_iter_cb()
static bool sss_device_fom_sdev_iter_cb |
( |
struct m0_clink * |
clink | ) |
|
|
static |
◆ sss_device_fom_sdev_iter_init()
◆ sss_device_fom_sdev_opening()
static int sss_device_fom_sdev_opening |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ 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.
◆ 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.
◆ sss_device_format()
static int sss_device_format |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_pool_machine_attach()
static int sss_device_pool_machine_attach |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_pool_machine_detach()
static int sss_device_pool_machine_detach |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_stob_attach()
static int sss_device_stob_attach |
( |
struct m0_fom * |
fom | ) |
|
|
static |
◆ sss_device_stob_detach()
static int sss_device_stob_detach |
( |
struct m0_fom * |
fom, |
|
|
bool |
arm_wakeup |
|
) |
| |
|
static |
◆ 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.
◆ sss_dfom_device_cmd()
static uint32_t sss_dfom_device_cmd |
( |
struct m0_sss_dfom * |
dfom | ) |
|
|
inlinestatic |
◆ sss_disk_info_use()
static int sss_disk_info_use |
( |
struct m0_sss_dfom * |
dfom | ) |
|
|
static |
◆ m0_sss_fop_device_fopt
◆ m0_sss_fop_device_rep_fopt
◆ sss_device_fom_conf
Initial value:= {
.scf_name = "sss-device-fom-sm",
}
struct m0_sm_state_descr sss_device_fom_phases_desc[]
Definition at line 193 of file device_foms.c.
◆ sss_device_fom_ops
Initial value:= {
}
static void sss_device_fom_fini(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)
Definition at line 119 of file device_foms.c.
◆ sss_device_fom_phases_desc
◆ sss_device_fom_type_ops
Initial value:= {
}
static int sss_device_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition at line 125 of file device_foms.c.