#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"
Go to the source code of this file.
|
| 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) |
|
◆ M0_TRACE_SUBSYSTEM
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
◆ application_data_copy()
Copies data for the block between applicaiton-provided and iomap buffers. This is heavily based on m0t1fs/linux_kernel/file.cuser_data_copy
- Parameters
-
map | The parity group map in question. |
obj | The object this data corresponds to. |
start | The offset to start copying. |
end | The offset to stop copying. |
datacur | Where in the application-provided buffers we should operate. |
dir | CD_COPY_FROM_APP or CD_COPY_TO_APP |
filter | Flags 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.
◆ data_buf_copy()
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
-
data | The client memory buffer in the pg map. |
app_datacur | The application data buffers. |
dir | CD_COPY_TO_APP or CD_COPY_FROM_APP. |
- Returns
- the number of bytes copied.
Definition at line 955 of file io_req.c.
◆ 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.
◆ ioreq_application_data_copy()
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
-
ioo | The io operation whose data should be copied. |
dir | CD_COPY_FROM_APP or CD_COPY_TO_APP |
filter | Flags that must be set when copying from the application. |
- Returns
- 0 for success, -errno otherwise.
Definition at line 1258 of file io_req.c.
◆ 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
-
ioo | The io operation in question. |
rmw | The flag for Read-Modify-Write (RMW). |
- Returns
- 0 for success, -errno otherwise.
Definition at line 1561 of file io_req.c.
◆ 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
-
ioo | The io operation in question. |
- Returns
- 0 for success, -errno otherwise.
Definition at line 1371 of file io_req.c.
◆ 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
-
ioo | The io operation in question. |
rmw | The flag for Read-Modify-Write (RMW). |
- Returns
- 0 for success, -errno otherwise.
Definition at line 1721 of file io_req.c.
◆ 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
-
ioo | The IO operation whose map should be destroyed. |
Definition at line 760 of file io_req.c.
◆ 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.
◆ 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
-
ioo | The IO operation whose pgmap should be built. |
- Returns
- 0 for success, -errno otherwise.
Definition at line 863 of file io_req.c.
◆ 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
-
ioo | The object io operation needed to be reset. |
Definition at line 287 of file io_req.c.
◆ ioreq_iosm_handle_executed()
AST callback scheduled once all the RPC replies have been received. This is heavily based on m0t1fs/linux_kernel/file.cioreq_iosm_handle
- Parameters
-
grp | The statemachine group the ast was posted to. |
ast | The ast struct, used to find the m0_op_io. |
Definition at line 451 of file io_req.c.
◆ ioreq_iosm_handle_launch()
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
-
grp | The statemachine group the ast was posted to. |
ast | The ast struct, used to find the m0_op_io. |
Definition at line 316 of file io_req.c.
◆ 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
-
ioo | The io operation in question. |
- Returns
- 0 for success, -errno otherwise.
Definition at line 1339 of file io_req.c.
◆ ioreq_parity_verify()
static int ioreq_parity_verify |
( |
struct m0_op_io * |
ioo | ) |
|
|
static |
◆ ioreq_sm_executed_post()
static void ioreq_sm_executed_post |
( |
struct m0_op_io * |
ioo | ) |
|
|
static |
◆ ioreq_sm_failed_locked()
M0_INTERNAL void ioreq_sm_failed_locked |
( |
struct m0_op_io * |
ioo, |
|
|
int |
rc |
|
) |
| |
◆ ioreq_sm_state_set_locked()
M0_INTERNAL void ioreq_sm_state_set_locked |
( |
struct m0_op_io * |
ioo, |
|
|
int |
state |
|
) |
| |
◆ 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.
◆ 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.
◆ is_session_marked()
- 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.
◆ M0_BOB_DEFINE()
M0_BOB_DEFINE |
( |
M0_INTERNAL |
, |
|
|
& |
ioo_bobtype, |
|
|
m0_op_io |
|
|
) |
| |
◆ nw_xfer_device_state_reset()
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
-
xfer | The network transfer for the completed request. |
Definition at line 265 of file io_req.c.
◆ set_paritybuf_type()
static void set_paritybuf_type |
( |
struct m0_op_io * |
ioo | ) |
|
|
static |
◆ truncate_dispatch()
static int truncate_dispatch |
( |
struct m0_op_io * |
ioo | ) |
|
|
static |
◆ verify_checksum()
static bool verify_checksum |
( |
struct m0_op_io * |
ioo | ) |
|
|
static |
◆ cpus_sem
CPUs semaphore - to control CPUs usage by parity calcs.
Definition at line 45 of file io_req.c.
◆ io_states
All possible state machine transitions for an IO requests
Definition at line 48 of file io_req.c.
◆ ioo_bobtype
Initial value:= {
.bt_name = "m0_op_io_bobtype",
}
#define offsetof(typ, memb)
BOB definitions for m0_op_io
Definition at line 150 of file io_req.c.
◆ ioo_ops
Initial value:= {
}
static void ioreq_iosm_handle_executed(struct m0_sm_group *grp, struct m0_sm_ast *ast)
static int ioreq_parity_recalc(struct m0_op_io *ioo)
static void ioreq_iosm_handle_launch(struct m0_sm_group *grp, struct m0_sm_ast *ast)
static int ioreq_dgmode_recover(struct m0_op_io *ioo)
static int ioreq_dgmode_write(struct m0_op_io *ioo, bool rmw)
static void ioreq_iomaps_destroy(struct m0_op_io *ioo)
static int ioreq_dgmode_read(struct m0_op_io *ioo, bool rmw)
static int ioreq_iomaps_prepare(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_verify(struct m0_op_io *ioo)
Definition at line 1860 of file io_req.c.
◆ ioo_trans