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/fop_xc.h"
30 #include "fop/fom_generic.h"
31 #include "fop/fom_generic_xc.h"
32 #include "lib/types.h"
33 #include "rpc/rpc.h"
34 #include "xcode/xcode_attr.h"
35 #include "net/net_otw_types.h"
36 #include "net/net_otw_types_xc.h"
37 #include "fid/fid.h"
38 #include "fid/fid_xc.h"
39 #include "lib/buf.h"
40 #include "lib/buf_xc.h"
41 #include "lib/vec_xc.h"
42 #include "mdservice/md_fops.h"
43 #include "mdservice/md_fops_xc.h"
44 
172 struct m0_io_fop {
174  struct m0_fop if_fop;
179  uint64_t if_magic;
180 };
181 
189 M0_INTERNAL int m0_io_fop_init(struct m0_io_fop *iofop,
190  const struct m0_fid *gfid,
191  struct m0_fop_type *ftype,
192  void (*fop_release)(struct m0_ref *));
193 
198 M0_INTERNAL void m0_io_fop_fini(struct m0_io_fop *iofop);
199 
204 M0_INTERNAL struct m0_rpc_bulk *m0_fop_to_rpcbulk(const struct m0_fop *fop);
205 
211 M0_INTERNAL int m0_io_fop_prepare(struct m0_fop *fop);
212 
217 M0_INTERNAL void m0_io_fop_destroy(struct m0_fop *fop);
218 
219 M0_INTERNAL bool m0_is_read_fop(const struct m0_fop *fop);
220 M0_INTERNAL bool m0_is_write_fop(const struct m0_fop *fop);
221 M0_INTERNAL bool m0_is_read_rep(const struct m0_fop *fop);
222 M0_INTERNAL bool m0_is_write_rep(const struct m0_fop *fop);
223 M0_INTERNAL bool m0_is_io_fop(const struct m0_fop *fop);
224 M0_INTERNAL bool m0_is_io_fop_rep(const struct m0_fop *fop);
225 M0_INTERNAL struct m0_fop_cob_rw *io_rw_get(struct m0_fop *fop);
226 M0_INTERNAL struct m0_fop_cob_rw_reply *io_rw_rep_get(struct m0_fop *fop);
227 M0_INTERNAL bool m0_is_cob_create_fop(const struct m0_fop *fop);
228 M0_INTERNAL bool m0_is_cob_delete_fop(const struct m0_fop *fop);
229 M0_INTERNAL bool m0_is_cob_truncate_fop(const struct m0_fop *fop);
230 M0_INTERNAL bool m0_is_cob_create_delete_fop(const struct m0_fop *fop);
231 M0_INTERNAL bool m0_is_cob_getattr_fop(const struct m0_fop *fop);
232 M0_INTERNAL bool m0_is_cob_setattr_fop(const struct m0_fop *fop);
233 M0_INTERNAL struct m0_fop_cob_common *m0_cobfop_common_get(struct m0_fop *fop);
234 
235 M0_INTERNAL void m0_dump_cob_attr(const struct m0_cob_attr *attr);
243 struct page;
244 struct m0_io_ioseg;
245 
249 M0_INTERNAL int m0_ioservice_fop_init(void);
250 M0_INTERNAL void m0_ioservice_fop_fini(void);
251 
252 extern struct m0_fop_type m0_fop_cob_readv_fopt;
253 extern struct m0_fop_type m0_fop_cob_writev_fopt;
256 extern struct m0_fop_type m0_fop_cob_create_fopt;
257 extern struct m0_fop_type m0_fop_cob_delete_fopt;
263 extern struct m0_fop_type m0_fop_fsync_ios_fopt;
266 
267 extern struct m0_fom_type m0_io_fom_cob_rw_fomt;
268 
269 M0_INTERNAL struct m0_fop_cob_rw *io_rw_get(struct m0_fop *fop);
270 M0_INTERNAL struct m0_fop_cob_rw_reply *io_rw_rep_get(struct m0_fop *fop);
271 
272 M0_INTERNAL size_t m0_io_fop_size_get(struct m0_fop *fop);
273 
274 M0_INTERNAL void m0_io_fop_release(struct m0_ref *ref);
275 
276 M0_INTERNAL uint32_t m0_io_fop_segs_nr(struct m0_fop *fop, uint32_t index);
277 
278 /* Returns the number of bytes to be read/written. */
279 M0_INTERNAL m0_bcount_t m0_io_fop_byte_count(struct m0_io_fop *iofop);
311 struct m0_io_descs {
312  uint32_t id_nr;
314 } M0_XCA_SEQUENCE M0_XCA_DOMAIN(rpc);
315 
321  int32_t rwr_rc;
322 
324  uint64_t rwr_count;
325 
333  uint32_t rwr_repair_done;
334 
337 
340 
343 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
344 
349  int32_t c_rc;
352 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
353 
361  int32_t c_rc;
364 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
365 
367  M0_IO_FLAG_CROW = (1 << 0),
368  M0_IO_FLAG_NOHOLE = (1 << 1),
370  M0_IO_FLAG_SYNC = (1 << 2)
371 };
372 
382  struct m0_fid crw_gfid;
383 
385  struct m0_fid crw_fid;
386 
388  uint32_t crw_index;
389 
391  struct m0_fid crw_pver;
392 
394  uint64_t crw_lid;
395 
401 
413  uint64_t crw_flags;
419 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
420 
433 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
434 
447 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
448 
450  uint64_t if_st;
452 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
453 
460  struct m0_fid c_gobfid;
461 
465  struct m0_fid c_cobfid;
466 
468  struct m0_fid c_pver;
469 
471  uint32_t c_cob_idx;
472 
474  uint32_t c_cob_type;
475 
477  uint64_t c_flags;
478 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
479 
487 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
488 
498 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
499 
505 
506  /* Size to which a file is truncated. */
507  uint64_t ct_size;
508  /* Range to be truncated */
510 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
511 
519 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
520 
525  int32_t cor_rc;
527 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
528 
534 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
535 
540  int32_t cgr_rc;
545 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
546 
552 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
553 
558  int32_t csr_rc;
561 } M0_XCA_RECORD M0_XCA_DOMAIN(rpc);
562 
563 /* __MOTR_IOSERVICE_IO_FOPS_H__ */
564 #endif
565 
566 /*
567  * Local variables:
568  * c-indentation-style: "K&R"
569  * c-basic-offset: 8
570  * tab-width: 8
571  * fill-column: 80
572  * scroll-step: 1
573  * End:
574  */
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:394
struct m0_fop_type m0_fop_cob_truncate_fopt
Definition: io_fops.c:77
uint64_t c_flags
Definition: io_fops.h:477
uint64_t rwr_count
Definition: io_fops.h:324
struct m0_fop_cob_common ct_common
Definition: io_fops.h:504
struct m0_fop_cob_common cd_common
Definition: io_fops.h:497
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:388
uint32_t rwr_repair_done
Definition: io_fops.h:333
struct m0_fop_cob_rw c_rwv
Definition: io_fops.h:432
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:177
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:542
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:551
enum m0_io_flags M0_XCA_DOMAIN
struct m0_net_buf_desc_data * id_descs
Definition: io_fops.h:313
uint32_t c_cob_type
Definition: io_fops.h:474
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:465
uint64_t m0_bcount_t
Definition: types.h:77
struct m0_fid crw_pver
Definition: io_fops.h:391
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:418
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:533
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:179
struct m0_fop_type m0_fop_fv_notification_fopt
Definition: io_fops.c:79
struct m0_fid crw_fid
Definition: io_fops.h:385
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:544
struct m0_fop_cob_op_rep_common cor_common
Definition: io_fops.h:526
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:174
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:451
struct m0_buf crw_di_data
Definition: io_fops.h:416
struct m0_io_descs crw_desc
Definition: io_fops.h:400
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:471
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:175
struct m0_fid c_gobfid
Definition: io_fops.h:460
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:339
m0_bcount_t crw_cksum_size
Definition: io_fops.h:415
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:342
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:486
struct m0_io_indexvec ct_io_ivec
Definition: io_fops.h:509
struct m0_fop_cob_rw_reply c_rep
Definition: io_fops.h:351
uint32_t rwr_cksum_nob_read
Definition: io_fops.h:336
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:450
uint32_t id_nr
Definition: io_fops.h:312
struct m0_fid crw_gfid
Definition: io_fops.h:382
m0_io_flags
Definition: io_fops.h:366
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:518
static struct m0_fop * fop
Definition: item.c:57
struct m0_fid c_pver
Definition: io_fops.h:468
struct m0_fom_type m0_io_fom_cob_rw_fomt
struct m0_fop_cob_op_rep_common csr_common
Definition: io_fops.h:560
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:507
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:456
struct m0_io_indexvec crw_ivec
Definition: io_fops.h:411
Definition: fop.h:79
uint64_t crw_flags
Definition: io_fops.h:413