Motr  M0
io_req.c File Reference
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/addb.h"
#include "motr/pg.h"
#include "motr/io.h"
#include "lib/errno.h"
#include "lib/semaphore.h"
#include "fid/fid.h"
#include "rpc/rpclib.h"
#include "lib/ext.h"
#include "lib/misc.h"
#include "lib/cksum.h"
#include "lib/trace.h"
Include dependency graph for io_req.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 

Functions

 M0_BOB_DEFINE (M0_INTERNAL, &ioo_bobtype, m0_op_io)
 
static bool is_pver_dud (uint32_t fdev_nr, uint32_t dev_k, uint32_t fsvc_nr, uint32_t svc_k, uint32_t fnode_nr, uint32_t node_k)
 
M0_INTERNAL void ioreq_sm_state_set_locked (struct m0_op_io *ioo, int state)
 
M0_INTERNAL void ioreq_sm_failed_locked (struct m0_op_io *ioo, int rc)
 
static void ioreq_sm_executed_post (struct m0_op_io *ioo)
 
static int truncate_dispatch (struct m0_op_io *ioo)
 
static void nw_xfer_device_state_reset (struct nw_xfer_request *xfer)
 
static void ioreq_ioo_reset (struct m0_op_io *ioo)
 
static void ioreq_iosm_handle_launch (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void ioreq_iosm_handle_executed (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void ioreq_iomaps_destroy (struct m0_op_io *ioo)
 
static int ioreq_iomaps_parity_groups_cal (struct m0_op_io *ioo)
 
static void set_paritybuf_type (struct m0_op_io *ioo)
 
static int ioreq_iomaps_prepare (struct m0_op_io *ioo)
 
static uint64_t data_buf_copy (struct data_buf *data, struct m0_bufvec_cursor *app_datacur, enum copy_direction dir)
 
static int application_data_copy (struct pargrp_iomap *map, struct m0_obj *obj, m0_bindex_t start, m0_bindex_t end, struct m0_bufvec_cursor *datacur, enum copy_direction dir, enum page_attr filter)
 
static bool verify_checksum (struct m0_op_io *ioo)
 
static int ioreq_application_data_copy (struct m0_op_io *ioo, enum copy_direction dir, enum page_attr filter)
 
static int ioreq_parity_recalc (struct m0_op_io *ioo)
 
static int ioreq_dgmode_recover (struct m0_op_io *ioo)
 
static bool is_session_marked (struct m0_op_io *ioo, struct m0_rpc_session *session)
 
static bool is_node_marked (struct m0_op_io *ioo, uint64_t node_id)
 
static int device_check (struct m0_op_io *ioo)
 
static int ioreq_dgmode_read (struct m0_op_io *ioo, bool rmw)
 
static int ioreq_dgmode_write (struct m0_op_io *ioo, bool rmw)
 
static int ioreq_parity_verify (struct m0_op_io *ioo)
 

Variables

struct m0_semaphore cpus_sem
 
static struct m0_sm_state_descr io_states []
 
static struct m0_sm_trans_descr ioo_trans []
 
struct m0_sm_conf io_sm_conf
 
const struct m0_bob_type ioo_bobtype
 
const struct m0_op_io_ops ioo_ops
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 37 of file io_req.c.

Function Documentation

◆ application_data_copy()

static int application_data_copy ( struct pargrp_iomap map,
struct m0_obj obj,
m0_bindex_t  start,
m0_bindex_t  end,
struct m0_bufvec_cursor datacur,
enum copy_direction  dir,
enum page_attr  filter 
)
static

Copies data for the block between applicaiton-provided and iomap buffers. This is heavily based on m0t1fs/linux_kernel/file.cuser_data_copy

Parameters
mapThe parity group map in question.
objThe object this data corresponds to.
startThe offset to start copying.
endThe offset to stop copying.
datacurWhere in the application-provided buffers we should operate.
dirCD_COPY_FROM_APP or CD_COPY_TO_APP
filterFlags that must be set when copying from the application.
Todo:
reduce the number of arguments to this function, map+obj are in ioo

If majority with replica be selected or not.

Definition at line 1017 of file io_req.c.

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

◆ data_buf_copy()

static uint64_t data_buf_copy ( struct data_buf data,
struct m0_bufvec_cursor app_datacur,
enum copy_direction  dir 
)
static

Copies at most one data buf to/from application memory.

datacur is a cursor for the application buffers. dir == CD_COPY_FROM_APP: app_datacur -> data dir == CD_COPY_TO_APP: app_datacur <- data

Parameters
dataThe client memory buffer in the pg map.
app_datacurThe application data buffers.
dirCD_COPY_TO_APP or CD_COPY_FROM_APP.
Returns
the number of bytes copied.

Definition at line 955 of file io_req.c.

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

◆ device_check()

static int device_check ( struct m0_op_io ioo)
static

Returns number of failed devices or -EIO if number of failed devices exceeds the value of K (number of spare devices in parity group). Once MOTR-899 lands into dev the code for this function will change. In that case it will only check if a given pool is dud.

This is heavily based on m0t1fs/linux_kernel/file.cdevice_check

Definition at line 1455 of file io_req.c.

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

◆ ioreq_application_data_copy()

static int ioreq_application_data_copy ( struct m0_op_io ioo,
enum copy_direction  dir,
enum page_attr  filter 
)
static

Copies the file-data between the iomap buffers and the application-provided buffers, one row at a time. This is heavily based on m0t1fs/linux_kernel/file.cioreq_user_data_copy

Parameters
iooThe io operation whose data should be copied.
dirCD_COPY_FROM_APP or CD_COPY_TO_APP
filterFlags that must be set when copying from the application.
Returns
0 for success, -errno otherwise.

Definition at line 1258 of file io_req.c.

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

◆ ioreq_dgmode_read()

static int ioreq_dgmode_read ( struct m0_op_io ioo,
bool  rmw 
)
static

Degraded mode read for a Client IO operation. This is heavily based on m0t1fs/linux_kernel/file.cioreq_dgmode_read

Parameters
iooThe io operation in question.
rmwThe flag for Read-Modify-Write (RMW).
Returns
0 for success, -errno otherwise.

Definition at line 1561 of file io_req.c.

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

◆ ioreq_dgmode_recover()

static int ioreq_dgmode_recover ( struct m0_op_io ioo)
static

Reconstructs the missing data of parity groups. This is heavily based on m0t1fs/linux_kernel/file.cioreq_dgmode_recover

Parameters
iooThe io operation in question.
Returns
0 for success, -errno otherwise.

Definition at line 1371 of file io_req.c.

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

◆ ioreq_dgmode_write()

static int ioreq_dgmode_write ( struct m0_op_io ioo,
bool  rmw 
)
static

Degraded mode write for a Client IO operation. This is heavily based on m0t1fs/linux_kernel/file.cioreq_dgmode_write

Parameters
iooThe io operation in question.
rmwThe flag for Read-Modify-Write (RMW).
Returns
0 for success, -errno otherwise.

Definition at line 1721 of file io_req.c.

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

◆ ioreq_iomaps_destroy()

static void ioreq_iomaps_destroy ( struct m0_op_io ioo)
static

Destroys the parity group iomap, freeing all the data_bufs etc. This is heavily based on m0t1fs/linux_kernel/file.cioreq_iomaps_destroy

Parameters
iooThe IO operation whose map should be destroyed.

Definition at line 760 of file io_req.c.

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

◆ ioreq_iomaps_parity_groups_cal()

static int ioreq_iomaps_parity_groups_cal ( struct m0_op_io ioo)
static

Calculate the exact number of parity groups spanned by the IO operation, put result at ioo->ioo_iomap_nr.

Definition at line 785 of file io_req.c.

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

◆ ioreq_iomaps_prepare()

static int ioreq_iomaps_prepare ( struct m0_op_io ioo)
static

Builds the iomaps parity group for all the groups covered this IO request. This is heavily based on m0t1fs/linux_kernel/file.cioreq_iomaps_prepare

Parameters
iooThe IO operation whose pgmap should be built.
Returns
0 for success, -errno otherwise.

Definition at line 863 of file io_req.c.

Here is the call graph for this function:

◆ ioreq_ioo_reset()

static void ioreq_ioo_reset ( struct m0_op_io ioo)
static

Resets ioo and target io requests when they are re-used to avoid those polluted fields flowing into next step of IO.

Parameters
iooThe object io operation needed to be reset.

Definition at line 287 of file io_req.c.

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

◆ ioreq_iosm_handle_executed()

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

AST callback scheduled once all the RPC replies have been received. This is heavily based on m0t1fs/linux_kernel/file.cioreq_iosm_handle

Parameters
grpThe statemachine group the ast was posted to.
astThe ast struct, used to find the m0_op_io.

Definition at line 451 of file io_req.c.

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

◆ ioreq_iosm_handle_launch()

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

AST callback scheduled by RM-file-lock acquire, this does the actual work of launching the operation's rpc messages. This is heavily based on m0t1fs/linux_kernel/file.cioreq_iosm_handle

Parameters
grpThe statemachine group the ast was posted to.
astThe ast struct, used to find the m0_op_io.

Definition at line 316 of file io_req.c.

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

◆ ioreq_parity_recalc()

static int ioreq_parity_recalc ( struct m0_op_io ioo)
static

Recalculates the parity for each row of this operations io map. This is heavily based on m0t1fs/linux_kernel/file.c::ioreq_partiy_recalc

Parameters
iooThe io operation in question.
Returns
0 for success, -errno otherwise.

Definition at line 1339 of file io_req.c.

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

◆ ioreq_parity_verify()

static int ioreq_parity_verify ( struct m0_op_io ioo)
static

Definition at line 1817 of file io_req.c.

Here is the call graph for this function:

◆ ioreq_sm_executed_post()

static void ioreq_sm_executed_post ( struct m0_op_io ioo)
static

Definition at line 225 of file io_req.c.

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

◆ ioreq_sm_failed_locked()

M0_INTERNAL void ioreq_sm_failed_locked ( struct m0_op_io ioo,
int  rc 
)

This is heavily based on m0t1fs/linux_kernel/file.cioreq_sm_failed

Definition at line 212 of file io_req.c.

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

◆ ioreq_sm_state_set_locked()

M0_INTERNAL void ioreq_sm_state_set_locked ( struct m0_op_io ioo,
int  state 
)

This is heavily based on m0t1fs/linux_kernel/file.cioreq_sm_state_set

Definition at line 193 of file io_req.c.

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

◆ is_node_marked()

static bool is_node_marked ( struct m0_op_io ioo,
uint64_t  node_id 
)
static

Returns true if a given node is already marked as failed. In case a node is not already marked as failed, the functions marks it and returns false.

Definition at line 1429 of file io_req.c.

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

◆ is_pver_dud()

static bool is_pver_dud ( uint32_t  fdev_nr,
uint32_t  dev_k,
uint32_t  fsvc_nr,
uint32_t  svc_k,
uint32_t  fnode_nr,
uint32_t  node_k 
)
static

This is heavily based on m0t1fs/linux_kernel/file.cis_pver_dud.

If there are F(l) failures at level l, and K(l) failures are tolerable for the level l, then the condition for pool-version to be non-dud is: {F(l) / K(l)} <= 1 Once MOTR-899 lands into dev, this function will go away.

Definition at line 168 of file io_req.c.

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

◆ is_session_marked()

static bool is_session_marked ( struct m0_op_io ioo,
struct m0_rpc_session session 
)
static
Todo:
This code is not required once MOTR-899 lands into dev. Returns true if a given session is already marked as failed. In case a session is not already marked for failure, the functions marks it and returns false.

Definition at line 1404 of file io_req.c.

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

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( M0_INTERNAL  ,
ioo_bobtype,
m0_op_io   
)

◆ nw_xfer_device_state_reset()

static void nw_xfer_device_state_reset ( struct nw_xfer_request xfer)
static

Sets the states of all devices (to ONLINE) once all the replies have come back. This is heavily based on m0t1fs/linux_kernel/file.cdevice_state_reset

Parameters
xferThe network transfer for the completed request.

Definition at line 265 of file io_req.c.

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

◆ set_paritybuf_type()

static void set_paritybuf_type ( struct m0_op_io ioo)
static

Definition at line 840 of file io_req.c.

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

◆ truncate_dispatch()

static int truncate_dispatch ( struct m0_op_io ioo)
static

Definition at line 239 of file io_req.c.

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

◆ verify_checksum()

static bool verify_checksum ( struct m0_op_io ioo)
static

Definition at line 1145 of file io_req.c.

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

Variable Documentation

◆ cpus_sem

struct m0_semaphore cpus_sem

CPUs semaphore - to control CPUs usage by parity calcs.

Definition at line 45 of file io_req.c.

◆ io_states

struct m0_sm_state_descr io_states[]
static

All possible state machine transitions for an IO requests

Definition at line 48 of file io_req.c.

◆ ioo_bobtype

const struct m0_bob_type ioo_bobtype
Initial value:
= {
.bt_name = "m0_op_io_bobtype",
.bt_magix_offset = offsetof(struct m0_op_io, ioo_magic),
.bt_magix = M0_IOREQ_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

BOB definitions for m0_op_io

Definition at line 150 of file io_req.c.

◆ ioo_ops

const struct m0_op_io_ops ioo_ops
Initial value:
= {
.iro_iomaps_prepare = ioreq_iomaps_prepare,
.iro_iomaps_destroy = ioreq_iomaps_destroy,
.iro_application_data_copy = ioreq_application_data_copy,
.iro_parity_recalc = ioreq_parity_recalc,
.iro_parity_verify = ioreq_parity_verify,
.iro_iosm_handle_launch = ioreq_iosm_handle_launch,
.iro_iosm_handle_executed = ioreq_iosm_handle_executed,
.iro_dgmode_read = ioreq_dgmode_read,
.iro_dgmode_write = ioreq_dgmode_write,
.iro_dgmode_recover = ioreq_dgmode_recover,
}
static void ioreq_iosm_handle_executed(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: io_req.c:451
static int ioreq_parity_recalc(struct m0_op_io *ioo)
Definition: io_req.c:1339
static void ioreq_iosm_handle_launch(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: io_req.c:316
static int ioreq_dgmode_recover(struct m0_op_io *ioo)
Definition: io_req.c:1371
static int ioreq_dgmode_write(struct m0_op_io *ioo, bool rmw)
Definition: io_req.c:1721
static void ioreq_iomaps_destroy(struct m0_op_io *ioo)
Definition: io_req.c:760
static int ioreq_dgmode_read(struct m0_op_io *ioo, bool rmw)
Definition: io_req.c:1561
static int ioreq_iomaps_prepare(struct m0_op_io *ioo)
Definition: io_req.c:863
static int ioreq_application_data_copy(struct m0_op_io *ioo, enum copy_direction dir, enum page_attr filter)
Definition: io_req.c:1258
static int ioreq_parity_verify(struct m0_op_io *ioo)
Definition: io_req.c:1817

Definition at line 1860 of file io_req.c.

◆ ioo_trans

struct m0_sm_trans_descr ioo_trans[]
static

Definition at line 104 of file io_req.c.