23 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_IOSERVICE 43 #include "mdservice/fsync_fops_xc.h" 47 #include "ioservice/io_fops_xc.h" 123 wfop = frag->ffrp_rep;
134 uint32_t valid =
attr->ca_valid;
135 #define level M0_DEBUG 146 (
unsigned long long)
attr->ca_atime);
149 (
unsigned long long)
attr->ca_mtime);
152 (
unsigned long long)
attr->ca_ctime);
161 (
unsigned long long)
attr->ca_blksize);
164 (
unsigned long long)
attr->ca_blocks);
179 struct m0_fol *fol,
bool undo)
201 frag->ffrp_fop, rpcmach);
204 fom->fo_local =
true;
211 struct m0_fol *fol,
bool undo)
305 .
xt = m0_fop_cob_readv_xc,
318 .
xt = m0_fop_cob_writev_xc,
329 .
name =
"read-reply",
331 .
xt = m0_fop_cob_readv_rep_xc,
335 .
name =
"write-reply",
337 .
xt = m0_fop_cob_writev_rep_xc,
341 .
name =
"cob-create",
343 .
xt = m0_fop_cob_create_xc,
350 .sm = p_cob_ops_conf);
353 .
name =
"cob-delete",
355 .
xt = m0_fop_cob_delete_xc,
362 .sm = p_cob_ops_conf);
365 .
name =
"cob-truncate",
367 .
xt = m0_fop_cob_truncate_xc,
374 .sm = p_cob_ops_conf);
379 .
xt = m0_fop_cob_op_reply_xc,
385 .
xt = m0_fop_cob_getattr_xc,
391 .sm = p_cob_ops_conf);
394 .
name =
"getattr-reply",
396 .
xt = m0_fop_cob_getattr_reply_xc,
402 .
xt = m0_fop_fsync_xc,
412 .
xt = m0_fop_cob_setattr_xc,
419 .sm = p_cob_ops_conf);
422 .
name =
"setattr-reply",
424 .
xt = m0_fop_cob_setattr_reply_xc,
840 struct ioseg, is_linkage, is_magic,
849 M0_PRE(seg_index < zvec->z_bvec.ov_vec.v_nr);
1003 return &
cc->cc_common;
1031 segs_nr = (used_size + max_seg_size - 1) / max_seg_size;
1049 return &rfop->
c_rwv;
1052 return &wfop->
c_rwv;
1066 return &rfop->
c_rep;
1069 return &wfop->
c_rep;
1085 iosegset_tlist_del(
ioseg);
1093 static bool io_fop_type_equal(
const struct m0_fop *fop1,
1094 const struct m0_fop *fop2)
1104 struct ioseg *new_seg = 0;
1110 if (new_seg ==
NULL)
1116 iosegset_tlink_init(new_seg);
1123 struct ioseg *new_seg;
1133 iosegset_tlist_add_before(cseg, new_seg);
1144 struct ioseg *new_seg;
1158 if (
rc == 0 ||
rc == -ENOMEM)
1165 iosegset_tlist_add_tail(&aggr_set->
iss_list, new_seg);
1196 int32_t max_segs_nr;
1197 int32_t curr_segs_nr;
1215 curr_segs_nr = iosegset_tlist_length(&
seg_set->iss_list);
1217 while (curr_segs_nr != 0) {
1229 segs_nr <= max_segs_nr) {
1255 if (++
nr == segs_nr)
1260 M0_POST(
buf->bb_zerovec.z_bvec.ov_vec.v_nr <= max_segs_nr);
1261 curr_segs_nr -= segs_nr;
1286 #define ZNR(zvec) zvec->z_bvec.ov_vec.v_nr 1287 #define ZCOUNT(zvec, i) zvec->z_bvec.ov_vec.v_count[i] 1288 #define ZINDEX(zvec, i) zvec->z_index[i] 1290 #define INR(ivec) ivec->ci_nr 1291 #define IINDEX(ivec, i) ivec->ci_iosegs[i].ci_index 1292 #define ICOUNT(ivec, i) ivec->ci_iosegs[i].ci_count 1311 for (;
i <
ZNR(zvec); ++
i) {
1338 for (; j <
ZNR(zvec); ++j) {
1384 uint64_t curr_size = 0;
1391 #ifndef ENABLE_DATA_INTEGRITY 1619 struct m0_tl *items_list;
1647 iosegset_tlist_init(&aggr_set.
iss_list);
1655 M0_ASSERT(!rpcitem_tlist_is_empty(items_list));
1747 rpcitem_tlist_add(items_list, &bkp_fop->
f_item);
1754 iosegset_tlist_fini(&aggr_set.
iss_list);
1768 static bool io_fop_fid_equal(
struct m0_fop *fop1,
struct m0_fop *fop2)
1901 if (rpcitem_tlist_is_empty(&
head->ri_compound_items))
1908 rpcitem_tlist_add(&
head->ri_compound_items,
head);
1920 rpcitem_tlist_del(
head);
1951 #undef M0_TRACE_SUBSYSTEM static int io_fol_cd_rec_frag_redo(struct m0_fop_fol_frag *frag, struct m0_fol *fol)
M0_INTERNAL m0_bcount_t m0_net_domain_get_max_buffer_segment_size(struct m0_net_domain *dom)
#define M0_BUFVEC_INIT_BUF(addr_ptr, count_ptr)
struct m0_fop_type m0_fop_cob_readv_rep_fopt
struct m0_fop_type m0_fop_cob_op_reply_fopt
M0_INTERNAL void m0_sm_conf_init(struct m0_sm_conf *conf)
#define M0_ALLOC_ARR(arr, nr)
M0_TL_DEFINE(iosegset, static, struct ioseg)
struct m0_fop_type m0_fop_cob_setattr_reply_fopt
M0_BASSERT(M0_IOSERVICE_COB_DELETE_OPCODE==M0_IOSERVICE_COB_CREATE_OPCODE+1)
M0_INTERNAL m0_bcount_t m0_io_fop_byte_count(struct m0_io_fop *iofop)
static m0_bindex_t seg_set(struct pargrp_iomap *map, uint32_t seg, struct m0_ivec_varr_cursor *cur, m0_bindex_t grpend)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
struct m0_fop_cob_common ct_common
struct m0_fop_cob_common cd_common
static struct m0_list list
const struct m0_sm_conf cob_ops_conf
M0_INTERNAL struct m0_fop_cob_common * m0_cobfop_common_get(struct m0_fop *fop)
static struct m0_semaphore q
M0_INTERNAL int m0_rpc_bulk_store(struct m0_rpc_bulk *rbulk, const struct m0_rpc_conn *conn, struct m0_net_buf_desc_data *to_desc, const struct m0_net_buffer_callbacks *bulk_cb)
struct m0_bufvec nb_buffer
struct m0_fop_cob_rw c_rwv
const struct m0_fom_type_ops cob_fom_type_ops
#define M0_FOP_TYPE_INIT(ft,...)
M0_INTERNAL void io_fop_ivec_dealloc(struct m0_fop *fop)
struct m0_tlink is_linkage
M0_INTERNAL void m0_fop_init(struct m0_fop *fop, struct m0_fop_type *fopt, void *data, void(*fop_release)(struct m0_ref *))
M0_INTERNAL int m0_rpc_bulk_buf_databuf_add(struct m0_rpc_bulk_buf *rbuf, void *buf, m0_bcount_t count, m0_bindex_t index, struct m0_net_domain *netdom)
int(* fto_io_coalesce)(struct m0_fop *fop, uint64_t rpc_size)
#define M0_LOG(level,...)
static int io_fol_frag_undo_redo_op(struct m0_fop_fol_frag *frag, struct m0_fol *fol)
static int io_fop_seg_add_cond(struct ioseg *cseg, const struct ioseg *nseg)
static void io_fop_desc_dealloc(struct m0_fop *fop)
void fop_release(struct m0_ref *ref)
void m0_fop_type_addb2_deinstrument(struct m0_fop_type *type)
M0_INTERNAL void m0_io_fop_release(struct m0_ref *ref)
uint64_t(* do_out_shift)(const struct m0_file *file)
static int io_netbufs_prepare(struct m0_fop *coalesced_fop, struct io_seg_set *seg_set)
M0_INTERNAL void m0_rpc_bulk_fini(struct m0_rpc_bulk *rbulk)
struct m0_tl ri_compound_items
struct m0_rpc_bulk if_rbulk
struct m0_fop_type m0_fop_fsync_ios_fopt
M0_INTERNAL bool m0_is_cob_truncate_fop(const struct m0_fop *fop)
struct m0_fop_cob_common cs_common
struct m0_net_buf_desc_data * id_descs
void * m0_fop_data(const struct m0_fop *fop)
void m0_fop_type_fini(struct m0_fop_type *fopt)
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
M0_INTERNAL void m0_sm_conf_trans_extend(const struct m0_sm_conf *base, struct m0_sm_conf *sub)
static int io_fop_ivec_prepare(struct m0_fop *res_fop, struct m0_rpc_bulk *rbulk)
M0_INTERNAL void m0_sm_conf_extend(const struct m0_sm_state_descr *base, struct m0_sm_state_descr *sub, uint32_t nr)
#define m0_exists(var, nr,...)
M0_INTERNAL bool m0_net_buffer_del(struct m0_net_buffer *buf, struct m0_net_transfer_mc *tm)
struct m0_sm_conf io_conf
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
static struct m0_xcode_type ** xt[]
void(* do_sum)(const struct m0_file *file, const struct m0_indexvec *io_info, const struct m0_bufvec *in, struct m0_bufvec *out)
static void io_fop_desc_get(struct m0_fop *fop, struct m0_net_buf_desc_data **desc)
M0_INTERNAL bool m0_is_read_rep(const struct m0_fop *fop)
const struct m0_sm_conf m0_generic_conf
static struct m0_rpc_item * item
M0_INTERNAL void m0_io_fop_destroy(struct m0_fop *fop)
M0_INTERNAL bool m0_tlist_is_empty(const struct m0_tl_descr *d, const struct m0_tl *list)
M0_INTERNAL void m0_rpc_bulk_buflist_empty(struct m0_rpc_bulk *rbulk)
static int io_fop_desc_ivec_prepare(struct m0_fop *fop, struct io_seg_set *aggr_set)
M0_INTERNAL struct m0_sm_conf m0_fsync_fom_conf
struct m0_fop_cob_common cg_common
M0_INTERNAL int m0_xcode_length(struct m0_xcode_ctx *ctx)
static int head(struct m0_sm *mach)
const struct m0_fop_type_ops io_fop_cd_ops
M0_INTERNAL int m0_ioservice_fop_init(void)
const struct m0_rpc_item_ops io_req_rpc_item_ops
const struct m0_fom_type_ops m0_fsync_fom_ops
struct m0_fop_type m0_fop_cob_getattr_fopt
M0_TL_DESCR_DEFINE(iosegset, "list of coalesced io segments", static, struct ioseg, is_linkage, is_magic, M0_IOS_IO_SEGMENT_MAGIC, M0_IOS_IO_SEGMENT_SET_MAGIC)
static void io_fop_replied(struct m0_fop *fop, struct m0_fop *bkpfop)
M0_INTERNAL struct m0_file * m0_client_fop_to_file(struct m0_fop *fop)
M0_INTERNAL struct m0_rpc_bulk * m0_fop_to_rpcbulk(const struct m0_fop *fop)
struct m0_fop_type * f_type
M0_INTERNAL bool m0_is_cob_setattr_fop(const struct m0_fop *fop)
static const struct m0_reqh_service_ops rpc_ops
struct m0_fop_type m0_fop_cob_getattr_reply_fopt
static const struct m0_rpc_item_type_ops io_item_type_ops
static struct m0_fop_type * ioservice_fops[]
M0_INTERNAL int m0_cob_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
static struct m0_fid * io_fop_fid_get(struct m0_fop *fop)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL struct m0_fop_cob_rw_reply * io_rw_rep_get(struct m0_fop *fop)
M0_INTERNAL bool m0_is_cob_create_delete_fop(const struct m0_fop *fop)
M0_INTERNAL struct m0_file * m0_fop_to_file(struct m0_fop *fop)
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
#define m0_tl_teardown(name, head, obj)
struct m0_net_buffer * bb_nbuf
struct m0_buf crw_di_data
struct m0_fop_type m0_fop_cob_setattr_fopt
M0_INTERNAL size_t m0_io_fop_size_get(struct m0_fop *fop)
struct m0_io_descs crw_desc
M0_INTERNAL bool m0_mutex_is_locked(const struct m0_mutex *mutex)
M0_INTERNAL void m0_rpc_bulk_init(struct m0_rpc_bulk *rbulk)
static int io_fol_cd_rec_frag_op(struct m0_fop_fol_frag *frag, struct m0_fol *fol, bool undo)
M0_INTERNAL bool m0_is_io_fop_rep(const struct m0_fop *fop)
struct m0_sm_state_descr cob_ops_phases[]
struct m0_reqh_service_type m0_ios_type
M0_INTERNAL int m0_indexvec_wire2mem(struct m0_io_indexvec *wire_ivec, int max_frags_nr, uint32_t bshift, struct m0_indexvec *mem_ivec)
struct m0_tl rh_rpc_machines
static int io_fop_coalesce(struct m0_fop *res_fop, uint64_t size)
static void io_item_replied(struct m0_rpc_item *item)
const struct m0_rpc_item_type * ri_type
struct m0_rpc_item * ri_reply
void * m0_alloc(size_t size)
struct m0_sm_state_descr io_phases[]
struct m0_0vec bb_zerovec
M0_INTERNAL void m0_net_desc_free(struct m0_net_buf_desc *desc)
M0_INTERNAL m0_bcount_t m0_net_domain_get_max_buffer_size(struct m0_net_domain *dom)
M0_INTERNAL int m0_fop_data_alloc(struct m0_fop *fop)
static int io_fol_cd_rec_frag_undo(struct m0_fop_fol_frag *frag, struct m0_fol *fol)
M0_INTERNAL void m0_fop_fini(struct m0_fop *fop)
M0_INTERNAL bool m0_list_is_empty(const struct m0_list *head)
struct m0_indexvec io_vec
M0_INTERNAL m0_bcount_t m0_vec_count(const struct m0_vec *vec)
struct m0_fop_cob_rw_reply c_rep
M0_INTERNAL bool m0_is_cob_create_fop(const struct m0_fop *fop)
void(* rio_replied)(struct m0_rpc_item *item)
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
static void ioseg_unlink_free(struct ioseg *ioseg)
struct m0_fop_type m0_fop_cob_readv_fopt
int32_t m0_rpc_item_error(const struct m0_rpc_item *item)
static int io_fop_seg_init(struct ioseg **ns, const struct ioseg *cseg)
static int io_fop_desc_alloc(struct m0_fop *fop, struct m0_rpc_bulk *rbulk)
M0_INTERNAL int m0_indexvec_split(struct m0_indexvec *in, m0_bcount_t curr_pos, m0_bcount_t nb_len, uint32_t bshift, struct m0_indexvec *out)
M0_INTERNAL m0_bcount_t m0_di_size_get(const struct m0_file *file, const m0_bcount_t size)
M0_INTERNAL bool m0_is_io_fop(const struct m0_fop *fop)
struct m0_sm_state_descr * scf_state
M0_TL_DESCR_DECLARE(rpcbulk, M0_EXTERN)
#define M0_FI_ENABLED(tag)
static int io_fop_di_prepare(struct m0_fop *fop)
static struct m0_0vec * io_0vec_get(struct m0_rpc_bulk_buf *rbuf)
static void io_fop_segments_coalesce(const struct m0_0vec *iovec, struct io_seg_set *aggr_set)
#define M0_ALLOC_PTR(ptr)
const struct m0_rpc_item_ops * ri_ops
struct m0_net_domain * m0_fop_domain_get(const struct m0_fop *fop)
struct m0_fop_type m0_fop_cob_writev_rep_fopt
M0_INTERNAL void m0_ioservice_fop_fini(void)
int m0_fop_type_addb2_instrument(struct m0_fop_type *type)
struct m0_fop_type m0_fop_fv_notification_fopt
struct m0_rpc_session * ri_session
const struct m0_fop_type_ops * ft_ops
M0_INTERNAL m0_bcount_t m0_io_count(const struct m0_io_indexvec *io_info)
struct m0_fop_type m0_fop_cob_create_fopt
static void ioseg_get(const struct m0_0vec *zvec, uint32_t seg_index, struct ioseg *seg)
static void iosegs_squeeze(struct m0_rpc_bulk *rbulk, struct m0_io_indexvec *ivec)
M0_INTERNAL bool m0_is_write_rep(const struct m0_fop *fop)
static struct m0_fop * fop
struct m0_rpc_item_type ft_rpc_item_type
M0_INTERNAL int32_t m0_net_domain_get_max_buffer_segments(struct m0_net_domain *dom)
struct m0_fop * m0_rpc_item_to_fop(const struct m0_rpc_item *item)
M0_INTERNAL void m0_fom_queue(struct m0_fom *fom)
struct m0_net_buf_desc bdd_desc
static struct m0_be_seg * seg
M0_INTERNAL void m0_rpc_bulk_qtype(struct m0_rpc_bulk *rbulk, enum m0_net_queue_type q)
#define M0_ASSERT_INFO(cond, fmt,...)
static void item_io_coalesce(struct m0_rpc_item *head, struct m0_list *list, uint64_t size)
void(* fto_fop_replied)(struct m0_fop *fop, struct m0_fop *bfop)
M0_INTERNAL bool m0_is_cob_getattr_fop(const struct m0_fop *fop)
static bool io_fop_invariant(struct m0_io_fop *iofop)
M0_INTERNAL void m0_io_fop_fini(struct m0_io_fop *iofop)
M0_INTERNAL int m0_io_fop_init(struct m0_io_fop *iofop, const struct m0_fid *gfid, struct m0_fop_type *ftype, void(*fop_release)(struct m0_ref *))
M0_INTERNAL void m0_xcode_ctx_init(struct m0_xcode_ctx *ctx, const struct m0_xcode_obj *obj)
M0_INTERNAL bool m0_is_read_fop(const struct m0_fop *fop)
const struct m0_fop_type_ops io_fop_rwv_ops
M0_INTERNAL bool m0_is_cob_delete_fop(const struct m0_fop *fop)
const struct m0_net_buffer_callbacks m0_rpc__buf_bulk_cb
const struct m0_fom_type_ops io_fom_type_ops
M0_INTERNAL void m0_sm_conf_fini(struct m0_sm_conf *conf)
M0_INTERNAL struct m0_fop_cob_rw * io_rw_get(struct m0_fop *fop)
M0_INTERNAL bool m0_is_write_fop(const struct m0_fop *fop)
struct m0_fop_type m0_fop_cob_truncate_fopt
M0_INTERNAL int m0_io_fop_prepare(struct m0_fop *fop)
M0_INTERNAL void m0_dump_cob_attr(const struct m0_cob_attr *attr)
#define M0_FOP_XCODE_OBJ(f)
static struct m0_dtm_oper_descr reply
M0_INTERNAL int m0_rpc_bulk_buf_add(struct m0_rpc_bulk *rbulk, uint32_t segs_nr, m0_bcount_t length, struct m0_net_domain *netdom, struct m0_net_buffer *nb, struct m0_rpc_bulk_buf **out)
struct m0_fop_type m0_fop_cob_writev_fopt
#define m0_tl_for(name, head, obj)
struct m0_rpc_item f_item
#define M0_BUF_INIT(size, data)
struct m0_ioseg * ci_iosegs
struct m0_io_indexvec crw_ivec
struct m0_pdclust_src_addr src
static void io_fop_bulkbuf_move(struct m0_fop *src, struct m0_fop *dest)
M0_INTERNAL uint32_t m0_io_fop_segs_nr(struct m0_fop *fop, uint32_t index)
static void io_fop_seg_coalesce(const struct ioseg *seg, struct io_seg_set *aggr_set)
#define M0_FOP_DEFAULT_ITEM_TYPE_OPS
struct m0_rpc_conn * s_conn
int(* fto_undo)(struct m0_fop_fol_frag *ffrag, struct m0_fol *fol)
struct m0_net_transfer_mc * m0_fop_tm_get(const struct m0_fop *fop)
static uint32_t iosegs_nr(struct m0_rpc_bulk *rbulk)
M0_TL_DECLARE(rpcbulk, M0_INTERNAL, struct m0_rpc_bulk_buf)
const struct m0_di_ops * fi_di_ops
struct m0_fop * m0_fop_alloc(struct m0_fop_type *fopt, void *data, struct m0_rpc_machine *mach)
struct m0_fop_type m0_fop_cob_delete_fopt
#define M0_IMPOSSIBLE(fmt,...)