Motr  M0
io_dummy.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 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 #include "layout/layout.h"
24 
25 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT
26 #include "lib/trace.h" /* M0_LOG */
27 
28 #include "ut/ut.h" /* M0_UT_ASSERT */
29 #include "motr/ut/client.h"
30 #include "motr/client_internal.h"
31 #include "motr/pg.h"
32 #include "motr/io.h"
33 
34 #define DUMMY_PTR 0xdeafdead
35 
36 #define UT_DEFAULT_BLOCK_SHIFT M0_DEFAULT_BUF_SHIFT
37 #define UT_DEFAULT_BLOCK_SIZE (1ULL << M0_DEFAULT_BUF_SHIFT)
38 
39 static const struct m0_bob_type layout_instance_bob = {
40  .bt_name = "layout_instance",
41  .bt_magix_offset = offsetof(struct m0_layout_instance, li_magic),
42  .bt_magix = M0_LAYOUT_INSTANCE_MAGIC,
43  .bt_check = NULL
44 };
46 
47 static const struct m0_bob_type pdclust_instance_bob = {
48  .bt_name = "pd_instance",
49  .bt_magix_offset = offsetof(struct m0_pdclust_instance, pi_magic),
51  .bt_check = NULL
52 };
53 
55 
56 static const struct m0_bob_type pdclust_bob = {
57  .bt_name = "pdclust",
58  .bt_magix_offset = offsetof(struct m0_pdclust_layout , pl_magic),
59  .bt_magix = M0_LAYOUT_PDCLUST_MAGIC,
60  .bt_check = NULL
61 };
63 
64 M0_INTERNAL struct m0_obj *ut_dummy_obj_create(void)
65 {
66  struct m0_obj *ret;
67  M0_ALLOC_PTR(ret);
69  ret->ob_attr.oa_layout_id = M0_DEFAULT_LAYOUT_ID;
70  return ret;
71 }
72 
73 M0_INTERNAL void ut_dummy_obj_delete(struct m0_obj *obj)
74 {
75  m0_free(obj);
76 }
77 
78 M0_INTERNAL struct m0_pdclust_layout *
80 {
81  struct m0_pdclust_layout *pl;
82 
83  M0_ALLOC_PTR(pl);
84  m0_pdclust_layout_bob_init(pl);
85  ut_striped_layout_init(&pl->pl_base, &instance->m0c_reqh.rh_ldom);
86 
87  /* pointless but required by the compiler */
88  m0_pdclust_layout_bob_check(pl);
89 
90  /*
91  * non-sense values, but they make it work
92  * invariant check is:
93  * pl->pl_C * (attr.pa_N + attr.pa_K + attr.pa_S) == pl->pl_L * attr.pa_P
94  */
95  /* these values were extracted from m0t1fs */
96  pl->pl_C = 1;
97  pl->pl_L = 1;
103 
104  return pl;
105 }
106 
107 M0_INTERNAL void
109  struct m0_client *instance)
110 {
111  m0_pdclust_layout_bob_fini(pl);
113  &instance->m0c_reqh.rh_ldom);
114  m0_free(pl);
115 }
116 
117 M0_INTERNAL struct m0_pdclust_instance *
119 {
120  int i;
121  struct m0_pdclust_instance *pdi;
122 
123  M0_ALLOC_PTR(pdi);
124  pdi->pi_base.li_l = &pdl->pl_base.sl_base;
125  m0_pdclust_instance_bob_init(pdi);
126 
127  /* pointless but required by the compiler. */
128  m0_pdclust_instance_bob_check(pdi);
129 
130  /* Init the layout_instance part. */
131  m0_layout_instance_bob_init(&pdi->pi_base);
132  /* Make the compiler quiet. */
133  m0_layout_instance_bob_check(&pdi->pi_base);
134  m0_fid_gob_make(&pdi->pi_base.li_gfid, 0, 1);
136 
137  /* tc */
141 
142  for (i = 0; i < pdl->pl_attr.pa_P; i++) {
143  /*
144  * These aren't valid values - but they keep the invariant
145  * check happy
146  */
147  pdi->pi_tile_cache.tc_lcode[i] = 0;
148 
149  /* tc->tc_permute[tc->tc_inverse[N]] = N */
150  pdi->pi_tile_cache.tc_permute[i] = i;
151  pdi->pi_tile_cache.tc_inverse[i] = i;
152  }
153 
154  return pdi;
155 }
156 
157 M0_INTERNAL void
159 {
163 
164  /* Fini the layout_instance part */
165  m0_layout_instance_bob_fini(&pdi->pi_base);
166 
167  m0_pdclust_instance_bob_fini(pdi);
168  m0_free(pdi);
169 }
170 
171 M0_INTERNAL void ut_dummy_xfer_req_init(struct nw_xfer_request *xfer)
172 {
173  nw_xfer_request_bob_init(xfer);
175  /*M0_ALLOC_PTR(xfer->nxr_ops);*/
176 }
177 
178 M0_INTERNAL struct nw_xfer_request *ut_dummy_xfer_req_create(void)
179 {
180  struct nw_xfer_request *xfer;
181  M0_ALLOC_PTR(xfer);
182  M0_UT_ASSERT(xfer != NULL);
184  return xfer;
185 }
186 
187 M0_INTERNAL void ut_dummy_xfer_req_fini(struct nw_xfer_request *xfer)
188 {
189  /*m0_free((void *)xfer->nxr_ops);*/
190  nw_xfer_request_bob_fini(xfer);
191 }
192 
193 M0_INTERNAL void ut_dummy_xfer_req_delete(struct nw_xfer_request *xfer)
194 {
196  m0_free(xfer);
197 }
198 
199 M0_INTERNAL struct data_buf *
201 {
202  struct data_buf *ret;
203  M0_ALLOC_PTR(ret);
204  data_buf_bob_init(ret);
205  ret->db_buf.b_addr = NULL;
206  return ret;
207 }
208 
209 M0_INTERNAL void ut_dummy_data_buf_delete(struct data_buf *db)
210 {
211  data_buf_bob_fini(db);
212  m0_free(db);
213 }
214 
215 M0_INTERNAL void ut_dummy_data_buf_init(struct data_buf *db)
216 {
217  void *data;
218  size_t data_len;
219 
220  M0_UT_ASSERT(db != NULL);
221 
222  data_len = UT_DEFAULT_BLOCK_SIZE;
223  data = m0_alloc_aligned(data_len,
225  M0_UT_ASSERT(data != NULL);
226 
227  data_buf_bob_init(db);
228  m0_buf_init(&db->db_buf, data, data_len);
229  db->db_flags = PA_NONE;
230 }
231 
232 M0_INTERNAL void ut_dummy_data_buf_fini(struct data_buf *db)
233 {
234  M0_UT_ASSERT(db != NULL);
235 
236  data_buf_bob_fini(db);
237 
238  /*
239  * We can't use m0_buf_free, because we allocated
240  * an aligned buffer...
241  */
245 }
246 
247 /*
248  * @param do_alloc: a flag to control whether we allocate and initialise
249  * for data buf structure.
250  */
251 M0_INTERNAL void ut_dummy_paritybufs_create(struct pargrp_iomap *map,
252  bool do_alloc)
253 {
254  int i;
255  int j;
256 
257  /*
258  * Why put the following code in dummy_ioo_xxx? Not all unit tests
259  * need pre-allocated parity buffers as paritybufs_alloc
260  */
261  M0_ALLOC_ARR(map->pi_paritybufs, map->pi_max_row);
262  M0_UT_ASSERT(map->pi_paritybufs != NULL);
263  for (i = 0; i < map->pi_max_row; i++) {
264  M0_ALLOC_ARR(map->pi_paritybufs[i], M0T1FS_LAYOUT_K);
265  M0_UT_ASSERT(map->pi_paritybufs[i] != NULL);
266  }
267 
268  if (do_alloc == false)
269  return;
270 
271  for (i = 0; i < map->pi_max_row; i++) {
272  for (j = 0; j < M0T1FS_LAYOUT_K; j++) {
273  M0_ALLOC_PTR(map->pi_paritybufs[i][j]);
274  M0_UT_ASSERT(map->pi_paritybufs[i][j] != NULL);
275 
276  ut_dummy_data_buf_init(map->pi_paritybufs[i][j]);
277  }
278  }
279 }
280 
281 M0_INTERNAL void ut_dummy_paritybufs_delete(struct pargrp_iomap *map,
282  bool do_free)
283 {
284  int i;
285  int j;
286 
287  for (i = 0; i < map->pi_max_row; i++) {
288  for (j = 0; j < M0T1FS_LAYOUT_K && do_free == true; j++) {
289  ut_dummy_data_buf_fini(map->pi_paritybufs[i][j]);
290 
291  m0_free(map->pi_paritybufs[i][j]);
292 
293  }
294  m0_free(map->pi_paritybufs[i]);
295  }
296  m0_free(map->pi_paritybufs);
297 
298 }
299 
300 M0_INTERNAL struct pargrp_iomap *
302 {
303  int r, c;
304  int rc;
305  struct pargrp_iomap *ret;
306 
307  M0_UT_ASSERT(num_blocks <= M0T1FS_LAYOUT_N);
308 
309  M0_ALLOC_PTR(ret);
310  M0_UT_ASSERT(ret != NULL);
311  pargrp_iomap_bob_init(ret);
312  ret->pi_ops = (struct pargrp_iomap_ops *)DUMMY_PTR;
313 
315  ret->pi_max_row = 1;
317 
318  for (r = 0; r < ret->pi_max_row; r++) {
320  M0_UT_ASSERT(ret->pi_databufs[r] != NULL);
321 
322  for (c = 0; c < ret->pi_max_col; c++) {
323  M0_ALLOC_PTR(ret->pi_databufs[r][c]);
324  M0_UT_ASSERT(ret->pi_databufs[r][c] != NULL);
325 
327  }
328  }
329 
330  ret->pi_ioo = (struct m0_op_io *)DUMMY_PTR;
331 
332  rc = m0_indexvec_alloc(&ret->pi_ivec, 1);
333  M0_UT_ASSERT(rc == 0);
334  ret->pi_ivec.iv_vec.v_count[0] = num_blocks * UT_DEFAULT_BLOCK_SIZE;
335 
336  return ret;
337 }
338 
339 M0_INTERNAL void
341  struct m0_client *instance)
342 {
343  int r, c;
344 
345  m0_indexvec_free(&map->pi_ivec);
346 
347  for (r = 0; r < map->pi_max_row; r++) {
348  for (c = 0; c < map->pi_max_col; c++) {
349  ut_dummy_data_buf_fini(map->pi_databufs[r][c]);
350 
351  m0_free(map->pi_databufs[r][c]);
352 
353  }
354  m0_free(map->pi_databufs[r]);
355  }
356  m0_free(map->pi_databufs);
357 
358  pargrp_iomap_bob_fini(map);
359  m0_free(map);
360 }
361 
362 #ifndef __KERNEL__
363 #include <stdlib.h>
364 #endif
365 M0_INTERNAL struct m0_op_io *
366 ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
367 {
368  int i;
369  int rc;
370  uint64_t layout_id;
371  struct m0_layout *layout;
372  struct m0_pdclust_layout *pl;
373  struct m0_pdclust_instance *pdi;
374  struct m0_op_io *ioo;
375  struct m0_pool_version *pv;
376 
377  M0_ALLOC_PTR(ioo);
378  M0_UT_ASSERT(ioo != NULL);
379 
380  m0_op_io_bob_init(ioo);
381  m0_op_obj_bob_init(&ioo->ioo_oo);
382  m0_op_common_bob_init(&ioo->ioo_oo.oo_oc);
383  m0_op_bob_init(&ioo->ioo_oo.oo_oc.oc_op);
384 
385  ioo->ioo_oo.oo_oc.oc_op.op_size = sizeof(*ioo);
387 
388  /* Create parity layout and instance */
389  pv = instance->m0c_pools_common.pc_cur_pver;
390  layout_id = m0_pool_version2layout_id(&pv->pv_id, M0_DEFAULT_LAYOUT_ID);
391  layout = m0_layout_find(&instance->m0c_reqh.rh_ldom, layout_id);
392  M0_UT_ASSERT(layout != NULL);
393  pl = m0_layout_to_pdl(layout);
395  pdi->pi_base.li_l = &pl->pl_base.sl_base;
396  pdi->pi_base.li_l->l_pver = instance->m0c_pools_common.pc_cur_pver;
397  ioo->ioo_oo.oo_layout_instance = &pdi->pi_base;
398 
399  /* Set entity */
400  ioo->ioo_obj = ut_dummy_obj_create();
402  ioo->ioo_obj->ob_attr.oa_layout_id = M0_DEFAULT_LAYOUT_ID;
403 
404  /* IO extends */
405  rc = m0_indexvec_alloc(&ioo->ioo_ext, 1);
406  M0_UT_ASSERT(rc == 0);
407  ioo->ioo_ext.iv_index[0] = 0;
409 
410  ioo->ioo_data.ov_vec.v_nr = 1;
413  M0_ALLOC_ARR(ioo->ioo_data.ov_buf, 1);
414  M0_ALLOC_ARR(ioo->ioo_data.ov_buf[0], 1);
415 
416  M0_SET0(&ioo->ioo_attr);
417 
418  /* failed sessions*/
420  ioo->ioo_failed_session[0] = ~(uint64_t)0;
421 
423  ioo->ioo_failed_nodes[0] = ~(uint64_t)0;
424 
425  /* fid */
426  //m0_fid_set(&ioo->ioo_oo.oo_fid, 0, 1);
427  m0_fid_gob_make(&ioo->ioo_oo.oo_fid, 0, 1);
428 
429  m0_sm_init(&ioo->ioo_sm, &io_sm_conf, IRS_INITIALIZED, &instance->m0c_sm_group);
430 
432 
433  /* IO parity group map */
434  M0_ALLOC_ARR(ioo->ioo_iomaps, num_io_maps);
435  M0_UT_ASSERT(ioo->ioo_iomaps != NULL);
436  ioo->ioo_iomap_nr = num_io_maps;
437  for (i = 0; i < ioo->ioo_iomap_nr; i++) {
438  ioo->ioo_iomaps[i] =
441  ioo->ioo_iomaps[i]->pi_grpid = i;
442  ioo->ioo_iomaps[i]->pi_ioo = ioo;
443  }
444 
445  /* SM group */
448 
449  return ioo;
450 }
451 
455 M0_INTERNAL struct m0_pdclust_layout *
457 {
458  return bob_of(ioo->ioo_oo.oo_layout_instance->li_l,
459  struct m0_pdclust_layout ,
461 }
462 
463 M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo,
464  struct m0_client *instance)
465 {
466  int i;
467  /*struct m0_pdclust_layout *pl;*/
468  struct m0_layout_instance *li;
469  struct m0_pdclust_instance *pdi;
470 
472  m0_free(ioo->ioo_oo.oo_sm_grp);
473 
474  if (ioo->ioo_iomaps != NULL) {
475  for (i = 0; i < ioo->ioo_iomap_nr; i++) {
477  ioo->ioo_iomaps[i], instance);
478  }
479  m0_free0(&ioo->ioo_iomaps);
480  }
481 
483 
484  m0_sm_group_lock(&instance->m0c_sm_group);
486  m0_sm_fini(&ioo->ioo_sm);
487  m0_sm_group_unlock(&instance->m0c_sm_group);
488 
491  m0_free(ioo->ioo_data.ov_buf[0]);
492  m0_free(ioo->ioo_data.ov_buf);
494  m0_indexvec_free(&ioo->ioo_ext);
496 
497  li = ioo->ioo_oo.oo_layout_instance;
498  pdi = bob_of(li, struct m0_pdclust_instance, pi_base,
501 #if 0
504 #endif
505  m0_free(ioo);
506 }
507 
509 {
510 }
511 
512 M0_INTERNAL struct ioreq_fop *ut_dummy_ioreq_fop_create(void)
513 {
514  struct ioreq_fop *ret;
515 
516  M0_ALLOC_PTR(ret);
518  ioreq_fop_bob_init(ret);
519  ret->irf_tioreq = (struct target_ioreq *)DUMMY_PTR;
521  ret->irf_ast.sa_mach = (struct m0_sm *)DUMMY_PTR;
522 
523  return ret;
524 }
525 
526 M0_INTERNAL void ut_dummy_ioreq_fop_delete(struct ioreq_fop *fop)
527 {
528  ioreq_fop_bob_fini(fop);
529  m0_free(fop);
530 }
531 
533 {
534  struct target_ioreq *ti;
535 
536  M0_ALLOC_PTR(ti);
537  target_ioreq_bob_init(ti);
539  ti->ti_session->s_session_id = ~(uint64_t)0;
540  ti->ti_nwxfer = (struct nw_xfer_request *)DUMMY_PTR;
541  ti->ti_bufvec.ov_buf = (void **)DUMMY_PTR;
542  ti->ti_auxbufvec.ov_buf = (void **)DUMMY_PTR;
543  ti->ti_ivec.iv_index = (void *)DUMMY_PTR;
544  ti->ti_goff_ivec.iv_index = (void *)DUMMY_PTR;
545  m0_fid_set(&ti->ti_fid, 0, 1);
546  iofops_tlist_init(&ti->ti_iofops);
547  tioreqht_tlink_init(ti);
548 
549  return ti;
550 }
551 
552 M0_INTERNAL void ut_dummy_target_ioreq_delete(struct target_ioreq *ti)
553 {
554  M0_UT_ASSERT(iofops_tlist_is_empty(&ti->ti_iofops));
555 
556  m0_free(ti->ti_session);
557  tioreqht_tlink_fini(ti);
558  iofops_tlist_fini(&ti->ti_iofops);
559  target_ioreq_bob_fini(ti);
560  m0_free(ti);
561 }
562 
564 {
565  uint32_t i;
566  int rc = 0;
567  struct m0_poolmach *pm;
568  struct m0_poolmach_state *state;
569 
570  M0_UT_ASSERT(pv != NULL);
571 
572  pm = &pv->pv_mach;
573  M0_SET0(pm);
574  m0_rwlock_init(&pm->pm_lock);
575 
576  /* This is On client. */
577  M0_ALLOC_PTR(state);
578  if (state == NULL)
579  return -ENOMEM;
580 
581  state->pst_nr_nodes = 5; //nr_nodes;
582  /* nr_devices io devices and 1 md device. md uses container 0 */
583  state->pst_nr_devices = 5; //nr_devices + 1;
584  state->pst_max_node_failures = 1;
585  state->pst_max_device_failures = 1;
586  state->pst_nr_spares = 1;
587 
588  M0_ALLOC_ARR(state->pst_nodes_array, state->pst_nr_nodes);
590  state->pst_nr_devices);
592  state->pst_nr_spares);
593  if (state->pst_nodes_array == NULL ||
594  state->pst_devices_array == NULL ||
595  state->pst_spare_usage_array == NULL) {
596  /* m0_free(NULL) is valid */
597  m0_free(state->pst_nodes_array);
598  m0_free(state->pst_devices_array);
600  m0_free(state);
601  return -ENOMEM;
602  }
603 
604  for (i = 0; i < state->pst_nr_nodes; i++) {
605  state->pst_nodes_array[i].pn_state = M0_PNDS_ONLINE;
606  M0_SET0(&state->pst_nodes_array[i].pn_id);
607  }
608 
609  for (i = 0; i < state->pst_nr_devices; i++) {
610  state->pst_devices_array[i].pd_state = M0_PNDS_ONLINE;
611  M0_SET0(&state->pst_nodes_array[i].pn_id);
612  state->pst_devices_array[i].pd_node = &state->pst_nodes_array[i];
613  }
614 
615  for (i = 0; i < state->pst_nr_spares; i++) {
616  /* -1 means that this spare slot is not used */
619  }
620  //poolmach_events_tlist_init(&state->pst_events_list);
621  pm->pm_state = state;
622 
623  pm->pm_is_initialised = true;
624 
625  return rc;
626 }
627 
628 M0_INTERNAL void ut_dummy_poolmach_delete(struct m0_pool_version *pv)
629 {
630  struct m0_poolmach *pm;
631  struct m0_poolmach_state *state;
632 
633  if (pv == NULL || pv->pv_mach.pm_state == NULL)
634  return;
635 
636  pm = &pv->pv_mach;
637  state = pm->pm_state;
638 
640  m0_free(state->pst_devices_array);
641  m0_free(state->pst_nodes_array);
642  m0_free0(&pm->pm_state);
643 
644  pm->pm_is_initialised = false;
645  m0_rwlock_fini(&pm->pm_lock);
646 }
647 
653 {
654  return 0;
655 }
656 
658  struct target_ioreq *tio,
660  uint32_t count)
661 {
662  return 0;
663 }
664 
666 {
667  return 0;
668 }
669 
672  .pi_dgmode_process = mock_pargrp_iomap_dgmode_process,
673  .pi_dgmode_recover = mock_pargrp_iomap_dgmode_recover,
674 };
675 
676 #undef M0_TRACE_SUBSYSTEM
677 
678 /*
679  * Local variables:
680  * c-indentation-style: "K&R"
681  * c-basic-offset: 8
682  * tab-width: 8
683  * fill-column: 80
684  * scroll-step: 1
685  * End:
686  */
M0_INTERNAL struct m0_layout * m0_layout_find(struct m0_layout_domain *dom, uint64_t lid)
Definition: layout.c:861
struct m0_poolmach_state * pm_state
Definition: pool_machine.h:169
static const struct m0_bob_type pdclust_bob
Definition: io_dummy.c:56
M0_INTERNAL struct m0_pdclust_instance * ut_dummy_pdclust_instance_create(struct m0_pdclust_layout *pdl)
Definition: io_dummy.c:118
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
M0_INTERNAL void ut_dummy_pdclust_instance_delete(struct m0_pdclust_instance *pdi)
Definition: io_dummy.c:158
M0_INTERNAL void m0_fid_gob_make(struct m0_fid *gob_fid, uint32_t container, uint64_t key)
Definition: fid_convert.c:46
Definition: client.h:788
M0_INTERNAL int m0_indexvec_alloc(struct m0_indexvec *ivec, uint32_t len)
Definition: vec.c:532
struct m0_layout * li_l
Definition: layout.h:590
#define M0T1FS_LAYOUT_S
Definition: client.h:64
#define NULL
Definition: misc.h:38
uint32_t pst_nr_devices
Definition: pool_machine.h:108
map
Definition: processor.c:112
uint64_t pa_unit_size
Definition: pdclust.h:118
struct m0_pool_version * l_pver
Definition: layout.h:261
uint64_t * ioo_failed_nodes
static int mock_pargrp_iomap_parity_recalc(struct pargrp_iomap *map)
Definition: io_dummy.c:652
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
Definition: sm.h:506
void * b_addr
Definition: buf.h:39
uint32_t pa_N
Definition: pdclust.h:104
static struct m0_sm_group * grp
Definition: bytecount.c:38
struct m0_pool_version * pv
Definition: dir.c:629
struct m0_poolmach pv_mach
Definition: pool.h:133
M0_INTERNAL void ut_dummy_target_ioreq_delete(struct target_ioreq *ti)
Definition: io_dummy.c:552
const struct pargrp_iomap_ops mock_iomap_ops
Definition: io_dummy.c:670
M0_INTERNAL struct m0_obj * ut_dummy_obj_create(void)
Definition: io_dummy.c:64
#define M0T1FS_LAYOUT_P
Definition: client.h:61
struct m0_sm_group * oo_sm_grp
M0_INTERNAL void ut_dummy_data_buf_delete(struct data_buf *db)
Definition: io_dummy.c:209
struct m0_layout_instance pi_base
Definition: pdclust.h:173
uint32_t pa_K
Definition: pdclust.h:107
struct m0_vec ov_vec
Definition: vec.h:147
static int mock_pargrp_iomap_dgmode_process(struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
Definition: io_dummy.c:657
M0_INTERNAL void ut_striped_layout_init(struct m0_striped_layout *stl, struct m0_layout_domain *dom)
Definition: obj.c:180
M0_INTERNAL void m0_buf_init(struct m0_buf *buf, void *data, uint32_t nob)
Definition: buf.c:37
struct m0_bufvec data
Definition: di.c:40
#define UT_DEFAULT_BLOCK_SIZE
Definition: io_dummy.c:37
struct m0_sm_conf io_sm_conf
Definition: io_req.c:141
struct m0_indexvec_varr ti_bufvec
struct m0_op oc_op
M0_INTERNAL void ut_dummy_pargrp_iomap_delete(struct pargrp_iomap *map, struct m0_client *instance)
Definition: io_dummy.c:340
M0_INTERNAL void ut_dummy_xfer_req_fini(struct nw_xfer_request *xfer)
Definition: io_dummy.c:187
M0_INTERNAL struct data_buf * ut_dummy_data_buf_create(void)
Definition: io_dummy.c:200
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
Definition: vec.c:553
M0_INTERNAL void m0_free_aligned(void *data, size_t size, unsigned shift)
Definition: memory.c:192
static struct m0_bob_type iofop_bobtype
Definition: file.c:339
struct m0_poolnode * pst_nodes_array
Definition: pool_machine.h:105
uint64_t m0_bindex_t
Definition: types.h:80
uint32_t pa_S
Definition: pdclust.h:110
Definition: sm.h:504
struct m0_sm * sa_mach
Definition: sm.h:510
#define M0_SET0(obj)
Definition: misc.h:64
M0_INTERNAL void ut_dummy_data_buf_fini(struct data_buf *db)
Definition: io_dummy.c:232
M0_INTERNAL void ut_dummy_pdclust_layout_delete(struct m0_pdclust_layout *pl, struct m0_client *instance)
Definition: io_dummy.c:108
M0_INTERNAL void ut_striped_layout_fini(struct m0_striped_layout *stl, struct m0_layout_domain *dom)
Definition: obj.c:202
struct m0_pdclust_attr pl_attr
Definition: pdclust.h:150
uint32_t pl_C
Definition: pdclust.h:155
void ** ov_buf
Definition: vec.h:149
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
Definition: sm.c:65
static struct foo * obj
Definition: tlist.c:302
const char * bt_name
Definition: bob.h:73
struct m0_indexvec pi_ivec
Definition: pg.h:340
static m0_bcount_t count
Definition: xcode.c:167
struct m0_sm ioo_sm
M0_INTERNAL void m0_rwlock_init(struct m0_rwlock *lock)
Definition: rwlock.c:32
struct m0_pooldev * pst_devices_array
Definition: pool_machine.h:111
struct m0_vec iv_vec
Definition: vec.h:139
unsigned int op_code
Definition: client.h:650
static const struct m0_bob_type layout_instance_bob
Definition: io_dummy.c:39
M0_INTERNAL void ut_dummy_paritybufs_delete(struct pargrp_iomap *map, bool do_free)
Definition: io_dummy.c:281
static struct m0_sm_ast ast[NR]
Definition: locality.c:44
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
Definition: sm.c:96
m0_bindex_t * iv_index
Definition: vec.h:141
uint64_t * ioo_failed_session
int i
Definition: dir.c:1033
size_t op_size
Definition: client.h:664
enum page_attr db_flags
M0_INTERNAL void ut_dummy_xfer_req_delete(struct nw_xfer_request *xfer)
Definition: io_dummy.c:193
struct m0_poolnode * pd_node
Definition: pool.h:440
uint32_t pst_nr_spares
Definition: pool_machine.h:120
struct nw_xfer_request ioo_nwxfer
M0_INTERNAL void m0_fid_set(struct m0_fid *fid, uint64_t container, uint64_t key)
Definition: fid.c:116
struct m0_op_obj ioo_oo
M0_INTERNAL void ut_dummy_data_buf_init(struct data_buf *db)
Definition: io_dummy.c:215
M0_INTERNAL void ut_dummy_xfer_req_init(struct nw_xfer_request *xfer)
Definition: io_dummy.c:171
M0_INTERNAL uint64_t m0_pool_version2layout_id(const struct m0_fid *pv_fid, uint64_t lid)
Definition: pool.c:1900
struct m0_indexvec ioo_ext
struct m0_fid pv_id
Definition: pool.h:113
struct m0_striped_layout pl_base
Definition: pdclust.h:148
#define m0_free0(pptr)
Definition: memory.h:77
void dummy_ioreq_fop_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
Definition: io_dummy.c:508
struct m0_buf db_buf
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
Definition: sm.c:53
static struct m0_addb2_callback c
Definition: consumer.c:41
#define bob_of(ptr, type, field, bt)
Definition: bob.h:140
struct m0_bufvec ioo_data
#define DUMMY_PTR
Definition: io_dummy.c:34
uint64_t pi_grpid
struct m0_obj * ioo_obj
m0_bcount_t oa_bshift
Definition: client.h:749
int layout_id
Definition: dir.c:331
M0_INTERNAL struct m0_pdclust_layout * m0_layout_to_pdl(const struct m0_layout *l)
Definition: pdclust.c:382
M0_INTERNAL void ut_dummy_paritybufs_create(struct pargrp_iomap *map, bool do_alloc)
Definition: io_dummy.c:251
M0_INTERNAL struct target_ioreq * ut_dummy_target_ioreq_create(void)
Definition: io_dummy.c:532
M0_INTERNAL struct m0_pdclust_layout * ut_get_pdclust_layout_from_ioo(struct m0_op_io *ioo)
Definition: io_dummy.c:456
struct m0_fid oo_fid
M0_INTERNAL struct ioreq_fop * ut_dummy_ioreq_fop_create(void)
Definition: io_dummy.c:512
uint32_t v_nr
Definition: vec.h:51
struct m0_sm_ast irf_ast
Definition: pg.h:872
#define UT_DEFAULT_BLOCK_SHIFT
Definition: io_dummy.c:36
m0_bcount_t * v_count
Definition: vec.h:53
struct m0_rpc_session * ti_session
struct m0_tl ti_iofops
struct m0_op_common oo_oc
struct m0_pdclust_instance::tile_cache pi_tile_cache
uint32_t pl_L
Definition: pdclust.h:160
struct m0_fid li_gfid
Definition: layout.h:587
static int mock_pargrp_iomap_dgmode_recover(struct pargrp_iomap *map)
Definition: io_dummy.c:665
M0_INTERNAL void ut_dummy_obj_delete(struct m0_obj *obj)
Definition: io_dummy.c:73
uint32_t pst_max_node_failures
Definition: pool_machine.h:117
struct m0_op_io * pi_ioo
Definition: pg.h:394
struct target_ioreq * irf_tioreq
Definition: pg.h:881
const struct m0_layout_instance_ops * li_ops
Definition: layout.h:593
uint32_t pi_max_row
Definition: pg.h:372
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
Definition: sm.c:313
struct m0_fid ti_fid
M0_INTERNAL struct m0_pdclust_layout * ut_dummy_pdclust_layout_create(struct m0_client *instance)
Definition: io_dummy.c:79
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
struct m0_entity * op_entity
Definition: client.h:660
static int r[NR]
Definition: thread.c:46
M0_INTERNAL struct pargrp_iomap * ut_dummy_pargrp_iomap_create(struct m0_client *instance, int num_blocks)
Definition: io_dummy.c:301
enum nw_xfer_state nxr_state
uint32_t pa_P
Definition: pdclust.h:115
Definition: sm.h:301
M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo, struct m0_client *instance)
Definition: io_dummy.c:463
#define M0T1FS_LAYOUT_K
Definition: client.h:63
struct m0_entity ob_entity
Definition: client.h:789
struct m0_fid pn_id
Definition: pool.h:395
M0_BOB_DEFINE(static, &layout_instance_bob, m0_layout_instance)
M0_INTERNAL void m0_sm_move(struct m0_sm *mach, int32_t rc, int state)
Definition: sm.c:485
struct data_buf *** pi_databufs
struct m0_layout sl_base
Definition: layout.h:574
uint32_t psu_device_index
Definition: pool.h:480
uint32_t pst_max_device_failures
Definition: pool_machine.h:126
static struct m0_fop * fop
Definition: item.c:57
bool pm_is_initialised
Definition: pool_machine.h:175
M0_INTERNAL void m0_rwlock_fini(struct m0_rwlock *lock)
Definition: rwlock.c:37
static struct m0 instance
Definition: main.c:78
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
Definition: sm.c:83
M0_INTERNAL int ut_dummy_poolmach_create(struct m0_pool_version *pv)
Definition: io_dummy.c:563
M0_INTERNAL struct m0_op_io * ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
Definition: io_dummy.c:366
int(* pi_parity_recalc)(struct pargrp_iomap *map)
uint64_t ioo_iomap_nr
M0_INTERNAL struct nw_xfer_request * ut_dummy_xfer_req_create(void)
Definition: io_dummy.c:178
struct m0_rwlock pm_lock
Definition: pool_machine.h:178
struct nw_xfer_request * ti_nwxfer
uint32_t pst_nr_nodes
Definition: pool_machine.h:102
#define M0T1FS_LAYOUT_N
Definition: client.h:62
M0_INTERNAL void ut_dummy_ioreq_fop_delete(struct ioreq_fop *fop)
Definition: io_dummy.c:526
uint64_t oa_layout_id
Definition: client.h:752
struct m0_layout_instance * oo_layout_instance
M0_INTERNAL void ut_dummy_poolmach_delete(struct m0_pool_version *pv)
Definition: io_dummy.c:628
M0_INTERNAL void * m0_alloc_aligned(size_t size, unsigned shift)
Definition: memory.c:168
Definition: pg.h:859
struct m0_indexvec ti_goff_ivec
Definition: pg.h:820
struct m0_bufvec ti_auxbufvec
Definition: pg.h:807
uint64_t s_session_id
Definition: session.h:309
void m0_free(void *data)
Definition: memory.c:146
static const struct m0_bob_type pdclust_instance_bob
Definition: io_dummy.c:47
struct m0_bufvec ioo_attr
M0_INTERNAL void m0_bob_type_tlist_init(struct m0_bob_type *bt, const struct m0_tl_descr *td)
Definition: bob.c:41
int32_t rc
Definition: trigger_fop.h:47
struct m0_pool_spare_usage * pst_spare_usage_array
Definition: pool_machine.h:137
const struct pargrp_iomap_ops * pi_ops
struct m0_indexvec ti_ivec
Definition: pg.h:793
#define offsetof(typ, memb)
Definition: misc.h:29
#define M0_UT_ASSERT(a)
Definition: ut.h:46
uint32_t pi_max_col
Definition: pg.h:378
struct m0_obj_attr ob_attr
Definition: client.h:790
struct pargrp_iomap ** ioo_iomaps
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)
Definition: sm.c:331