Motr  M0
pg.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-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_PG_H__
26 #define __MOTR_PG_H__
27 
28 #include "lib/hash.h"
29 #include "ioservice/io_fops.h" /* m0_io_fop_{init,fini,release} */
30 #include "layout/pdclust.h" /* struct m0_pdclust_attr */
31 #include "pool/pool.h" /* struct m0_pool */
32 
42 /* Exports */
43 struct pargrp_iomap;
44 struct target_ioreq;
45 struct ioreq_fop;
46 struct nw_xfer_request;
47 
66 };
67 
72 enum page_attr {
74  PA_NONE = 0,
75 
77  PA_READ = (1 << 0),
78 
85  PA_FULLPAGE_MODIFY = (1 << 1),
86 
94  PA_PARTPAGE_MODIFY = (1 << 2),
95 
97  PA_WRITE = (1 << 3),
98 
100  PA_DATA = (1 << 4),
101 
103  PA_PARITY = (1 << 5),
104 
116 
118  PA_READ_FAILED = (1 << 7),
119 
121  PA_DGMODE_READ = (1 << 8),
122 
124  PA_DGMODE_WRITE = (1 << 9),
125 
127  PA_APP_MEMORY = (1 << 10),
128 
130  PA_TRUNC = (1 << 11),
131 
132  PA_NR = 12,
133 };
134 
144 };
145 
152 };
153 
154 
162 };
163 
168 };
169 
174 struct data_buf {
175  uint64_t db_magic;
176 
178  struct m0_buf db_buf;
179 
185  struct m0_buf db_auxbuf;
186 
191  enum page_attr db_flags;
192 
197  struct target_ioreq *db_tioreq;
198 
205 
209  uint64_t db_crc;
210 
214  uint32_t db_key;
215 };
216 
218 struct nw_xfer_ops {
225  int (*nxo_distribute) (struct nw_xfer_request *xfer);
226 
235  void (*nxo_complete) (struct nw_xfer_request *xfer, bool rmw);
236 
245  int (*nxo_dispatch) (struct nw_xfer_request *xfer);
246 
256  int (*nxo_tioreq_map) (struct nw_xfer_request *xfer,
257  const struct m0_pdclust_src_addr *src,
258  struct m0_pdclust_tgt_addr *tgt,
259  struct target_ioreq **tio);
260 };
261 
269 struct nw_xfer_request {
270  uint64_t nxr_magic;
271 
273  int nxr_rc;
274 
276  uint64_t nxr_bytes;
277 
279 
280  const struct nw_xfer_ops *nxr_ops;
281 
288 
290  struct m0_mutex nxr_lock;
299  struct m0_atomic64 nxr_iofop_nr;
300 
308  struct m0_atomic64 nxr_rdbulk_nr;
309 
314  struct m0_atomic64 nxr_ccfop_nr;
315 };
316 
325 struct pargrp_iomap {
326  uint64_t pi_magic;
327 
329  uint64_t pi_grpid;
330 
333 
341 
347 
366  struct data_buf ***pi_databufs;
367 
372  uint32_t pi_max_row;
373 
378  uint32_t pi_max_col;
379 
388  struct data_buf ***pi_paritybufs;
389 
391  const struct pargrp_iomap_ops *pi_ops;
392 
394  struct m0_op_io *pi_ioo;
395 
406 };
407 
409 struct pargrp_iomap_ops {
424  int (*pi_populate) (struct pargrp_iomap *iomap,
425  struct m0_ivec_cursor *cursor,
426  struct m0_bufvec_cursor *buf_cursor);
427 
437  bool (*pi_spans_seg) (struct pargrp_iomap *iomap,
440 
447  int (*pi_readrest) (struct pargrp_iomap *iomap);
448 
457  uint64_t (*pi_fullpages_find) (struct pargrp_iomap *map);
458 
471  int (*pi_seg_process) (struct pargrp_iomap *map,
472  uint32_t segid,
473  bool rmw,
474  uint64_t start_buf_index,
475  struct m0_bufvec_cursor *buf_cursor);
476 
484 
486  uint32_t row,
487  uint32_t col,
488  struct m0_bufvec_cursor *buf_cursor);
489 
490 
495  int (*pi_parity_recalc)(struct pargrp_iomap *map);
496 
503  int (*pi_parity_verify)(struct pargrp_iomap *map);
504 
510 
516 
524 
535  struct target_ioreq *tio,
537  uint32_t count);
538 
544 
552 
557 };
558 
560 struct m0_op_io_ops {
567  int (*iro_iomaps_prepare) (struct m0_op_io *ioo);
568 
574  void (*iro_iomaps_destroy)(struct m0_op_io *ioo);
575 
584  enum copy_direction dir,
585  enum page_attr filter);
586 
595  int (*iro_parity_recalc) (struct m0_op_io *ioo);
596 
605  int (*iro_parity_verify) (struct m0_op_io *ioo);
606 
614  struct m0_sm_ast *ast);
615 
623  struct m0_sm_ast *ast);
624 
634  int (*iro_dgmode_read) (struct m0_op_io *ioo, bool rmw);
635 
643  int (*iro_dgmode_recover) (struct m0_op_io *ioo);
644 
655  int (*iro_dgmode_write) (struct m0_op_io *ioo, bool rmw);
656 
661  int (*iro_replica_rectify) (struct m0_op_io *ioo, bool rmw);
662 };
663 
665 struct target_ioreq_ops {
670  void (*tio_seg_add) (struct target_ioreq *ti,
671  const struct m0_pdclust_src_addr *src,
672  const struct m0_pdclust_tgt_addr *tgt,
673  m0_bindex_t gob_offset,
675  struct pargrp_iomap *map);
676 
682  int (*tio_iofops_prepare) (struct target_ioreq *ti,
683  enum page_attr filter);
684 
688  int (*tio_cc_fops_prepare) (struct target_ioreq *ti);
689 };
690 
695 struct dgmode_rwvec {
701 
708 
711 
713  struct target_ioreq *dr_tioreq;
714 };
715 
722 struct cc_req_fop {
723  struct m0_fop crf_fop;
724 
725  struct m0_sm_ast crf_ast;
726 
727  struct target_ioreq *crf_tioreq;
728 };
729 
739 };
740 
747 struct target_ioreq {
748  uint64_t ti_magic;
749 
751  struct m0_fid ti_fid;
752 
754  uint64_t ti_obj;
760 
762  int ti_rc;
763 
765  uint64_t ti_parbytes;
766 
768  uint64_t ti_databytes;
769 
771  struct m0_tl ti_iofops;
773  struct cc_req_fop ti_cc_fop;
774 
776  bool ti_cc_fop_inited;
777 
779  struct m0_rpc_session *ti_session;
780 
782  struct m0_hlink ti_link;
783 
786 
794 
800 
801 
808 
809  // TODO: Combine this into one struct for checksums
812 
813  /* Array for segment having b_nob value of checksum */
815 
821 
827  struct dgmode_rwvec *ti_dgvec;
828 
834 
836  const struct target_ioreq_ops *ti_ops;
837 
839  struct nw_xfer_request *ti_nwxfer;
840 
843 
846 };
847 
859 struct ioreq_fop {
860  uint64_t irf_magic;
861 
864 
867 
870 
873 
876 
882 };
883 
884 
885 #endif /* __MOTR_PG_H__ */
886 
887 /*
888  * Local variables:
889  * c-indentation-style: "K&R"
890  * c-basic-offset: 8
891  * tab-width: 8
892  * fill-column: 80
893  * scroll-step: 1
894  * End:
895  */
896 /*
897  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
898  */
int(* iro_dgmode_read)(struct m0_op_io *ioo, bool rmw)
Definition: pg.h:634
pargrp_iomap_state
Definition: pg.h:143
uint64_t pi_magic
Definition: pg.h:130
bool(* pi_spans_seg)(struct pargrp_iomap *iomap, m0_bindex_t index, m0_bcount_t count)
void(* iro_iosm_handle_launch)(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: pg.h:613
struct m0_tlink irf_link
Definition: pg.h:875
struct m0_buf ti_attrbuf
Definition: pg.h:810
int(* iro_parity_recalc)(struct m0_op_io *ioo)
Definition: pg.h:595
uint32_t db_key
Definition: pg.h:214
struct m0_fop crf_fop
nw_xfer_state
map
Definition: processor.c:112
int(* pi_paritybufs_alloc)(struct pargrp_iomap *map)
struct m0_atomic64 nxr_rdbulk_nr
int(* pi_readrest)(struct pargrp_iomap *iomap)
struct m0_buf db_auxbuf
Definition: pg.h:97
int(* iro_parity_verify)(struct m0_op_io *ioo)
Definition: pg.h:605
static struct m0_sm_group * grp
Definition: bytecount.c:38
struct m0_key_val db_maj_ele
Definition: pg.h:204
struct data_buf *** pi_paritybufs
Definition: pg.h:77
uint64_t m0_time_t
Definition: time.h:37
struct m0_sm_ast crf_ast
struct m0_io_fop irf_iofop
Definition: pg.h:866
int(* nxo_tioreq_map)(struct nw_xfer_request *xfer, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt, struct target_ioreq **tio)
int(* iro_dgmode_write)(struct m0_op_io *ioo, bool rmw)
Definition: pg.h:655
void(* nxo_complete)(struct nw_xfer_request *xfer, bool rmw)
int(* pi_dgmode_recover)(struct pargrp_iomap *map)
enum target_ioreq_type ti_req_type
struct m0_indexvec_varr ti_bufvec
int(* pi_parity_replica_verify)(struct pargrp_iomap *map)
Definition: pg.h:509
struct m0_indexvec ti_trunc_ivec
Definition: pg.h:799
uint64_t m0_bindex_t
Definition: types.h:80
uint64_t ti_obj
int(* pi_dgmode_process)(struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
uint64_t m0_bcount_t
Definition: types.h:77
Definition: sm.h:504
int(* iro_replica_rectify)(struct m0_op_io *ioo, bool rmw)
Definition: pg.h:661
struct m0_indexvec pi_ivec
Definition: pg.h:340
static m0_bcount_t count
Definition: xcode.c:167
uint64_t ti_magic
int(* pi_readold_auxbuf_alloc)(struct pargrp_iomap *map)
int(* pi_seg_process)(struct pargrp_iomap *map, uint64_t segid, bool rmw)
struct target_ioreq * dr_tioreq
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)
Definition: pg.h:583
uint64_t irf_magic
Definition: pg.h:860
Definition: pg.h:56
int(* pi_replica_recover)(struct pargrp_iomap *map)
Definition: pg.h:556
Definition: buf.h:37
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
void(* iro_iosm_handle_executed)(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: pg.h:622
enum page_attr db_flags
enum page_attr * ti_pageattrs
Definition: pg.h:833
int(* nxo_distribute)(struct nw_xfer_request *xfer)
uint64_t ti_parbytes
int(* pi_populate)(struct pargrp_iomap *iomap, struct m0_ivec_varr_cursor *cursor)
Definition: pg.h:151
int(* tio_cc_fops_prepare)(struct target_ioreq *ti)
Definition: pg.h:735
Definition: pg.h:148
int irf_reply_rc
Definition: pg.h:863
enum pargrp_iomap_state pi_state
void(* tio_seg_add)(struct target_ioreq *ti, const struct m0_pdclust_src_addr *src, const struct m0_pdclust_tgt_addr *tgt, m0_bindex_t gob_offset, m0_bcount_t count, struct pargrp_iomap *map)
uint32_t * ti_cksum_seg_b_nob
Definition: pg.h:814
struct m0_buf db_buf
uint64_t db_crc
Definition: pg.h:209
m0_pool_nd_state
Definition: pool_machine.h:57
const struct nw_xfer_ops * nxr_ops
Definition: tlist.h:251
struct m0_atomic64 nxr_ccfop_nr
struct m0_hlink ti_link
uint64_t pi_grpid
Definition: pg.h:103
void(* iro_iomaps_destroy)(struct m0_op_io *ioo)
Definition: pg.h:574
enum pargrp_iomap_rmwtype pi_rtype
target_ioreq_type
int(* pi_dgmode_postprocess)(struct pargrp_iomap *map)
struct m0_sm_ast irf_ast
Definition: pg.h:872
int(* pi_parity_verify)(struct pargrp_iomap *map)
struct m0_indexvec_varr dr_bufvec
struct m0_htable nxr_tioreqs_hash
struct m0_rpc_session * ti_session
ioreq_state
Definition: pg.h:53
struct m0_tl ti_iofops
bool pi_trunc_partial
Definition: pg.h:400
const struct target_ioreq_ops * ti_ops
pargrp_iomap_rmwtype
copy_direction
Definition: pg.h:65
uint64_t ti_databytes
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
int(* pi_databuf_alloc)(struct pargrp_iomap *map, uint32_t row, uint32_t col, struct m0_bufvec_cursor *buf_cursor)
Definition: pg.h:485
struct m0_op_io * pi_ioo
Definition: pg.h:394
struct target_ioreq * irf_tioreq
Definition: pg.h:881
m0_bcount_t ti_cksum_copied
Definition: pg.h:811
Definition: fid.h:38
uint32_t pi_max_row
Definition: pg.h:372
struct m0_fid ti_fid
enum page_attr * dr_pageattrs
Definition: pg.h:710
struct cc_req_fop ti_cc_fop
int(* nxo_dispatch)(struct nw_xfer_request *xfer)
struct m0_mutex nxr_lock
uint64_t(* pi_fullpages_find)(struct pargrp_iomap *map)
m0_bindex_t ti_goff
Definition: pg.h:785
struct m0_bufvec dr_auxbufvec
Definition: pg.h:707
enum nw_xfer_state nxr_state
Definition: pg.h:57
int(* iro_dgmode_recover)(struct m0_op_io *ioo)
Definition: pg.h:643
page_attr
struct data_buf *** pi_databufs
struct m0_indexvec dr_ivec
Definition: pg.h:700
Definition: pg.h:140
struct m0_atomic64 nxr_iofop_nr
int(* iro_iomaps_prepare)(struct m0_op_io *ioo)
Definition: pg.h:567
struct target_ioreq * crf_tioreq
int(* pi_parity_recalc)(struct pargrp_iomap *map)
bool pi_is_corrupted
Definition: pg.h:405
struct inode * dir
Definition: dir.c:1028
def filter(argv)
Definition: filter.py:27
struct nw_xfer_request * ti_nwxfer
Definition: pg.h:149
Definition: pg.h:859
int(* pi_data_replicate)(struct pargrp_iomap *map)
Definition: pg.h:515
struct target_ioreq * db_tioreq
struct m0_indexvec ti_goff_ivec
Definition: pg.h:820
struct m0_bufvec ti_auxbufvec
Definition: pg.h:807
enum page_attr irf_pattr
Definition: pg.h:869
Definition: mutex.h:47
struct m0_pdclust_src_addr src
Definition: fd.c:108
struct dgmode_rwvec * ti_dgvec
Definition: pg.h:74
const struct pargrp_iomap_ops * pi_ops
struct m0_indexvec ti_ivec
Definition: pg.h:793
Definition: pg.h:100
uint32_t pi_max_col
Definition: pg.h:378
int(* tio_iofops_prepare)(struct target_ioreq *ti, enum page_attr filter)
Definition: fop.h:79
m0_time_t ti_start_time
Definition: pg.h:759
Definition: vec.h:145
uint64_t db_magic
Definition: pg.h:132