37 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT 51 .sd_name =
"IO_initial",
56 .sd_name =
"IO_reading",
60 .sd_name =
"IO_read_complete",
66 .sd_name =
"IO_degraded_read",
70 .sd_name =
"IO_degraded_write",
74 .sd_name =
"IO_truncate",
78 .sd_name =
"IO_truncate_complte",
82 .sd_name =
"IO_writing",
86 .sd_name =
"IO_write_complete",
94 .sd_name =
"IO_req_failed",
100 .sd_name =
"IO_req_complete",
142 .
scf_name =
"IO request state machine configuration",
168 static bool is_pver_dud(uint32_t fdev_nr, uint32_t dev_k, uint32_t fsvc_nr,
169 uint32_t svc_k, uint32_t fnode_nr, uint32_t node_k)
171 if (fdev_nr > 0 && dev_k == 0)
173 if (fsvc_nr > 0 && svc_k == 0)
175 if (fnode_nr > 0 && node_k == 0)
179 if (node_k + fnode_nr > 0)
180 return M0_RC((fnode_nr * dev_k * svc_k +
181 node_k * (fdev_nr * svc_k + fsvc_nr * dev_k)) >
182 node_k * dev_k * svc_k);
183 else if (svc_k + fsvc_nr > 0)
184 return M0_RC((fdev_nr * svc_k + fsvc_nr * dev_k) >
187 return M0_RC(fdev_nr > dev_k);
352 "failed: rc=%d",
rc);
360 "failed: rc=%d",
rc);
391 if (read_pages > 0) {
398 "nxo_dispatch() failed: rc=%d",
rc);
504 "iro_dgmode_read() returns error: %d",
522 "parity verification failed: rc=%d",
rc);
527 instance->m0c_config->mc_is_read_verify) &&
536 "failed (to APP): rc=%d",
rc);
586 "on FULLPAGE failed: rc=%d",
rc);
599 "failed: rc=%d",
rc);
622 if (ioo->
ioo_rc == -ENOENT)
624 else if (ioo->
ioo_rc != 0) {
640 "failed: rc=%d",
rc);
688 #ifdef CLIENT_FOR_M0T1FS 730 #if 1 || BACKPORT_UPSTREAM_FIX 792 uint64_t grparray_sz;
804 if (grparray ==
NULL)
805 return M0_ERR_INFO(-ENOMEM,
"Failed to allocate memory" 815 for (
grp = grpstart;
grp <= grpend; ++
grp) {
824 if (grparray[
i] ==
grp)
889 " [N,K,us]=[%d,%d,%" PRIu64 "]",
928 bufvec ? &buf_cursor :
NULL);
960 uint32_t app_data_len;
971 bytes =
data->db_buf.b_nob;
977 app_data_len = (app_data_len < bytes)?app_data_len:bytes;
979 if (app_data ==
NULL)
983 if (app_data !=
data->db_buf.b_addr) {
985 memcpy((
char*)
data->db_buf.b_addr +
986 copied, app_data, app_data_len);
989 (
char*)
data->db_buf.b_addr +
990 copied, app_data_len);
993 bytes -= app_data_len;
994 copied += app_data_len;
1049 (end - 1) >>
obj->ob_attr.oa_bshift);
1059 data =
map->pi_databufs[row][col];
1061 key_val = &
map->pi_databufs[row][col]->db_maj_ele;
1065 data =
map->pi_databufs[row][m_col];
1068 data =
map->pi_paritybufs[row][m_col - 1];
1090 if (
data->db_auxbuf.b_addr !=
NULL &&
1094 datacur, end -
start);
1102 " bytes copied from application " 1104 map->pi_ioo->ioo_copied_nr += bytes;
1118 if (bytes != end -
start)
1120 -EFAULT,
"[%p] Failed to" 1121 " copy_from_user: %" PRIu64 " !=" 1128 map->pi_ioo->ioo_copied_nr += end -
start - bytes;
1131 " bytes copied to application from offset " "%"PRIu64,
1134 if (bytes != end -
start)
1171 attr_idx < ioo->ioo_attr.ov_vec.v_nr){
1179 if (bytes <
count) {
1203 if (bytes <
count) {
1273 M0_ENTRY(
"op_io : %p, %s application. filter = 0x%x", ioo,
1299 count = pgend - pgstart;
1308 pgstart, pgend, &appdatacur,
dir,
filter);
1311 rc,
"[%p] Copy failed (pgstart=%" PRIu64 1313 ioo, pgstart, pgend);
1408 uint64_t max_failures;
1409 uint64_t session_id;
1413 for (
i = 0;
i < max_failures; ++
i) {
1418 return M0_RC(
false);
1421 return M0_RC(
false);
1433 uint64_t max_failures;
1436 for (
i = 0;
i < max_failures; ++
i) {
1441 return M0_RC(
false);
1444 return M0_RC(
false);
1458 uint32_t fdev_nr = 0;
1459 uint32_t fsvc_nr = 0;
1460 uint32_t fnode_nr = 0;
1461 uint64_t max_svc_failures;
1462 uint64_t max_node_failures;
1497 node_state = node_obj->pn_state;
1503 if (ti->
ti_rc == -ECANCELED) {
1525 M0_LOG(
M0_DEBUG,
"failed devices = %d\ttolerance=%d", (
int)fdev_nr,
1527 M0_LOG(
M0_DEBUG,
"failed services = %d\ttolerance=%d", (
int)fsvc_nr,
1528 (
int)max_svc_failures);
1529 M0_LOG(
M0_DEBUG,
"failed nodes = %d\ttolerance=%d", (
int)fnode_nr,
1530 (
int)max_node_failures);
1533 fnode_nr, max_node_failures))
1534 return M0_ERR_INFO(-EIO,
"[%p] Failed to recover data " 1535 "since number of failed data units " 1536 "(%lu) exceeds number of parity " 1537 "units in parity group (%lu) OR " 1538 "number of failed services (%lu) " 1539 "exceeds number of max failures " 1540 "supported (%lu) OR " 1541 "number of failed nodes (%lu) " 1542 "exceeds number of max node failures " 1544 ioo, (
unsigned long)fdev_nr,
1546 (
unsigned long)fsvc_nr,
1547 (
unsigned long)max_svc_failures,
1548 (
unsigned long)fnode_nr,
1549 (
unsigned long)max_node_failures);
1550 return M0_RC(fdev_nr);
1663 M0_LOG(
M0_WARN,
"Process failed parity groups in dgmode/read " 1664 "ioo=%p dgmap_nr=%u",
1737 if (M0_IN(xfer->
nxr_rc, (0, -E2BIG)))
1802 return M0_ERR_INFO(
rc,
"Failed to prepare dgmode write fops");
1834 !
instance->m0c_config->mc_is_read_verify)
1873 #undef M0_TRACE_SUBSYSTEM int(* iro_dgmode_read)(struct m0_op_io *ioo, bool rmw)
M0_INTERNAL void m0_ivec_cursor_init(struct m0_ivec_cursor *cur, const struct m0_indexvec *ivec)
static void nw_xfer_device_state_reset(struct nw_xfer_request *xfer)
M0_INTERNAL bool m0_pdclust_is_replicated(struct m0_pdclust_layout *play)
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_sm_fail(struct m0_sm *mach, int fail_state, int32_t rc)
int(* iro_parity_recalc)(struct m0_op_io *ioo)
#define m0_htable_for(name, var, htable)
static m0_bcount_t seg_endpos(const struct m0_indexvec *ivec, uint32_t i)
M0_INTERNAL m0_bcount_t m0_ivec_cursor_step(const struct m0_ivec_cursor *cur)
uint64_t * ioo_failed_nodes
static void pargrp_iomap_fini(struct pargrp_iomap *map)
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
static uint64_t data_buf_copy(struct data_buf *data, struct m0_bufvec_cursor *app_datacur, enum copy_direction dir)
static void ioreq_iosm_handle_executed(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL struct m0_pool_version * m0_pool_version_find(struct m0_pools_common *pc, const struct m0_fid *id)
int(* iro_parity_verify)(struct m0_op_io *ioo)
static struct m0_sm_group * grp
struct m0_pool_version * pv
struct m0_poolmach pv_mach
#define M0_LOG(level,...)
struct m0_bufvec * user_data
const struct m0_op_io_ops * ioo_ops
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
static uint32_t layout_k(const struct m0_pdclust_layout *play)
struct m0_sm_group * oo_sm_grp
M0_INTERNAL int ioreq_fop_dgmode_read(struct ioreq_fop *irfop)
int(* iro_dgmode_write)(struct m0_op_io *ioo, bool rmw)
void(* nxo_complete)(struct nw_xfer_request *xfer, bool rmw)
M0_BOB_DEFINE(M0_INTERNAL, &ioo_bobtype, m0_op_io)
static bool is_node_marked(struct m0_op_io *ioo, uint64_t node_id)
int(* pi_dgmode_recover)(struct pargrp_iomap *map)
struct m0_sm_conf io_sm_conf
enum target_ioreq_type ti_req_type
struct m0_indexvec_varr ti_bufvec
int(* pi_parity_replica_verify)(struct pargrp_iomap *map)
struct m0_varr ti_pageattrs
M0_INTERNAL void * m0_bufvec_cursor_addr(struct m0_bufvec_cursor *cur)
M0_INTERNAL int m0_poolmach_device_state(struct m0_poolmach *pm, uint32_t device_index, enum m0_pool_nd_state *state_out)
M0_INTERNAL bool m0__is_update_op(struct m0_op *op)
struct m0_pdclust_attr pl_attr
M0_INTERNAL uint64_t m0__obj_lid(struct m0_obj *obj)
M0_INTERNAL uint64_t m0_round_up(uint64_t val, uint64_t size)
enum m0_pool_nd_state ti_state
int(* iro_application_data_copy)(struct m0_op_io *ioo, enum copy_direction dir, enum page_attr filter)
#define M0_ASSERT_EX(cond)
struct m0_semaphore cpus_sem
int(* pi_replica_recover)(struct pargrp_iomap *map)
static struct m0_sm_state_descr io_states[]
static struct m0_sm_ast ast[NR]
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
void(* iro_iosm_handle_executed)(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL bool m0_bufvec_cursor_move(struct m0_bufvec_cursor *cur, m0_bcount_t count)
static int ioreq_parity_recalc(struct m0_op_io *ioo)
int m0_obj_layout_id_to_unit_size(uint64_t layout_id)
uint64_t * ioo_failed_session
static int device_check(struct m0_op_io *ioo)
M0_INTERNAL bool m0__obj_is_parity_verify_mode(struct m0_client *instance)
static void ioreq_iosm_handle_launch(struct m0_sm_group *grp, struct m0_sm_ast *ast)
struct nw_xfer_request ioo_nwxfer
static int truncate_dispatch(struct m0_op_io *ioo)
#define M0_ERR_INFO(rc, fmt,...)
int(* nxo_distribute)(struct nw_xfer_request *xfer)
static bool verify_checksum(struct m0_op_io *ioo)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL struct m0_poolmach * ioo_to_poolmach(struct m0_op_io *ioo)
M0_INTERNAL struct m0_client * m0__op_instance(const struct m0_op *op)
int(* pi_populate)(struct pargrp_iomap *iomap, struct m0_ivec_varr_cursor *cursor)
M0_INTERNAL int m0_op_stable(struct m0_op *op)
struct m0_indexvec ioo_ext
M0_INTERNAL m0_bcount_t m0_bufvec_cursor_step(const struct m0_bufvec_cursor *cur)
enum pargrp_iomap_state pi_state
static int ioreq_dgmode_recover(struct m0_op_io *ioo)
void m0_sm_state_set(struct m0_sm *mach, int state)
const struct nw_xfer_ops * nxr_ops
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)
#define bob_of(ptr, type, field, bt)
struct m0_bufvec ioo_data
M0_INTERNAL void ioreq_sm_state_set_locked(struct m0_op_io *ioo, int state)
M0_INTERNAL void m0_bufvec_cursor_init(struct m0_bufvec_cursor *cur, const struct m0_bufvec *bvec)
uint64_t ioo_rmw_read_pages
enum m0_pbuf_type ioo_pbuf_type
const struct m0_bob_type ioo_bobtype
static bool is_session_marked(struct m0_op_io *ioo, struct m0_rpc_session *session)
static uint64_t layout_unit_size(const struct m0_pdclust_layout *play)
struct m0_sm_group * sm_grp
int(* pi_dgmode_postprocess)(struct pargrp_iomap *map)
static uint64_t tolerance_of_level(struct io_request *req, uint64_t lv)
static int ioreq_dgmode_write(struct m0_op_io *ioo, bool rmw)
int(* pi_parity_verify)(struct pargrp_iomap *map)
struct m0_htable nxr_tioreqs_hash
M0_INTERNAL bool m0__is_read_op(struct m0_op *op)
struct m0_rpc_session * ti_session
static bool pargrp_iomap_invariant(struct pargrp_iomap *map)
static uint64_t min64u(uint64_t a, uint64_t b)
M0_INTERNAL bool m0_ivec_cursor_move(struct m0_ivec_cursor *cur, m0_bcount_t count)
struct m0_op_common oo_oc
M0_INTERNAL int m0_poolmach_device_node_return(struct m0_poolmach *pm, uint32_t device_index, struct m0_poolnode **node_out)
static void set_paritybuf_type(struct m0_op_io *ioo)
static void page_pos_get(struct pargrp_iomap *map, m0_bindex_t index, uint32_t *row, uint32_t *col)
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 uint64_t data_size(const struct m0_pdclust_layout *play)
M0_INTERNAL int m0_op_executed(struct m0_op *op)
M0_INTERNAL m0_bcount_t m0_vec_count(const struct m0_vec *vec)
static uint32_t layout_n(const struct m0_pdclust_layout *play)
static struct m0_pdclust_layout * pdlayout_get(const struct io_request *req)
static struct m0_client cinst
M0_INTERNAL void ioreq_sm_failed_locked(struct m0_op_io *ioo, int rc)
static int ioreq_iomaps_parity_groups_cal(struct m0_op_io *ioo)
static void ioreq_iomaps_destroy(struct m0_op_io *ioo)
M0_INTERNAL int m0_op_failed(struct m0_op *op)
static int pargrp_iomap_init(struct pargrp_iomap *map, struct io_request *req, uint64_t grpid)
#define M0_ALLOC_PTR(ptr)
int(* nxo_dispatch)(struct nw_xfer_request *xfer)
M0_INTERNAL bool m0__obj_is_cksum_validation_allowed(struct m0_op_io *ioo)
static int ioreq_dgmode_read(struct m0_op_io *ioo, bool rmw)
enum nw_xfer_state nxr_state
int(* iro_dgmode_recover)(struct m0_op_io *ioo)
M0_INTERNAL void m0__obj_op_done(struct m0_op *op)
M0_INTERNAL enum m0_pdclust_unit_type m0_pdclust_unit_classify(const struct m0_pdclust_layout *pl, int unit)
struct m0_entity ob_entity
static int start(struct m0_fom *fom)
M0_INTERNAL m0_bindex_t m0_ivec_cursor_index(const struct m0_ivec_cursor *cur)
M0_INTERNAL void m0_sm_move(struct m0_sm *mach, int32_t rc, int state)
M0_INTERNAL void m0_rwlock_read_lock(struct m0_rwlock *lock)
static int ioreq_iomaps_prepare(struct m0_op_io *ioo)
int(* iro_iomaps_prepare)(struct m0_op_io *ioo)
static struct m0 instance
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
int(* pi_parity_recalc)(struct pargrp_iomap *map)
static uint64_t group_id(m0_bindex_t index, m0_bcount_t dtsize)
static struct m0_be_seg * seg
static uint32_t ioreq_sm_state(const struct io_request *req)
#define M0_ASSERT_INFO(cond, fmt,...)
M0_INTERNAL void m0_rwlock_read_unlock(struct m0_rwlock *lock)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
const struct m0_op_io_ops ioo_ops
M0_INTERNAL uint64_t m0__page_size(const struct m0_op_io *ioo)
static int ioreq_application_data_copy(struct m0_op_io *ioo, enum copy_direction dir, enum page_attr filter)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
static int ioreq_parity_verify(struct m0_op_io *ioo)
#define m0_tl_for(name, head, obj)
static struct m0_sm_trans_descr ioo_trans[]
bool m0_calc_verify_cksum_one_unit(struct m0_generic_pi *pi, struct m0_pi_seed *seed, struct m0_bufvec *bvec)
struct m0_bufvec ioo_attr
static bool data_buf_invariant(const struct data_buf *db)
M0_INTERNAL void m0_bufvec_free2(struct m0_bufvec *bufvec)
const struct pargrp_iomap_ops * pi_ops
struct m0_indexvec ti_ivec
#define offsetof(typ, memb)
M0_INTERNAL bool m0_sm_group_is_locked(const struct m0_sm_group *grp)
M0_INTERNAL bool m0_key_val_is_null(struct m0_key_val *kv)
struct pargrp_iomap ** ioo_iomaps
M0_INTERNAL int m0_bufvec_empty_alloc(struct m0_bufvec *bufvec, uint32_t num_segs)
M0_INTERNAL bool m0_op_io_invariant(const struct m0_op_io *iop)
static void ioreq_sm_executed_post(struct m0_op_io *ioo)
#define M0_IMPOSSIBLE(fmt,...)
static void ioreq_ioo_reset(struct m0_op_io *ioo)