Motr  M0
io_fops.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_IOSERVICE_IO_FOPS_H__
26 #define __MOTR_IOSERVICE_IO_FOPS_H__
27 
28 #include "fop/fop.h"
29 #include "fop/fom_generic.h"
30 #include "lib/types.h"
31 #include "rpc/rpc.h"
32 #include "xcode/xcode_attr.h"
33 #include "net/net_otw_types.h"
34 #include "net/net_otw_types_xc.h"
35 #include "fid/fid.h"
36 #include "fid/fid_xc.h"
37 #include "lib/buf.h"
38 #include "lib/buf_xc.h"
39 #include "lib/vec_xc.h"
40 #include "mdservice/md_fops.h"
41 #include "mdservice/md_fops_xc.h"
42 
170 struct m0_io_fop {
172  struct m0_fop if_fop;
177  uint64_t if_magic;
178 };
179 
187 M0_INTERNAL int m0_io_fop_init(struct m0_io_fop *iofop,
188  const struct m0_fid *gfid,
189  struct m0_fop_type *ftype,
190  void (*fop_release)(struct m0_ref *));
191 
196 M0_INTERNAL void m0_io_fop_fini(struct m0_io_fop *iofop);
197 
202 M0_INTERNAL struct m0_rpc_bulk *m0_fop_to_rpcbulk(const struct m0_fop *fop);
203 
209 M0_INTERNAL int m0_io_fop_prepare(struct m0_fop *fop);
210 
215 M0_INTERNAL void m0_io_fop_destroy(struct m0_fop *fop);
216 
217 M0_INTERNAL bool m0_is_read_fop(const struct m0_fop *fop);
218 M0_INTERNAL bool m0_is_write_fop(const struct m0_fop *fop);
219 M0_INTERNAL bool m0_is_read_rep(const struct m0_fop *fop);
220 M0_INTERNAL bool m0_is_write_rep(const struct m0_fop *fop);
221 M0_INTERNAL bool m0_is_io_fop(const struct m0_fop *fop);
222 M0_INTERNAL bool m0_is_io_fop_rep(const struct m0_fop *fop);
223 M0_INTERNAL struct m0_fop_cob_rw *io_rw_get(struct m0_fop *fop);
224 M0_INTERNAL struct m0_fop_cob_rw_reply *io_rw_rep_get(struct m0_fop *fop);
225 M0_INTERNAL bool m0_is_cob_create_fop(const struct m0_fop *fop);
226 M0_INTERNAL bool m0_is_cob_delete_fop(const struct m0_fop *fop);
227 M0_INTERNAL bool m0_is_cob_truncate_fop(const struct m0_fop *fop);
228 M0_INTERNAL bool m0_is_cob_create_delete_fop(const struct m0_fop *fop);
229 M0_INTERNAL bool m0_is_cob_getattr_fop(const struct m0_fop *fop);
230 M0_INTERNAL bool m0_is_cob_setattr_fop(const struct m0_fop *fop);
231 M0_INTERNAL struct m0_fop_cob_common *m0_cobfop_common_get(struct m0_fop *fop);
232 
233 M0_INTERNAL void m0_dump_cob_attr(const struct m0_cob_attr *attr);
241 struct page;
242 struct m0_io_ioseg;
243 
247 M0_INTERNAL int m0_ioservice_fop_init(void);
248 M0_INTERNAL void m0_ioservice_fop_fini(void);
249 
250 extern struct m0_fop_type m0_fop_cob_readv_fopt;
251 extern struct m0_fop_type m0_fop_cob_writev_fopt;
254 extern struct m0_fop_type m0_fop_cob_create_fopt;
255 extern struct m0_fop_type m0_fop_cob_delete_fopt;
261 extern struct m0_fop_type m0_fop_fsync_ios_fopt;
264 
265 extern struct m0_fom_type m0_io_fom_cob_rw_fomt;
266 
267 M0_INTERNAL struct m0_fop_cob_rw *io_rw_get(struct m0_fop *fop);
268 M0_INTERNAL struct m0_fop_cob_rw_reply *io_rw_rep_get(struct m0_fop *fop);
269 
270 M0_INTERNAL size_t m0_io_fop_size_get(struct m0_fop *fop);
271 
272 M0_INTERNAL void m0_io_fop_release(struct m0_ref *ref);
273 
274 M0_INTERNAL uint32_t m0_io_fop_segs_nr(struct m0_fop *fop, uint32_t index);
275 
276 /* Returns the number of bytes to be read/written. */
277 M0_INTERNAL m0_bcount_t m0_io_fop_byte_count(struct m0_io_fop *iofop);
309 struct m0_io_descs {
310  uint32_t id_nr;
312 } M0_XCA_SEQUENCE M0_XCA_DOMAIN(rpc);
313 
319  int32_t rwr_rc;
320 
322  uint64_t rwr_count;
323 
331  uint32_t rwr_repair_done;
332 
335 
338 
341 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
342 
347  int32_t c_rc;
350 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
351 
359  int32_t c_rc;
362 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
363 
365  M0_IO_FLAG_CROW = (1 << 0),
366  M0_IO_FLAG_NOHOLE = (1 << 1),
368  M0_IO_FLAG_SYNC = (1 << 2)
369 };
370 
380  struct m0_fid crw_gfid;
381 
383  struct m0_fid crw_fid;
384 
386  uint32_t crw_index;
387 
389  struct m0_fid crw_pver;
390 
392  uint64_t crw_lid;
393 
399 
411  uint64_t crw_flags;
417 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
418 
431 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
432 
445 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
446 
448  uint64_t if_st;
450 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
451 
458  struct m0_fid c_gobfid;
459 
463  struct m0_fid c_cobfid;
464 
466  struct m0_fid c_pver;
467 
469  uint32_t c_cob_idx;
470 
472  uint32_t c_cob_type;
473 
475  uint64_t c_flags;
476 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
477 
485 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
486 
496 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
497 
503 
504  /* Size to which a file is truncated. */
505  uint64_t ct_size;
506  /* Range to be truncated */
508 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
509 
517 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
518 
523  int32_t cor_rc;
525 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
526 
532 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
533 
538  int32_t cgr_rc;
543 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
544 
550 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
551 
556  int32_t csr_rc;
559 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
560 
561 /* __MOTR_IOSERVICE_IO_FOPS_H__ */
562 #endif
563 
564 /*
565  * Local variables:
566  * c-indentation-style: "K&R"
567  * c-basic-offset: 8
568  * tab-width: 8
569  * fill-column: 80
570  * scroll-step: 1
571  * End:
572  */
M0_INTERNAL struct m0_rpc_bulk * m0_fop_to_rpcbulk(const struct m0_fop *fop)
Definition: io_fops.c:904
uint64_t crw_lid
Definition: io_fops.h:392
struct m0_fop_type m0_fop_cob_truncate_fopt
Definition: io_fops.c:77
uint64_t c_flags
Definition: io_fops.h:475
uint64_t rwr_count
Definition: io_fops.h:322
struct m0_fop_cob_common ct_common
Definition: io_fops.h:502
struct m0_fop_cob_common cd_common
Definition: io_fops.h:495
M0_INTERNAL struct m0_fop_cob_common * m0_cobfop_common_get(struct m0_fop *fop)
Definition: io_fops.c:990
M0_INTERNAL bool m0_is_cob_create_fop(const struct m0_fop *fop)
Definition: io_fops.c:950
struct m0_fop_type m0_fop_cob_readv_fopt
Definition: io_fops.c:71
struct m0_fop_type m0_fop_cob_setattr_reply_fopt
Definition: io_fops.c:84
uint32_t crw_index
Definition: io_fops.h:386
uint32_t rwr_repair_done
Definition: io_fops.h:331
struct m0_fop_cob_rw c_rwv
Definition: io_fops.h:430
M0_INTERNAL bool m0_is_cob_delete_fop(const struct m0_fop *fop)
Definition: io_fops.c:957
M0_INTERNAL struct m0_fop_cob_rw * io_rw_get(struct m0_fop *fop)
Definition: io_fops.c:1037
void fop_release(struct m0_ref *ref)
Definition: stats_ut_svc.c:148
struct m0_rpc_bulk if_rbulk
Definition: io_fops.h:175
M0_INTERNAL m0_bcount_t m0_io_fop_byte_count(struct m0_io_fop *iofop)
Definition: io_fops.c:1925
M0_INTERNAL bool m0_is_io_fop(const struct m0_fop *fop)
Definition: io_fops.c:928
struct m0_fop_cob_op_rep_common cgr_common
Definition: io_fops.h:540
M0_INTERNAL bool m0_is_cob_truncate_fop(const struct m0_fop *fop)
Definition: io_fops.c:964
struct m0_fop_cob_common cs_common
Definition: io_fops.h:549
enum m0_io_flags M0_XCA_DOMAIN
struct m0_net_buf_desc_data * id_descs
Definition: io_fops.h:311
uint32_t c_cob_type
Definition: io_fops.h:472
M0_INTERNAL struct m0_fop_cob_rw_reply * io_rw_rep_get(struct m0_fop *fop)
Definition: io_fops.c:1056
struct m0_fid c_cobfid
Definition: io_fops.h:463
uint64_t m0_bcount_t
Definition: types.h:77
struct m0_fid crw_pver
Definition: io_fops.h:389
M0_INTERNAL bool m0_is_read_rep(const struct m0_fop *fop)
Definition: io_fops.c:933
M0_INTERNAL void m0_io_fop_destroy(struct m0_fop *fop)
Definition: io_fops.c:1581
struct m0_fop_type m0_fop_cob_getattr_fopt
Definition: io_fops.c:80
struct m0_buf crw_di_data_cksum
Definition: io_fops.h:416
M0_INTERNAL size_t m0_io_fop_size_get(struct m0_fop *fop)
Definition: io_fops.c:1589
struct m0_fop_type m0_fop_cob_writev_fopt
Definition: io_fops.c:72
struct m0_fop_cob_common cg_common
Definition: io_fops.h:531
struct m0_fop_type m0_fop_fsync_ios_fopt
Definition: io_fops.c:82
Definition: buf.h:37
uint64_t if_magic
Definition: io_fops.h:177
struct m0_fop_type m0_fop_fv_notification_fopt
Definition: io_fops.c:79
struct m0_fid crw_fid
Definition: io_fops.h:383
M0_INTERNAL bool m0_is_cob_setattr_fop(const struct m0_fop *fop)
Definition: io_fops.c:978
struct m0_fop_cob cgr_body
Definition: io_fops.h:542
struct m0_fop_cob_op_rep_common cor_common
Definition: io_fops.h:524
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 *))
Definition: io_fops.c:865
struct m0_fop if_fop
Definition: io_fops.h:172
M0_INTERNAL bool m0_is_cob_create_delete_fop(const struct m0_fop *fop)
Definition: io_fops.c:985
Definition: refs.h:34
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:949
struct m0_fop_type m0_fop_cob_op_reply_fopt
Definition: io_fops.c:78
struct m0_net_buf_desc if_nbd
Definition: io_fops.h:449
struct m0_buf crw_di_data
Definition: io_fops.h:414
struct m0_io_descs crw_desc
Definition: io_fops.h:398
M0_INTERNAL bool m0_is_write_fop(const struct m0_fop *fop)
Definition: io_fops.c:922
uint32_t c_cob_idx
Definition: io_fops.h:469
M0_INTERNAL bool m0_is_io_fop_rep(const struct m0_fop *fop)
Definition: io_fops.c:945
int if_bulk_inited
Definition: io_fops.h:173
struct m0_fid c_gobfid
Definition: io_fops.h:458
M0_INTERNAL uint32_t m0_io_fop_segs_nr(struct m0_fop *fop, uint32_t index)
Definition: io_fops.c:1020
struct m0_fop_mod_rep rwr_mod_rep
Definition: io_fops.h:337
m0_bcount_t crw_cksum_size
Definition: io_fops.h:413
struct m0_fop_type m0_fop_cob_create_fopt
Definition: io_fops.c:75
struct m0_buf rwr_di_data_cksum
Definition: io_fops.h:340
struct m0_fop_type m0_fop_cob_setattr_fopt
Definition: io_fops.c:83
M0_INTERNAL void m0_io_fop_release(struct m0_ref *ref)
Definition: io_fops.c:1939
struct m0_fop_type m0_fop_cob_getattr_reply_fopt
Definition: io_fops.c:81
struct m0_fop_cob_common cc_common
Definition: io_fops.h:484
struct m0_io_indexvec ct_io_ivec
Definition: io_fops.h:507
struct m0_fop_cob_rw_reply c_rep
Definition: io_fops.h:349
uint32_t rwr_cksum_nob_read
Definition: io_fops.h:334
M0_INTERNAL bool m0_is_read_fop(const struct m0_fop *fop)
Definition: io_fops.c:916
M0_INTERNAL void m0_io_fop_fini(struct m0_io_fop *iofop)
Definition: io_fops.c:897
Definition: fid.h:38
M0_INTERNAL int m0_ioservice_fop_init(void)
Definition: io_fops.c:281
uint64_t if_st
Definition: io_fops.h:448
uint32_t id_nr
Definition: io_fops.h:310
struct m0_fid crw_gfid
Definition: io_fops.h:380
m0_io_flags
Definition: io_fops.h:364
M0_INTERNAL bool m0_is_write_rep(const struct m0_fop *fop)
Definition: io_fops.c:939
struct m0_fop_mod_rep cor_mod_rep
Definition: io_fops.h:516
static struct m0_fop * fop
Definition: item.c:57
struct m0_fid c_pver
Definition: io_fops.h:466
struct m0_fom_type m0_io_fom_cob_rw_fomt
struct m0_fop_cob_op_rep_common csr_common
Definition: io_fops.h:558
M0_INTERNAL bool m0_is_cob_getattr_fop(const struct m0_fop *fop)
Definition: io_fops.c:971
struct m0_fop_type m0_fop_cob_delete_fopt
Definition: io_fops.c:76
uint64_t ct_size
Definition: io_fops.h:505
struct m0_fop_type m0_fop_cob_readv_rep_fopt
Definition: io_fops.c:73
struct m0_fid gfid
Definition: dir.c:626
struct m0_fop_type m0_fop_cob_writev_rep_fopt
Definition: io_fops.c:74
M0_INTERNAL void m0_ioservice_fop_fini(void)
Definition: io_fops.c:251
M0_INTERNAL int m0_io_fop_prepare(struct m0_fop *fop)
Definition: io_fops.c:1513
M0_INTERNAL void m0_dump_cob_attr(const struct m0_cob_attr *attr)
Definition: io_fops.c:132
struct m0_fop_cob c_body
Definition: io_fops.h:454
struct m0_io_indexvec crw_ivec
Definition: io_fops.h:409
Definition: fop.h:80
uint64_t crw_flags
Definition: io_fops.h:411