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_free(struct data_buf *db)
233 {
234  /*
235  * We can't use m0_buf_free, because we allocated an aligned buffer...
236  */
239 }
240 
241 M0_INTERNAL void ut_dummy_data_buf_fini(struct data_buf *db)
242 {
243  M0_UT_ASSERT(db != NULL);
244 
245  data_buf_bob_fini(db);
247 }
248 
249 /*
250  * @param do_alloc: a flag to control whether we allocate and initialise
251  * for data buf structure.
252  */
253 M0_INTERNAL void ut_dummy_paritybufs_create(struct pargrp_iomap *map,
254  bool do_alloc)
255 {
256  int i;
257  int j;
258 
259  /*
260  * Why put the following code in dummy_ioo_xxx? Not all unit tests
261  * need pre-allocated parity buffers as paritybufs_alloc
262  */
263  M0_ALLOC_ARR(map->pi_paritybufs, map->pi_max_row);
264  M0_UT_ASSERT(map->pi_paritybufs != NULL);
265  for (i = 0; i < map->pi_max_row; i++) {
266  M0_ALLOC_ARR(map->pi_paritybufs[i], M0T1FS_LAYOUT_K);
267  M0_UT_ASSERT(map->pi_paritybufs[i] != NULL);
268  }
269 
270  if (do_alloc == false)
271  return;
272 
273  for (i = 0; i < map->pi_max_row; i++) {
274  for (j = 0; j < M0T1FS_LAYOUT_K; j++) {
275  M0_ALLOC_PTR(map->pi_paritybufs[i][j]);
276  M0_UT_ASSERT(map->pi_paritybufs[i][j] != NULL);
277 
278  ut_dummy_data_buf_init(map->pi_paritybufs[i][j]);
279  }
280  }
281 }
282 
283 M0_INTERNAL void ut_dummy_paritybufs_delete(struct pargrp_iomap *map,
284  bool do_free)
285 {
286  int i;
287  int j;
288 
289  for (i = 0; i < map->pi_max_row; i++) {
290  for (j = 0; j < M0T1FS_LAYOUT_K && do_free == true; j++) {
291  ut_dummy_data_buf_fini(map->pi_paritybufs[i][j]);
292 
293  m0_free(map->pi_paritybufs[i][j]);
294 
295  }
296  m0_free(map->pi_paritybufs[i]);
297  }
298  m0_free(map->pi_paritybufs);
299 
300 }
301 
302 M0_INTERNAL struct pargrp_iomap *
304 {
305  int r, c;
306  int rc;
307  struct pargrp_iomap *ret;
308 
309  M0_UT_ASSERT(num_blocks <= M0T1FS_LAYOUT_N);
310 
311  M0_ALLOC_PTR(ret);
312  M0_UT_ASSERT(ret != NULL);
313  pargrp_iomap_bob_init(ret);
314  ret->pi_ops = (struct pargrp_iomap_ops *)DUMMY_PTR;
315 
317  ret->pi_max_row = 1;
319 
320  for (r = 0; r < ret->pi_max_row; r++) {
322  M0_UT_ASSERT(ret->pi_databufs[r] != NULL);
323 
324  for (c = 0; c < ret->pi_max_col; c++) {
325  M0_ALLOC_PTR(ret->pi_databufs[r][c]);
326  M0_UT_ASSERT(ret->pi_databufs[r][c] != NULL);
327 
329  }
330  }
331 
332  ret->pi_ioo = (struct m0_op_io *)DUMMY_PTR;
333 
334  rc = m0_indexvec_alloc(&ret->pi_ivec, 1);
335  M0_UT_ASSERT(rc == 0);
336  ret->pi_ivec.iv_vec.v_count[0] = num_blocks * UT_DEFAULT_BLOCK_SIZE;
337 
338  return ret;
339 }
340 
341 M0_INTERNAL void
343  struct m0_client *instance)
344 {
345  int r, c;
346 
347  m0_indexvec_free(&map->pi_ivec);
348 
349  for (r = 0; r < map->pi_max_row; r++) {
350  for (c = 0; c < map->pi_max_col; c++) {
351  ut_dummy_data_buf_fini(map->pi_databufs[r][c]);
352 
353  m0_free(map->pi_databufs[r][c]);
354 
355  }
356  m0_free(map->pi_databufs[r]);
357  }
358  m0_free(map->pi_databufs);
359 
360  pargrp_iomap_bob_fini(map);
361  m0_free(map);
362 }
363 
364 #ifndef __KERNEL__
365 #include <stdlib.h>
366 #endif
367 M0_INTERNAL struct m0_op_io *
368 ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
369 {
370  int i;
371  int rc;
372  uint64_t layout_id;
373  struct m0_layout *layout;
374  struct m0_pdclust_layout *pl;
375  struct m0_pdclust_instance *pdi;
376  struct m0_op_io *ioo;
377  struct m0_pool_version *pv;
378 
379  M0_ALLOC_PTR(ioo);
380  M0_UT_ASSERT(ioo != NULL);
381 
382  m0_op_io_bob_init(ioo);
383  m0_op_obj_bob_init(&ioo->ioo_oo);
384  m0_op_common_bob_init(&ioo->ioo_oo.oo_oc);
385  m0_op_bob_init(&ioo->ioo_oo.oo_oc.oc_op);
386 
387  ioo->ioo_oo.oo_oc.oc_op.op_size = sizeof(*ioo);
389 
390  /* Create parity layout and instance */
391  pv = instance->m0c_pools_common.pc_cur_pver;
392  layout_id = m0_pool_version2layout_id(&pv->pv_id, M0_DEFAULT_LAYOUT_ID);
393  layout = m0_layout_find(&instance->m0c_reqh.rh_ldom, layout_id);
394  M0_UT_ASSERT(layout != NULL);
395  pl = m0_layout_to_pdl(layout);
397  pdi->pi_base.li_l = &pl->pl_base.sl_base;
398  pdi->pi_base.li_l->l_pver = instance->m0c_pools_common.pc_cur_pver;
399  ioo->ioo_oo.oo_layout_instance = &pdi->pi_base;
400 
401  /* Set entity */
402  ioo->ioo_obj = ut_dummy_obj_create();
404  ioo->ioo_obj->ob_attr.oa_layout_id = M0_DEFAULT_LAYOUT_ID;
405 
406  /* IO extends */
407  rc = m0_indexvec_alloc(&ioo->ioo_ext, 1);
408  M0_UT_ASSERT(rc == 0);
409  ioo->ioo_ext.iv_index[0] = 0;
411 
412  ioo->ioo_data.ov_vec.v_nr = 1;
415  M0_ALLOC_ARR(ioo->ioo_data.ov_buf, 1);
416  M0_ALLOC_ARR(ioo->ioo_data.ov_buf[0], 1);
417 
418  M0_SET0(&ioo->ioo_attr);
419 
420  /* failed sessions*/
422  ioo->ioo_failed_session[0] = ~(uint64_t)0;
423 
425  ioo->ioo_failed_nodes[0] = ~(uint64_t)0;
426 
427  /* fid */
428  //m0_fid_set(&ioo->ioo_oo.oo_fid, 0, 1);
429  m0_fid_gob_make(&ioo->ioo_oo.oo_fid, 0, 1);
430 
431  m0_sm_init(&ioo->ioo_sm, &io_sm_conf, IRS_INITIALIZED, &instance->m0c_sm_group);
432 
434 
435  /* IO parity group map */
436  M0_ALLOC_ARR(ioo->ioo_iomaps, num_io_maps);
437  M0_UT_ASSERT(ioo->ioo_iomaps != NULL);
438  ioo->ioo_iomap_nr = num_io_maps;
439  for (i = 0; i < ioo->ioo_iomap_nr; i++) {
440  ioo->ioo_iomaps[i] =
443  ioo->ioo_iomaps[i]->pi_grpid = i;
444  ioo->ioo_iomaps[i]->pi_ioo = ioo;
445  }
446 
447  /* SM group */
450 
451  return ioo;
452 }
453 
457 M0_INTERNAL struct m0_pdclust_layout *
459 {
460  return bob_of(ioo->ioo_oo.oo_layout_instance->li_l,
461  struct m0_pdclust_layout ,
463 }
464 
465 M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo,
466  struct m0_client *instance)
467 {
468  int i;
469  /*struct m0_pdclust_layout *pl;*/
470  struct m0_layout_instance *li;
471  struct m0_pdclust_instance *pdi;
472 
474  m0_free(ioo->ioo_oo.oo_sm_grp);
475 
476  if (ioo->ioo_iomaps != NULL) {
477  for (i = 0; i < ioo->ioo_iomap_nr; i++) {
479  ioo->ioo_iomaps[i], instance);
480  }
481  m0_free0(&ioo->ioo_iomaps);
482  }
483 
485 
486  m0_sm_group_lock(&instance->m0c_sm_group);
488  m0_sm_fini(&ioo->ioo_sm);
489  m0_sm_group_unlock(&instance->m0c_sm_group);
490 
493  m0_free(ioo->ioo_data.ov_buf[0]);
494  m0_free(ioo->ioo_data.ov_buf);
496  m0_indexvec_free(&ioo->ioo_ext);
498 
499  li = ioo->ioo_oo.oo_layout_instance;
500  pdi = bob_of(li, struct m0_pdclust_instance, pi_base,
503 #if 0
506 #endif
507  m0_free(ioo);
508 }
509 
511 {
512 }
513 
514 M0_INTERNAL struct ioreq_fop *ut_dummy_ioreq_fop_create(void)
515 {
516  struct ioreq_fop *ret;
517 
518  M0_ALLOC_PTR(ret);
520  ioreq_fop_bob_init(ret);
521  ret->irf_tioreq = (struct target_ioreq *)DUMMY_PTR;
523  ret->irf_ast.sa_mach = (struct m0_sm *)DUMMY_PTR;
524 
525  return ret;
526 }
527 
528 M0_INTERNAL void ut_dummy_ioreq_fop_delete(struct ioreq_fop *fop)
529 {
530  ioreq_fop_bob_fini(fop);
531  m0_free(fop);
532 }
533 
535 {
536  struct target_ioreq *ti;
537 
538  M0_ALLOC_PTR(ti);
539  target_ioreq_bob_init(ti);
541  ti->ti_session->s_session_id = ~(uint64_t)0;
542  ti->ti_nwxfer = (struct nw_xfer_request *)DUMMY_PTR;
543  ti->ti_bufvec.ov_buf = (void **)DUMMY_PTR;
544  ti->ti_auxbufvec.ov_buf = (void **)DUMMY_PTR;
545  ti->ti_ivec.iv_index = (void *)DUMMY_PTR;
546  ti->ti_goff_ivec.iv_index = (void *)DUMMY_PTR;
547  m0_fid_set(&ti->ti_fid, 0, 1);
548  iofops_tlist_init(&ti->ti_iofops);
549  tioreqht_tlink_init(ti);
550 
551  return ti;
552 }
553 
554 M0_INTERNAL void ut_dummy_target_ioreq_delete(struct target_ioreq *ti)
555 {
556  M0_UT_ASSERT(iofops_tlist_is_empty(&ti->ti_iofops));
557 
558  m0_free(ti->ti_session);
559  tioreqht_tlink_fini(ti);
560  iofops_tlist_fini(&ti->ti_iofops);
561  target_ioreq_bob_fini(ti);
562  m0_free(ti);
563 }
564 
566 {
567  uint32_t i;
568  int rc = 0;
569  struct m0_poolmach *pm;
570  struct m0_poolmach_state *state;
571 
572  M0_UT_ASSERT(pv != NULL);
573 
574  pm = &pv->pv_mach;
575  M0_SET0(pm);
576  m0_rwlock_init(&pm->pm_lock);
577 
578  /* This is On client. */
579  M0_ALLOC_PTR(state);
580  if (state == NULL)
581  return -ENOMEM;
582 
583  state->pst_nr_nodes = 5; //nr_nodes;
584  /* nr_devices io devices and 1 md device. md uses container 0 */
585  state->pst_nr_devices = 5; //nr_devices + 1;
586  state->pst_max_node_failures = 1;
587  state->pst_max_device_failures = 1;
588  state->pst_nr_spares = 1;
589 
590  M0_ALLOC_ARR(state->pst_nodes_array, state->pst_nr_nodes);
592  state->pst_nr_devices);
594  state->pst_nr_spares);
595  if (state->pst_nodes_array == NULL ||
596  state->pst_devices_array == NULL ||
597  state->pst_spare_usage_array == NULL) {
598  /* m0_free(NULL) is valid */
599  m0_free(state->pst_nodes_array);
600  m0_free(state->pst_devices_array);
602  m0_free(state);
603  return -ENOMEM;
604  }
605 
606  for (i = 0; i < state->pst_nr_nodes; i++) {
607  state->pst_nodes_array[i].pn_state = M0_PNDS_ONLINE;
608  M0_SET0(&state->pst_nodes_array[i].pn_id);
609  }
610 
611  for (i = 0; i < state->pst_nr_devices; i++) {
612  state->pst_devices_array[i].pd_state = M0_PNDS_ONLINE;
613  M0_SET0(&state->pst_nodes_array[i].pn_id);
614  state->pst_devices_array[i].pd_node = &state->pst_nodes_array[i];
615  }
616 
617  for (i = 0; i < state->pst_nr_spares; i++) {
618  /* -1 means that this spare slot is not used */
621  }
622  //poolmach_events_tlist_init(&state->pst_events_list);
623  pm->pm_state = state;
624 
625  pm->pm_is_initialised = true;
626 
627  return rc;
628 }
629 
630 M0_INTERNAL void ut_dummy_poolmach_delete(struct m0_pool_version *pv)
631 {
632  struct m0_poolmach *pm;
633  struct m0_poolmach_state *state;
634 
635  if (pv == NULL || pv->pv_mach.pm_state == NULL)
636  return;
637 
638  pm = &pv->pv_mach;
639  state = pm->pm_state;
640 
642  m0_free(state->pst_devices_array);
643  m0_free(state->pst_nodes_array);
644  m0_free0(&pm->pm_state);
645 
646  pm->pm_is_initialised = false;
647  m0_rwlock_fini(&pm->pm_lock);
648 }
649 
655 {
656  return 0;
657 }
658 
660  struct target_ioreq *tio,
662  uint32_t count)
663 {
664  return 0;
665 }
666 
668 {
669  return 0;
670 }
671 
674  .pi_dgmode_process = mock_pargrp_iomap_dgmode_process,
675  .pi_dgmode_recover = mock_pargrp_iomap_dgmode_recover,
676 };
677 
678 #undef M0_TRACE_SUBSYSTEM
679 
680 /*
681  * Local variables:
682  * c-indentation-style: "K&R"
683  * c-basic-offset: 8
684  * tab-width: 8
685  * fill-column: 80
686  * scroll-step: 1
687  * End:
688  */
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 ut_dummy_data_buf_free(struct data_buf *db)
Definition: io_dummy.c:232
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:794
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:654
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:554
const struct pargrp_iomap_ops mock_iomap_ops
Definition: io_dummy.c:672
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:659
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:342
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:241
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:656
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:283
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:670
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:510
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:755
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:253
M0_INTERNAL struct target_ioreq * ut_dummy_target_ioreq_create(void)
Definition: io_dummy.c:534
M0_INTERNAL struct m0_pdclust_layout * ut_get_pdclust_layout_from_ioo(struct m0_op_io *ioo)
Definition: io_dummy.c:458
struct m0_fid oo_fid
M0_INTERNAL struct ioreq_fop * ut_dummy_ioreq_fop_create(void)
Definition: io_dummy.c:514
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:667
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:666
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:303
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:465
#define M0T1FS_LAYOUT_K
Definition: client.h:63
struct m0_entity ob_entity
Definition: client.h:795
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:565
M0_INTERNAL struct m0_op_io * ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
Definition: io_dummy.c:368
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:528
uint64_t oa_layout_id
Definition: client.h:758
struct m0_layout_instance * oo_layout_instance
M0_INTERNAL void ut_dummy_poolmach_delete(struct m0_pool_version *pv)
Definition: io_dummy.c:630
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:796
struct pargrp_iomap ** ioo_iomaps
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)
Definition: sm.c:331