Motr  M0
io_pargrp.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 #include "lib/uuid.h" /* m0_uuid_generate */
28 
29 #include "ut/ut.h" /* M0_UT_ASSERT */
30 #include "motr/ut/client.h"
31 
32 /*
33  * Including the c files so we can replace the M0_PRE asserts
34  * in order to test them.
35  */
36 #if defined(round_down)
37 #undef round_down
38 #endif
39 #if defined(round_up)
40 #undef round_up
41 #endif
42 #include "motr/io_pargrp.c"
43 
44 #include "layout/layout_internal.h" /* REMOVE ME */
45 
46 static struct m0_client *dummy_instance;
48 
49 #define DUMMY_PTR 0xdeafdead
50 
51 #define UT_DEFAULT_BLOCK_SHIFT M0_DEFAULT_BUF_SHIFT
52 #define UT_DEFAULT_BLOCK_SIZE (1ULL << M0_DEFAULT_BUF_SHIFT)
53 
57 static void ut_test_data_buf_invariant(void)
58 {
59  struct data_buf *db;
60  struct data_buf *aux;
61  bool ret;
62 
64 
65  /* Base case. */
66  ret = data_buf_invariant(db);
67  M0_UT_ASSERT(ret == true);
68 
69  /* db == NULL */
70  ret = data_buf_invariant(NULL);
71  M0_UT_ASSERT(ret == false);
72 
73  /* !bob_check() */
74  aux = db;
75  db = (struct data_buf *)0x1;
76  ret = data_buf_invariant(db);
77  M0_UT_ASSERT(ret == false);
78  db = aux;
79 
80  /* b_nob <= 0 */
81  db->db_buf.b_addr = (void *)DUMMY_PTR;
82  db->db_buf.b_nob = 0;
83  ret = data_buf_invariant(db);
84  M0_UT_ASSERT(ret == false);
85 
86  /* fini */
88 }
89 
94 {
95  struct pargrp_iomap *map;
96  struct m0_client *instance = NULL;
97  bool ret;
98  struct data_buf *db;
99  int data_buf_nob;
100 
101  /* init */
103 
105  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
106  map->pi_paritybufs = NULL;
107 
108  /* Base cases. */
109  ret = data_buf_invariant_nr(map);
110  M0_UT_ASSERT(ret == true);
111 
112  /* Make the first loop return false */
113  db = map->pi_databufs[0][0];
114  M0_UT_ASSERT(db->db_buf.b_addr != NULL);
115  data_buf_nob = db->db_buf.b_nob;
116  db->db_buf.b_nob = 0;
117  ret = data_buf_invariant_nr(map);
118  M0_UT_ASSERT(ret == false);
119  db->db_buf.b_nob = data_buf_nob;
120 
121  /* TODO: add tests for invariant called on paritybufs */
122 
123  /* fini */
124  ut_dummy_ioo_delete(map->pi_ioo, instance);
125  map->pi_ioo = NULL;
127 }
128 
132 static void ut_test_data_buf_init(void)
133 {
134  struct data_buf *buf;
135  void *addr;
136 
137  addr = (void *)(DUMMY_PTR & (~M0_NETBUF_MASK));
138  M0_ALLOC_PTR(buf);
139  M0_UT_ASSERT(buf != NULL);
140 
141  /* Check if buf is corectly set*/
142  data_buf_init(buf, addr, 4096, 1);
143  M0_UT_ASSERT(buf->db_buf.b_addr == addr);
144  M0_UT_ASSERT(buf->db_buf.b_nob == 4096);
145  M0_UT_ASSERT(buf->db_flags == 1);
146 
147  m0_free(buf);
148 }
149 
153 static void ut_test_data_buf_fini(void)
154 {
155  struct data_buf *buf;
156 
157  /* Check if buf is cleaned correctly*/
159  M0_UT_ASSERT(buf != NULL);
160 
161  buf->db_flags = 1;
163  M0_UT_ASSERT(buf->db_flags == PA_NONE);
164 
165  /* Cannot delete the dummy data_buf after data_buf_fini(). */
166  m0_free(buf);
167 }
168 
173 {
174  struct data_buf *buf;
175 
176  /* Base case */
179 }
180 
185 {
186  struct m0_client *instance = NULL;
187  struct m0_realm realm;
188  struct m0_obj *obj;
189  struct data_buf *buf;
190 
191  /* Pass Pre-conditions*/
194  ut_realm_entity_setup(&realm, &obj->ob_entity, instance);
195 
196  /* m0_alloc_aligned return NULL */
197  obj->ob_attr.oa_bshift = 63;
199  M0_UT_ASSERT(buf == NULL);
200 
201  /* Base case */
202  obj->ob_attr.oa_bshift = M0_MIN_BUF_SHIFT;
204  M0_UT_ASSERT(buf != NULL);
206 
207  /* Clean up*/
209 }
210 
215 {
216  bool ret;
217  struct pargrp_iomap *map;
218  struct m0_client *instance = NULL;
219 
220  /* init */
223  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
224 
225  /* Base case. */
227  M0_UT_ASSERT(ret == true);
228 
229  /* map == NULL */
231  M0_UT_ASSERT(ret == false);
232 
233  /* fini */
234  ut_dummy_ioo_delete(map->pi_ioo, instance);
236 }
237 
242 {
243  struct m0_op_io *ioo;
244  struct m0_client *instance = NULL;
245  bool ret;
246 
247  /* init */
249 
250  /* Base case. */
251  ioo = ut_dummy_ioo_create(instance, 1);
252  ret = pargrp_iomap_invariant_nr(ioo);
253  M0_UT_ASSERT(ret == true);
255 }
256 
257 static void ut_test_seg_collate(void)
258 {
259 }
260 
261 /*
262  * xxx_dummy_pargrp_iomap_create allocates memory for data bufs. But
263  * pargrp_iomap_databuf_alloc requires the bufs to be null.
264  */
266  int row, int col)
267 {
268  ut_dummy_data_buf_fini(map->pi_databufs[row][col]);
269  m0_free(map->pi_databufs[row][col]);
270  map->pi_databufs[row][col] = NULL;
271 }
272 
274 {
275  int rc;
276  int blk_size;
277  struct pargrp_iomap *map;
278  struct m0_indexvec ivec;
279  struct m0_ivec_cursor cursor;
280  struct m0_op_io *ioo;
281  struct m0_client *instance = NULL;
282  struct m0_realm realm;
283 
284  /*
285  * Pre-condition: cursor == NULL.
286  * Note: pargrp_iomap_populate doenn't check this!
287  */
288 
289  /* Create a valid map to pass those pre-condition checks*/
291  ioo = ut_dummy_ioo_create(instance, 1);
292  ioo->ioo_obj->ob_entity.en_realm = &realm;
296 
297  /*
298  * Create a dummy map, it covers the first parity group.
299  */
300  map = ioo->ioo_iomaps[0];
301  M0_UT_ASSERT(map != NULL);
302  map->pi_ioo = ioo;
303  map->pi_ops = &iomap_ops;
304  map->pi_grpid = 0;
305 
306  /*
307  * A few simple test cases
308  * Note: indexvec[index, count] has to be multiple of block sizes
309  *
310  * 1. Only one seg
311  * A. one block
312  * B. multiple blocks (3 blocks)
313  * - it spans 2 (or more) parity groups
314  * - only spans one group
315  *
316  * 2. Multiple segs (2 for now)
317  * A. Only spans this group
318  * B. 1 or 2 segs spans groups
319  *
320  * 3. RMW (1 block)
321  */
322  blk_size = 1UL << UT_DEFAULT_BLOCK_SHIFT;
323 
324  /* Test 1.A one segment, one block */
326 
327  rc = m0_indexvec_alloc(&ivec, 1);
328  M0_UT_ASSERT (rc == 0);
329  ivec.iv_index[0] = 0;
330  ivec.iv_vec.v_count[0] = blk_size;
331 
332  map->pi_ivec.iv_vec.v_nr = 0;
333  m0_ivec_cursor_init(&cursor, &ivec);
334  rc = pargrp_iomap_populate(map, &cursor, NULL);
335  M0_UT_ASSERT(rc == 0);
336  m0_indexvec_free(&ivec);
337  map->pi_ivec.iv_vec.v_nr = 0;
338 
339  /* Test 1.B one segment, multiple blocks*/
342 
343  rc = m0_indexvec_alloc(&ivec, 1);
344  M0_UT_ASSERT (rc == 0);
345  ivec.iv_index[0] = 0;
346  ivec.iv_vec.v_count[0] = 2 * blk_size;
347  ioo->ioo_data.ov_vec.v_count[0] = 2 * blk_size;
348 
349  m0_ivec_cursor_init(&cursor, &ivec);
350  rc = pargrp_iomap_populate(map, &cursor, NULL);
351  M0_UT_ASSERT(rc == 0);
352 
353  m0_indexvec_free(&ivec);
354  map->pi_ivec.iv_vec.v_nr = 0;
355  map->pi_ivec.iv_index[0] = 0;
356  map->pi_ivec.iv_vec.v_count[0] = 0;
357 
358  /* Test 2.A 2 segments, one block each */
360 
361  rc = m0_indexvec_alloc(&ivec, 2);
362  M0_UT_ASSERT (rc == 0);
363  ivec.iv_index[0] = 0;
364  ivec.iv_vec.v_count[0] = blk_size;
365  ivec.iv_index[1] = 2 * blk_size;
366  ivec.iv_vec.v_count[1] = blk_size;
367  ioo->ioo_data.ov_vec.v_count[0] = 2 * blk_size;
368 
369  m0_ivec_cursor_init(&cursor, &ivec);
370  rc = pargrp_iomap_populate(map, &cursor, NULL);
371  M0_UT_ASSERT(rc == 0);
372  M0_UT_ASSERT(m0_ivec_cursor_index(&cursor) == 2 * blk_size);
373 
374  m0_indexvec_free(&ivec);
375  map->pi_ivec.iv_vec.v_nr = 0;
376  map->pi_ivec.iv_index[0] = 0;
377  map->pi_ivec.iv_vec.v_count[0] = 0;
378 
379  /* Test 2.B 2 segments, 2 blocks each (one seg will spans 2 group)*/
382 
383  rc = m0_indexvec_alloc(&ivec, 2);
384  M0_UT_ASSERT (rc == 0);
385  ivec.iv_index[0] = 0;
386  ivec.iv_vec.v_count[0] = 3 * blk_size;
387  ivec.iv_index[1] = 4 * (blk_size);
388  ivec.iv_vec.v_count[1] = 1 * blk_size;
389  ioo->ioo_data.ov_vec.v_count[0] = 4 * blk_size;
390 
391  m0_ivec_cursor_init(&cursor, &ivec);
392  rc = pargrp_iomap_populate(map, &cursor, NULL);
393  M0_UT_ASSERT(rc == 0);
394  M0_UT_ASSERT(m0_ivec_cursor_index(&cursor) == 2 * blk_size);
395 
396  m0_indexvec_free(&ivec);
397  map->pi_ivec.iv_vec.v_nr = 0;
398  map->pi_ivec.iv_index[0] = 0;
399  map->pi_ivec.iv_vec.v_count[0] = 0;
400 
401  /* Test 3. RMW */
403  ioo->ioo_pbuf_type = M0_PBUF_DIR;
406 
407  rc = m0_indexvec_alloc(&ivec, 1);
408  M0_UT_ASSERT (rc == 0);
409  ivec.iv_index[0] = 0;
410  ivec.iv_vec.v_count[0] = blk_size;
411 
412  m0_ivec_cursor_init(&cursor, &ivec);
413  rc = pargrp_iomap_populate(map, &cursor, NULL);
414  M0_UT_ASSERT(rc == 0);
415 
416  m0_indexvec_free(&ivec);
418 
419  /* Clean up */
421 }
422 
424 {
425  struct pargrp_iomap *map;
426  struct m0_op_io *ioo;
427  struct m0_client *instance = NULL;
428  struct m0_realm realm;
429 
431  ioo = ut_dummy_ioo_create(instance, 1);
432  ioo->ioo_obj->ob_entity.en_realm = &realm;
434 
435  /* Check on a valid map */
436  map = ioo->ioo_iomaps[0];
437  M0_UT_ASSERT(map != NULL);
438  map->pi_ioo = ioo;
440 
442 }
443 
445 {
446  int rc;
447  int blk_size;
448  struct pargrp_iomap *map;
449  struct m0_op_io *ioo;
450  struct m0_client *instance = NULL;
451  struct m0_realm realm;
452 
453  blk_size = 1UL << UT_DEFAULT_BLOCK_SHIFT;
454 
455  /* Note: rmw is out of realm at current test */
457  ioo = ut_dummy_ioo_create(instance, 1);
458  ioo->ioo_obj->ob_entity.en_realm = &realm;
460 
461  /*
462  * Create a dummy map, it covers the first parity group.
463  */
464  map = ioo->ioo_iomaps[0];
465  M0_UT_ASSERT(map != NULL);
466  map->pi_ioo = ioo;
467  map->pi_ops = &iomap_ops;
468  map->pi_grpid = 0;
469 
470  /*
471  * A few simple test cases
472  * 1. one block
473  * 2. multiple blocks
474  *
475  * No need to test the case where a seg spans multiple groups
476  * as seg_process assumes 'map' is not larger than a group.
477  */
478 
479  /* Test 1. One block */
481  map->pi_ivec.iv_index[0] = 0;
482  map->pi_ivec.iv_vec.v_count[0] = blk_size;
483 
484  rc = pargrp_iomap_seg_process(map, 0, 0, 0, NULL);
485  M0_UT_ASSERT(rc == 0);
486  M0_UT_ASSERT(map->pi_databufs != NULL);
487  M0_UT_ASSERT(map->pi_databufs[0][0] != NULL);
488  M0_UT_ASSERT(map->pi_databufs[0][0]->db_flags != 0);
489 
490  /* Test 2. Multiple blocks */
493  map->pi_ivec.iv_index[0] = 0;
494  map->pi_ivec.iv_vec.v_count[0] = 2 * blk_size;
495  ioo->ioo_ext.iv_index[0] = 0;
496  ioo->ioo_ext.iv_vec.v_count[0] = 2 * blk_size;
497  ioo->ioo_data.ov_vec.v_count[0] = 2 * blk_size;
498 
499  rc = pargrp_iomap_seg_process(map, 0, 0, 0, NULL);
500  M0_UT_ASSERT(rc == 0);
501  M0_UT_ASSERT(map->pi_databufs != NULL);
502  M0_UT_ASSERT(map->pi_databufs[0][0] != NULL);
503  M0_UT_ASSERT(map->pi_databufs[0][0]->db_flags != 0);
504 
505  /*
506  * Test 3. RMW.
507  * Note: reset ioo->ioo_ext & ioo_data to original settings.
508  */
510  map->pi_ivec.iv_index[0] = 0;
511  map->pi_ivec.iv_vec.v_count[0] = blk_size;
512  ioo->ioo_ext.iv_index[0] = 0;
513  ioo->ioo_ext.iv_vec.v_count[0] = 1 * blk_size;
514  ioo->ioo_data.ov_vec.v_count[0] = 1 * blk_size;
515 
516  rc = pargrp_iomap_seg_process(map, 0, 1, 0, NULL);
517  M0_UT_ASSERT(rc == 0);
518  M0_UT_ASSERT(map->pi_databufs != NULL);
519  M0_UT_ASSERT(map->pi_databufs[0][0] != NULL);
520  M0_UT_ASSERT(map->pi_databufs[0][0]->db_flags != 0);
521 
522  /* Clean up */
524 }
525 
530 {
531  int rc;
532  struct pargrp_iomap *map;
533  struct m0_op_io *ioo;
534  struct m0_client *instance = NULL;
535  struct m0_realm realm;
536 
538  ioo = ut_dummy_ioo_create(instance, 1);
539  ioo->ioo_obj->ob_entity.en_realm = &realm;
541 
542  /*
543  * Create a dummy map, it covers the first parity group.
544  */
545  M0_ALLOC_PTR(map);
546  M0_UT_ASSERT(map != NULL);
547  pargrp_iomap_bob_init(map);
548  map->pi_ops = (struct pargrp_iomap_ops *)DUMMY_PTR;
549  map->pi_ioo = ioo;
550  map->pi_max_col = 4;
551  map->pi_max_row = 1;
552 
553  rc = m0_indexvec_alloc(&map->pi_ivec, 1);
554  M0_UT_ASSERT(rc == 0);
555 
556  M0_ALLOC_ARR(map->pi_databufs, 1);
557  M0_UT_ASSERT(map->pi_databufs != NULL);
558  M0_ALLOC_ARR(map->pi_databufs[0], 4);
559  M0_UT_ASSERT(map->pi_databufs[0] != NULL);
560 
561  /* pi_databufs[row][col] != NULL */
563  M0_UT_ASSERT(rc == 0);
565 
566  m0_free(map->pi_databufs[0]);
567  m0_free(map->pi_databufs);
568  m0_indexvec_free(&map->pi_ivec);
569  m0_free(map);
570 
572 }
573 
575 {
576  int rc;
577  struct pargrp_iomap *map;
578  struct m0_op_io *ioo;
579  struct m0_client *instance = NULL;
580  struct m0_realm realm;
581 
583  ioo = ut_dummy_ioo_create(instance, 1);
584  ioo->ioo_obj->ob_entity.en_realm = &realm;
586 
587  /*
588  * Create a dummy map, it covers the first parity group.
589  */
590  map = ioo->ioo_iomaps[0];
591  M0_UT_ASSERT(map != NULL);
592  map->pi_ioo = ioo;
593  map->pi_ops = &iomap_ops;
594  map->pi_grpid = 0;
595  map->pi_rtype = PIR_READOLD;
596 
597  /* Base case */
599  M0_UT_ASSERT(rc == 0);
600  M0_UT_ASSERT(map->pi_databufs[0][0]->db_auxbuf.b_addr != NULL);
601  m0_free_aligned(map->pi_databufs[0][0]->db_auxbuf.b_addr,
604 
605  /* Clean up */
607 }
608 
610 {
611  int rc;
612  int blk_size;
613  struct pargrp_iomap *map;
614  struct m0_op_io *ioo;
615  struct m0_client *instance = NULL;
616  struct m0_realm realm;
617 
618  blk_size = 1UL << UT_DEFAULT_BLOCK_SHIFT;
619 
621  ioo = ut_dummy_ioo_create(instance, 1);
622  ioo->ioo_obj->ob_entity.en_realm = &realm;
624 
625  /*
626  * Create a dummy map, it covers the first parity group.
627  */
628  map = ioo->ioo_iomaps[0];
629  M0_UT_ASSERT(map != NULL);
630  map->pi_ioo = ioo;
631  map->pi_ops = &iomap_ops;
632  map->pi_grpid = 0;
633  map->pi_rtype = PIR_READOLD;
634 
635  /* Base case */
636  map->pi_ivec.iv_index[0] = 0;
637  map->pi_ivec.iv_vec.v_count[0] = blk_size;
639  M0_UT_ASSERT(rc == 0);
640  M0_UT_ASSERT((map->pi_databufs[0][0]->db_flags & PA_READ) == PA_READ);
641  m0_free_aligned(map->pi_databufs[0][0]->db_auxbuf.b_addr,
644 
645  /* Clean up */
647 }
648 
650 {
651  int rc;
652  int blk_size;
653  struct pargrp_iomap *map;
654  struct m0_op_io *ioo;
655  struct m0_client *instance = NULL;
656  struct m0_realm realm;
657 
658  blk_size = 1UL << UT_DEFAULT_BLOCK_SHIFT;
659 
661  ioo = ut_dummy_ioo_create(instance, 1);
662  ioo->ioo_obj->ob_entity.en_realm = &realm;
664 
665  /*
666  * Create a dummy map, it covers the first parity group.
667  */
668  map = ioo->ioo_iomaps[0];
669  M0_UT_ASSERT(map != NULL);
670  map->pi_ioo = ioo;
671  map->pi_ops = &iomap_ops;
672  map->pi_grpid = 0;
673  map->pi_rtype = PIR_READREST;
674 
675  /* Test 1. One segment (one block)*/
676  map->pi_ivec.iv_index[0] = 0;
677  map->pi_ivec.iv_vec.v_count[0] = blk_size;
679 
681  M0_UT_ASSERT(rc == 0);
682  M0_UT_ASSERT(map->pi_databufs != NULL);
683  M0_UT_ASSERT(map->pi_databufs[0][0] != NULL);
684  M0_UT_ASSERT((map->pi_databufs[0][0]->db_flags & PA_READ) == PA_READ);
685 
686  /* Test 2. 1 segment, 2 blocks*/
687  map->pi_ivec.iv_index[0] = 0;
688  map->pi_ivec.iv_vec.v_count[0] = 2 * blk_size;
691 
693  M0_UT_ASSERT(rc == 0);
694  M0_UT_ASSERT(map->pi_databufs != NULL);
695  M0_UT_ASSERT(map->pi_databufs[0][1] != NULL);
696  M0_UT_ASSERT((map->pi_databufs[0][1]->db_flags & PA_READ) == PA_READ);
697 
698  /* Clean up */
700 }
701 
703 {
704  int rc;
705  struct pargrp_iomap *map;
706  struct m0_op_io *ioo;
707  struct m0_client *instance = NULL;
708  struct m0_realm realm;
709 
711  ioo = ut_dummy_ioo_create(instance, 1);
712  ioo->ioo_obj->ob_entity.en_realm = &realm;
714 
715  /*
716  * Create a dummy map, it covers the first parity group.
717  */
719  M0_UT_ASSERT(map != NULL);
720  map->pi_ioo = ioo;
721  map->pi_ops = &iomap_ops;
722  map->pi_grpid = 0;
723 
724  /*
725  * Base cases: as we assume the m0_parity_math_xxx do the proper
726  * job, we don't check the content of calculated parity buffers.
727  *
728  * Set parity bufs first.
729  */
731 
732  /*
733  * Test 1. map->pi_rtype == PIR_NONE (normal case)
734  */
735  map->pi_ioo->ioo_oo.oo_oc.oc_op.op_code = M0_OC_WRITE;
736  map->pi_rtype = PIR_READREST;
738  M0_UT_ASSERT(rc == 0);
739 
740  /* Test 2. Read rest method */
741  map->pi_rtype = PIR_READREST;
743  M0_UT_ASSERT(rc == 0);
744 
745  /* Test 3. Read old method */
746  map->pi_rtype = PIR_READOLD;
748  M0_UT_ASSERT(rc == 0);
749 
750  /* free parity bufs*/
752 
753  /* Clean up */
756 }
757 
759 {
760  int i;
761  int j;
762  int rc;
763  struct pargrp_iomap *map;
764  struct m0_op_io *ioo;
765  struct m0_client *instance = NULL;
766  struct m0_realm realm;
767 
768  /* Base cases */
771  ioo = ut_dummy_ioo_create(instance, 1);
772  ioo->ioo_obj->ob_entity.en_realm = &realm;
773 
774  /*
775  * Create a dummy map, it covers the first parity group.
776  */
777  map = ioo->ioo_iomaps[0];
778  map->pi_ioo = ioo;
779  map->pi_rtype = PIR_READOLD;
781 
782  /* Check if this function behaves ok */
784  M0_UT_ASSERT(rc == 0 || rc == -ENOMEM);
785 
786  /*
787  * The settings in ioo->ioo_obj(created by layout_domain_fill)
788  * for layout don't match those in map, disable the following
789  * checks at this moment
790  */
791  if (rc == 0) {
792  for (i = 0; i < map->pi_max_row; i++) {
793  for (j = 0; j < M0T1FS_LAYOUT_K; j++) {
794  M0_UT_ASSERT(map->pi_paritybufs[i][j] != NULL);
795  M0_UT_ASSERT((map->pi_paritybufs[i][j]->db_flags
796  & PA_READ) == PA_READ);
797  }
798  }
799  }
800 
803 }
804 
809 {
810  int n;
811  bool is_spanned;
812  struct pargrp_iomap *map;
813  struct m0_op_io *ioo;
814  struct m0_client *instance = NULL;
815  struct m0_realm realm;
816 
817  /* Base cases */
819  ioo = ut_dummy_ioo_create(instance, 1);
820  ioo->ioo_obj->ob_entity.en_realm = &realm;
822 
823  /*
824  * Create a dummy map, it covers the first parity group.
825  */
826  map = ioo->ioo_iomaps[0];
827  M0_UT_ASSERT(map != NULL);
828  map->pi_ioo = ioo;
829  n = map->pi_max_col;
830 
831  map->pi_ivec.iv_index[0] = 0;
832  map->pi_ivec.iv_vec.v_count[0] = 4096;
833 
834  /* 1. one unit */
835  is_spanned = pargrp_iomap_spans_seg(map, 0,
836  1 << M0_MIN_BUF_SHIFT);
837  M0_UT_ASSERT(is_spanned == true);
838 
839  /* 2. n- 1 units (n > 2) */
840  is_spanned = pargrp_iomap_spans_seg(map, 0,
841  (n - 1) *
842  (1 << M0_MIN_BUF_SHIFT));
843  M0_UT_ASSERT(is_spanned == true);
844 
845  /* 3. out of the boundary of this iomap */
846  is_spanned = pargrp_iomap_spans_seg(map, 4096,
847  1 << M0_MIN_BUF_SHIFT);
848  M0_UT_ASSERT(is_spanned == false);
849 
851 }
852 
854 {
855  struct m0_pdclust_layout *play;
856  int row;
857  int col;
858 
859  play = pdlayout_get(map->pi_ioo);
860  m0_free(map->pi_ivec.iv_index);
861  m0_free(map->pi_ivec.iv_vec.v_count);
862 
863  if (map->pi_databufs != NULL) {
864  for (row = 0; row < map->pi_max_row; ++row) {
865  for (col = 0; col < map->pi_max_col; ++col) {
866  if (map->pi_databufs[row][col] != NULL)
867  m0_free(map->pi_databufs[row][col]);
868  }
869  m0_free(map->pi_databufs[row]);
870  }
871  }
872 
873  if (map->pi_paritybufs != NULL) {
874  for (row = 0; row < map->pi_max_row; ++row) {
875  for (col = 0; col < layout_k(play); ++col) {
876  if (map->pi_paritybufs[row][col] != NULL)
877  m0_free(map->pi_paritybufs[row][col]);
878  }
879  m0_free(map->pi_paritybufs[row]);
880  }
881  }
882 
883  m0_free(map->pi_databufs);
884  m0_free(map->pi_paritybufs);
885 }
886 
890 static void ut_test_pargrp_iomap_init(void)
891 {
892  int i;
893  int rc;
894  struct m0_client *instance = NULL;
895  struct pargrp_iomap *map;
896  struct m0_op_io *ioo;
897  struct m0_realm realm;
898 
899  /* Base case */
901  ioo = ut_dummy_ioo_create(instance, 1);
902 
903  ioo->ioo_obj->ob_entity.en_realm = &realm;
904  ioo->ioo_pbuf_type = M0_PBUF_DIR;
906 
907  M0_ALLOC_PTR(map);
908  M0_UT_ASSERT(map != NULL);
909 
910  rc = pargrp_iomap_init(map, ioo, 1);
911  M0_UT_ASSERT(rc == 0);
912  M0_UT_ASSERT(map->pi_databufs != NULL);
913  for (i = 0; i < map->pi_max_row; i++) {
914  M0_UT_ASSERT(map->pi_databufs[i] != NULL);
915  }
917  m0_free(map);
918 
920 }
921 
925 static void ut_test_pargrp_iomap_fini(void)
926 {
927  struct pargrp_iomap *map;
928  struct m0_obj *obj;
929  struct m0_op_io *ioo;
930  struct m0_client *instance = NULL;
931  struct m0_realm realm;
932 
933  /* Init. */
935 
936  ioo = ut_dummy_ioo_create(instance, 1);
937  ioo->ioo_obj->ob_entity.en_realm = &realm;
939 
941  M0_UT_ASSERT(obj != NULL);
942 
943  /* Don't use the map in ioo beacuse pargrp_iomap_fini will free it*/
944  //map = ut_dummy_pargrp_iomap_create(instance, 1);
945  M0_ALLOC_PTR(map);
946  M0_UT_ASSERT(map != NULL);
947  pargrp_iomap_bob_init(map);
948  map->pi_ops = (struct pargrp_iomap_ops *)DUMMY_PTR;
949  map->pi_ioo = (struct m0_op_io *)DUMMY_PTR;
950 
951  map->pi_ioo = ioo;
952  map->pi_max_col = 4;
953  map->pi_max_row = 1;
954  map->pi_ivec.iv_vec.v_nr = 1;
955  M0_ALLOC_ARR(map->pi_ivec.iv_index, 1);
956  M0_UT_ASSERT(map->pi_ivec.iv_index != NULL);
957  M0_ALLOC_ARR(map->pi_ivec.iv_vec.v_count, 1);
958  M0_UT_ASSERT(map->pi_ivec.iv_vec.v_count != NULL);
959 
960  /* n = 4, p = 1, k = 1, blk_size=512, blk_shift=9*/
961  M0_ALLOC_ARR(map->pi_databufs, 1);
962  M0_UT_ASSERT(map->pi_databufs != NULL);
963  M0_ALLOC_ARR(map->pi_databufs[0], 4);
964  M0_UT_ASSERT(map->pi_databufs[0] != NULL);
965 
967  M0_UT_ASSERT(map->pi_state == PI_NONE);
968  M0_UT_ASSERT(map->pi_databufs == NULL);
969 
970  m0_free(map);
973 }
974 
975 /* Workaround to reproduce some functionality from layout/layout.c */
976 M0_BOB_DECLARE(M0_INTERNAL, m0_layout_enum);
977 
978 static struct m0_fid mock_fid;
979 static void mock_layout_enum_get(const struct m0_layout_enum *e, uint32_t idx,
980  const struct m0_fid *gfid, struct m0_fid *out)
981 {
982  m0_fid_gob_make(&mock_fid, 0, 1);
984 }
985 
988 };
989 
992 
993 static struct m0_layout_enum *
995 {
996  m0_layout_enum_bob_init(&mock_layout_enum);
999  return &mock_layout_enum;
1000 }
1001 
1004 };
1005 
1006 M0_INTERNAL void ut_set_device_state(struct m0_poolmach *pm, int dev,
1007  enum m0_pool_nd_state state)
1008 {
1009  pm->pm_state->pst_devices_array[dev].pd_state = state;
1010 }
1011 
1012 M0_INTERNAL void ut_set_node_state(struct m0_poolmach *pm, int node,
1013  enum m0_pool_nd_state state)
1014 {
1015  pm->pm_state->pst_nodes_array[node].pn_state = state;
1016 }
1017 
1018 static void ut_test_pargrp_src_addr(void)
1019 {
1020 }
1021 
1022 static void ut_test_pargrp_id_find(void)
1023 {
1024 }
1025 
1026 static void ut_test_gobj_offset(void)
1027 {
1028  struct pargrp_iomap *map;
1029  struct m0_client *instance = NULL;
1030  m0_bindex_t ret;
1031  struct m0_pdclust_src_addr saddr;
1032  struct m0_pdclust_layout *pl;
1033 
1034  /* init */
1037  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
1038  map->pi_paritybufs = NULL;
1039  pl = ut_get_pdclust_layout_from_ioo(map->pi_ioo);
1040  saddr.sa_unit = 0;
1041 
1042  /* Base cases. */
1043  ret = gobj_offset(0, map, pl, &saddr);
1044  M0_UT_ASSERT(ret == 0);
1045 
1046  ret = gobj_offset(UT_DEFAULT_BLOCK_SIZE + 32, map, pl, &saddr);
1047  M0_UT_ASSERT(ret == 32);
1048 
1049  /* fini */
1050  ut_dummy_ioo_delete(map->pi_ioo, instance);
1051  map->pi_ioo = NULL;
1053 }
1054 
1055 static void ut_test_is_page_read(void)
1056 {
1057  struct data_buf *db;
1058  struct target_ioreq *ti;
1059  bool yes;
1060 
1061  db = ut_dummy_data_buf_create();
1062  db->db_flags |= PA_READ;
1063 
1065  M0_UT_ASSERT(ti != NULL);
1066  ti->ti_rc = 0;
1067  db->db_tioreq = ti;
1068 
1069  /* true case*/
1070  yes = is_page_read(db);
1071  M0_UT_ASSERT(yes == true);
1072 
1073  /* false cases*/
1074  ti->ti_rc = -1;
1075  yes = is_page_read(db);
1076  M0_UT_ASSERT(yes == false);
1077 
1078  db->db_tioreq = NULL;
1079  yes = is_page_read(db);
1080  M0_UT_ASSERT(yes == false);
1081 
1082  db->db_flags = 0;
1083  yes = is_page_read(db);
1084  M0_UT_ASSERT(yes == false);
1085 
1088 }
1089 
1091 {
1092  struct pargrp_iomap *map;
1093  struct m0_client *instance = NULL;
1094 
1095  /* init */
1098  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
1099  map->pi_paritybufs = NULL;
1100 
1101  /* Base cases. */
1102  data_page_offset_get(map, 0, 0);
1103 
1104  /* fini */
1105  ut_dummy_ioo_delete(map->pi_ioo, instance);
1106  map->pi_ioo = NULL;
1108 }
1109 
1111 {
1112  int rc;
1113  struct pargrp_iomap *map;
1114  struct m0_client *instance = NULL;
1115 
1116  /* init */
1119  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
1120 
1121  /* Base cases. */
1123  M0_UT_ASSERT(rc == 0);
1124 
1127  M0_UT_ASSERT(rc == 0);
1129 
1130  /* fini */
1131  ut_dummy_ioo_delete(map->pi_ioo, instance);
1132  map->pi_ioo = NULL;
1134 }
1135 
1136 static void ut_test_unit_state(void)
1137 {
1138 }
1139 
1144 static void ut_test_io_spare_map(void)
1145 {
1146 }
1147 
1149 {
1150 }
1151 
1153 {
1154 }
1155 
1157 {
1158  struct pargrp_iomap *map;
1159  struct m0_client *instance = NULL;
1160  struct m0_realm realm;
1161 
1162  /* init */
1164 
1166  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
1168  map->pi_ioo->ioo_oo.oo_oc.oc_op.op_entity, instance);
1169  map->pi_ioo->ioo_oo.oo_layout_instance->li_ops =
1171 
1172  /* Base cases. */
1174  &instance->m0c_pools_common.pc_cur_pver->pv_mach,
1175  0, M0_PNDS_FAILED);
1177 
1178  /* fini */
1179  ut_dummy_ioo_delete(map->pi_ioo, instance);
1180  map->pi_ioo = NULL;
1182 }
1183 
1185 {
1186  int i;
1187  int rc;
1188  struct pargrp_iomap *map;
1189  struct m0_client *instance = NULL;
1190  struct m0_realm realm;
1191  struct m0_parity_math *math;
1192 
1193  /* init */
1195 
1197  map->pi_ioo = ut_dummy_ioo_create(instance, 1);
1199  map->pi_ioo->ioo_oo.oo_oc.oc_op.op_entity, instance);
1200  map->pi_ioo->ioo_oo.oo_layout_instance->li_ops =
1202 
1203  math = parity_math(map->pi_ioo);
1206 
1207  /* Base cases. */
1209  &instance->m0c_pools_common.pc_cur_pver->pv_mach,
1210  0, M0_PNDS_FAILED);
1211 
1212  map->pi_state = PI_DEGRADED;
1214 
1215  for (i = 0; i < M0T1FS_LAYOUT_N; i++)
1216  map->pi_databufs[0][i]->db_flags = 0;
1217  for (i = 0; i < M0T1FS_LAYOUT_K; i++)
1218  map->pi_paritybufs[0][i]->db_flags = 0;
1219  map->pi_paritybufs[0][0]->db_flags = PA_READ_FAILED;
1220 
1221 
1223  M0_UT_ASSERT(rc == 0);
1224 
1225  /* fini */
1227  ut_dummy_ioo_delete(map->pi_ioo, instance);
1228  map->pi_ioo = NULL;
1230 }
1231 
1232 M0_INTERNAL int ut_io_pargrp_init(void)
1233 {
1234  int rc;
1236 
1237 #ifndef __KERNEL__
1239 #endif
1240 
1242 
1244  M0_UT_ASSERT(rc == 0);
1245 
1249 
1251 
1252  return 0;
1253 }
1254 
1255 M0_INTERNAL int ut_io_pargrp_fini(void)
1256 {
1261 
1262  return 0;
1263 }
1264 
1266  .ts_name = "io-pargrp-ut",
1267  .ts_init = ut_io_pargrp_init,
1268  .ts_fini = ut_io_pargrp_fini,
1269  .ts_tests = {
1270  { "data_buf_invariant",
1272  { "data_buf_invariant_nr",
1274  { "data_buf_init",
1276  { "data_buf_fini",
1278  { "data_buf_dealloc_fini",
1280  { "data_buf_alloc_init",
1282  { "pargrp_iomap_invariant",
1284  { "pargrp_iomap_invariant_nr",
1286  { "seg_collate",
1288  { "pargrp_iomap_populate",
1290  { "pargrp_iomap_fullpages_count",
1292  { "pargrp_iomap_seg_process",
1294  { "pargrp_iomap_databuf_alloc",
1296  { "pargrp_iomap_auxbuf_alloc",
1298  { "pargrp_iomap_readold_auxbuf_alloc",
1300  { "pargrp_iomap_readrest",
1302  { "pargrp_iomap_parity_recalc",
1304  { "pargrp_iomap_paritybufs_alloc",
1306  { "pargrp_iomap_spans_seg",
1308  { "pargrp_iomap_init",
1310  { "pargrp_iomap_fini",
1312  { "pargrp_src_addr",
1314  { "pargrp_id_find",
1316  { "gobj_offset",
1318  { "is_page_read",
1320  { "data_page_offset_get",
1322  { "pargrp_iomap_pages_mark_as_failed",
1324  { "unit_state",
1326  { "io_spare_map",
1328  { "mark_page_as_read_failed",
1330  { "pargrp_iomap_dgmode_process",
1332  { "pargrp_iomap_dgmode_postprocess",
1334  { "pargrp_iomap_dgmode_recover",
1336  { NULL, NULL },
1337  }
1338 };
1339 
1340 #undef M0_TRACE_SUBSYSTEM
1341 
1342 /*
1343  * Local variables:
1344  * c-indentation-style: "K&R"
1345  * c-basic-offset: 8
1346  * tab-width: 8
1347  * fill-column: 80
1348  * scroll-step: 1
1349  * End:
1350  */
struct m0_poolmach_state * pm_state
Definition: pool_machine.h:169
M0_INTERNAL void ut_dummy_paritybufs_create(struct pargrp_iomap *map, bool do_alloc)
Definition: io_dummy.c:251
M0_INTERNAL void m0_ivec_cursor_init(struct m0_ivec_cursor *cur, const struct m0_indexvec *ivec)
Definition: vec.c:707
void ut_layout_domain_empty(struct m0_client *cinst)
Definition: obj.c:218
static void ut_test_pargrp_iomap_populate(void)
Definition: io_pargrp.c:273
static void ut_test_pargrp_iomap_parity_recalc(void)
Definition: io_pargrp.c:702
#define M0_ALLOC_ARR(arr, nr)
Definition: memory.h:84
M0_INTERNAL int ut_io_pargrp_fini(void)
Definition: io_pargrp.c:1255
M0_INTERNAL void m0_fid_gob_make(struct m0_fid *gob_fid, uint32_t container, uint64_t key)
Definition: fid_convert.c:46
static struct m0_fid mock_fid
Definition: io_pargrp.c:978
Definition: client.h:788
M0_INTERNAL int m0_indexvec_alloc(struct m0_indexvec *ivec, uint32_t len)
Definition: vec.c:532
uint32_t pmi_data_count
Definition: parity_math.h:127
#define NULL
Definition: misc.h:38
static uint64_t pargrp_iomap_fullpages_count(struct pargrp_iomap *map)
Definition: io_pargrp.c:685
map
Definition: processor.c:112
struct m0_ut_suite ut_suite_io_pargrp
Definition: io_pargrp.c:47
static bool data_buf_invariant_nr(const struct pargrp_iomap *map)
Definition: io_pargrp.c:160
void * b_addr
Definition: buf.h:39
static int pargrp_iomap_populate(struct pargrp_iomap *map, struct m0_ivec_cursor *cursor, struct m0_bufvec_cursor *buf_cursor)
Definition: io_pargrp.c:578
#define DUMMY_PTR
Definition: io_pargrp.c:49
static uint32_t layout_k(const struct m0_pdclust_layout *play)
Definition: file.c:520
static int pargrp_iomap_readrest(struct pargrp_iomap *map)
Definition: io_pargrp.c:1084
static struct net_test_cmd_node * node
Definition: commands.c:72
static int pargrp_iomap_parity_recalc(struct pargrp_iomap *map)
Definition: io_pargrp.c:1163
M0_INTERNAL bool data_buf_invariant(const struct data_buf *db)
Definition: io_pargrp.c:145
static void ut_test_pargrp_iomap_fini(void)
Definition: io_pargrp.c:925
struct m0_vec ov_vec
Definition: vec.h:147
M0_INTERNAL void ut_dummy_pargrp_iomap_delete(struct pargrp_iomap *map, struct m0_client *instance)
Definition: io_dummy.c:340
static void ut_test_data_buf_dealloc_fini(void)
Definition: io_pargrp.c:172
M0_INTERNAL void ut_dummy_target_ioreq_delete(struct target_ioreq *ti)
Definition: io_dummy.c:552
static bool is_page_read(struct data_buf *dbuf)
Definition: io_pargrp.c:136
struct m0_op oc_op
struct m0_layout_enum *(* lio_to_enum)(const struct m0_layout_instance *li)
Definition: layout.h:614
M0_INTERNAL void m0_indexvec_free(struct m0_indexvec *ivec)
Definition: vec.c:553
static void ut_test_data_page_offset_get(void)
Definition: io_pargrp.c:1090
M0_INTERNAL void m0_free_aligned(void *data, size_t size, unsigned shift)
Definition: memory.c:192
static void ut_test_gobj_offset(void)
Definition: io_pargrp.c:1026
struct m0_poolnode * pst_nodes_array
Definition: pool_machine.h:105
uint64_t m0_bindex_t
Definition: types.h:80
static void ut_test_pargrp_src_addr(void)
Definition: io_pargrp.c:1018
static void ut_test_pargrp_id_find(void)
Definition: io_pargrp.c:1022
static void mock_layout_enum_get(const struct m0_layout_enum *e, uint32_t idx, const struct m0_fid *gfid, struct m0_fid *out)
Definition: io_pargrp.c:979
M0_INTERNAL void ut_dummy_data_buf_fini(struct data_buf *db)
Definition: io_dummy.c:232
static struct m0_client * dummy_instance
Definition: io_pargrp.c:46
void ut_layout_domain_fill(struct m0_client *cinst)
Definition: obj.c:208
static int void * buf
Definition: dir.c:1019
M0_INTERNAL bool pargrp_iomap_invariant(const struct pargrp_iomap *map)
Definition: io_pargrp.c:203
Definition: ut.h:77
M0_INTERNAL int ut_m0_client_init(struct m0_client **instance)
Definition: client.c:265
static struct data_buf * data_buf_alloc_init(struct m0_obj *obj, enum page_attr pattr)
Definition: io_pargrp.c:323
M0_INTERNAL struct m0_obj * ut_dummy_obj_create(void)
Definition: io_dummy.c:64
struct m0_layout_enum_type * le_type
Definition: layout.h:409
static const struct pargrp_iomap_ops iomap_ops
Definition: io_pargrp.c:2334
M0_INTERNAL void pargrp_iomap_fini(struct pargrp_iomap *map, struct m0_obj *obj)
Definition: io_pargrp.c:2467
static void ut_pargrp_iomap_free_data_buf(struct pargrp_iomap *map, int row, int col)
Definition: io_pargrp.c:265
static struct foo * obj
Definition: tlist.c:302
static struct m0_pdclust_layout * dummy_pdclust_layout
Definition: io.c:50
Definition: sock.c:887
static void ut_test_is_page_read(void)
Definition: io_pargrp.c:1055
static bool pargrp_iomap_spans_seg(struct pargrp_iomap *map, m0_bindex_t index, m0_bcount_t count)
Definition: io_pargrp.c:728
M0_INTERNAL void ut_dummy_paritybufs_delete(struct pargrp_iomap *map, bool do_free)
Definition: io_dummy.c:281
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
M0_INTERNAL bool pargrp_iomap_invariant_nr(const struct m0_op_io *ioo)
Definition: io_pargrp.c:227
m0_bindex_t * iv_index
Definition: vec.h:141
static void ut_test_pargrp_iomap_databuf_alloc(void)
Definition: io_pargrp.c:529
static char * addr
Definition: node_k.c:37
static m0_bindex_t gobj_offset(m0_bindex_t toff, struct pargrp_iomap *map, struct m0_pdclust_layout *play, struct m0_pdclust_src_addr *src)
Definition: io_pargrp.c:115
int i
Definition: dir.c:1033
static void ut_test_pargrp_iomap_seg_process(void)
Definition: io_pargrp.c:444
enum page_attr db_flags
struct m0_pools_common m0c_pools_common
M0_INTERNAL void ut_realm_entity_setup(struct m0_realm *realm, struct m0_entity *ent, struct m0_client *cinst)
Definition: client.c:60
static void ut_test_data_buf_invariant_nr(void)
Definition: io_pargrp.c:93
M0_INTERNAL struct m0_pdclust_layout * ut_get_pdclust_layout_from_ioo(struct m0_op_io *ioo)
Definition: io_dummy.c:456
static void ut_test_pargrp_iomap_dgmode_process(void)
Definition: io_pargrp.c:1152
struct m0_op_obj ioo_oo
static void ut_test_mark_page_as_read_failed(void)
Definition: io_pargrp.c:1148
static void ut_test_pargrp_iomap_init(void)
Definition: io_pargrp.c:890
static m0_bindex_t data_page_offset_get(struct pargrp_iomap *map, uint32_t row, uint32_t col)
Definition: file.c:767
struct m0_indexvec ioo_ext
M0_INTERNAL void ut_dummy_ioo_delete(struct m0_op_io *ioo, struct m0_client *instance)
Definition: io_dummy.c:463
const struct m0_layout_enum_ops * le_ops
Definition: layout.h:423
m0_bcount_t b_nob
Definition: buf.h:38
static struct m0_layout_enum_ops mock_layout_enum_ops
Definition: io_pargrp.c:986
struct m0_buf db_buf
static void data_buf_init(struct data_buf *buf, void *addr, uint64_t addr_size, uint64_t flags)
Definition: io_pargrp.c:246
M0_INTERNAL void ut_m0_client_fini(struct m0_client **instance)
Definition: client.c:354
M0_INTERNAL void ut_dummy_poolmach_delete(struct m0_pool_version *pv)
Definition: io_dummy.c:628
M0_INTERNAL struct target_ioreq * ut_dummy_target_ioreq_create(void)
Definition: io_dummy.c:532
m0_pool_nd_state
Definition: pool_machine.h:57
#define UT_DEFAULT_BLOCK_SIZE
Definition: io_pargrp.c:52
struct m0_bufvec ioo_data
static void ut_test_data_buf_invariant(void)
Definition: io_pargrp.c:57
struct m0_obj * ioo_obj
static struct m0_layout_enum * mock_layout_instance_to_enum(const struct m0_layout_instance *li)
Definition: io_pargrp.c:994
static void ut_test_pargrp_iomap_spans_seg(void)
Definition: io_pargrp.c:808
enum m0_pbuf_type ioo_pbuf_type
M0_INTERNAL int ut_dummy_poolmach_create(struct m0_pool_version *pv)
Definition: io_dummy.c:563
static int pargrp_iomap_pages_mark_as_failed(struct pargrp_iomap *map, enum m0_pdclust_unit_type type)
Definition: io_pargrp.c:1457
static void ut_test_pargrp_iomap_fullpages_count(void)
Definition: io_pargrp.c:423
M0_INTERNAL void ut_shuffle_test_order(struct m0_ut_suite *suite)
Definition: client.c:1205
static int pargrp_iomap_dgmode_postprocess(struct pargrp_iomap *map)
Definition: io_pargrp.c:1822
Definition: xcode.h:73
static int pargrp_iomap_readold_auxbuf_alloc(struct pargrp_iomap *map)
Definition: io_pargrp.c:962
M0_INTERNAL struct pargrp_iomap * ut_dummy_pargrp_iomap_create(struct m0_client *instance, int num_blocks)
Definition: io_dummy.c:301
M0_INTERNAL void ut_set_device_state(struct m0_poolmach *pm, int dev, enum m0_pool_nd_state state)
Definition: io_pargrp.c:1006
static void ut_test_pargrp_iomap_dgmode_recover(void)
Definition: io_pargrp.c:1184
m0_bcount_t * v_count
Definition: vec.h:53
static void ut_test_pargrp_iomap_pages_mark_as_failed(void)
Definition: io_pargrp.c:1110
struct m0_op_common oo_oc
static void data_buf_fini(struct data_buf *buf)
Definition: io_pargrp.c:272
static void ut_test_unit_state(void)
Definition: io_pargrp.c:1136
void(* leo_get)(const struct m0_layout_enum *e, uint32_t idx, const struct m0_fid *gfid, struct m0_fid *out)
Definition: layout.h:437
M0_INTERNAL struct data_buf * ut_dummy_data_buf_create(void)
Definition: io_dummy.c:200
static void ut_test_pargrp_iomap_paritybufs_alloc(void)
Definition: io_pargrp.c:758
static void ut_test_pargrp_iomap_invariant(void)
Definition: io_pargrp.c:214
static struct m0_pdclust_layout * pdlayout_get(const struct io_request *req)
Definition: file.c:510
static void ut_test_pargrp_iomap_auxbuf_alloc(void)
Definition: io_pargrp.c:574
uint64_t sa_unit
Definition: pdclust.h:243
static void ut_test_pargrp_iomap_invariant_nr(void)
Definition: io_pargrp.c:241
const char * ts_name
Definition: ut.h:99
static struct m0_parity_math * parity_math(struct io_request *req)
Definition: file.c:555
uint64_t n
Definition: fops.h:107
static void ut_free_pargrp_iomap(struct pargrp_iomap *map)
Definition: io_pargrp.c:853
M0_INTERNAL struct m0_pdclust_layout * ut_dummy_pdclust_layout_create(struct m0_client *instance)
Definition: io_dummy.c:79
struct m0_realm * en_realm
Definition: client.h:710
struct m0_op_io * pi_ioo
Definition: pg.h:394
M0_INTERNAL struct m0_op_io * ut_dummy_ioo_create(struct m0_client *instance, int num_io_maps)
Definition: io_dummy.c:366
static struct m0_layout_instance_ops mock_layout_instance_ops
Definition: io_pargrp.c:1002
static void ut_test_data_buf_init(void)
Definition: io_pargrp.c:132
Definition: fid.h:38
M0_BOB_DECLARE(M0_INTERNAL, m0_layout_enum)
M0_INTERNAL void ut_set_node_state(struct m0_poolmach *pm, int node, enum m0_pool_nd_state state)
Definition: io_pargrp.c:1012
static int pargrp_iomap_databuf_alloc(struct pargrp_iomap *map, uint32_t row, uint32_t col, struct m0_bufvec_cursor *data)
Definition: io_pargrp.c:877
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
static int pargrp_iomap_dgmode_recover(struct pargrp_iomap *map)
Definition: io_pargrp.c:1985
static struct m0_realm realm
Definition: sync.c:87
static int pargrp_iomap_paritybufs_alloc(struct pargrp_iomap *map)
Definition: io_pargrp.c:1296
static void ut_test_pargrp_iomap_readrest(void)
Definition: io_pargrp.c:649
#define M0T1FS_LAYOUT_K
Definition: client.h:63
struct m0_entity ob_entity
Definition: client.h:789
M0_INTERNAL m0_bindex_t m0_ivec_cursor_index(const struct m0_ivec_cursor *cur)
Definition: vec.c:733
static void ut_test_data_buf_alloc_init(void)
Definition: io_pargrp.c:184
static struct m0 instance
Definition: main.c:78
static int pargrp_iomap_seg_process(struct pargrp_iomap *map, uint32_t seg, bool rmw, uint64_t skip_buf_index, struct m0_bufvec_cursor *buf_cursor)
Definition: io_pargrp.c:755
M0_INTERNAL int ut_io_pargrp_init(void)
Definition: io_pargrp.c:1232
static void ut_test_pargrp_iomap_dgmode_postprocess(void)
Definition: io_pargrp.c:1156
static uint64_t pargrp_iomap_auxbuf_alloc(struct pargrp_iomap *map, uint32_t row, uint32_t col)
Definition: io_pargrp.c:931
static struct m0_layout_enum_type mock_layout_enum_type
Definition: io_pargrp.c:990
M0_INTERNAL void ut_dummy_obj_delete(struct m0_obj *obj)
Definition: io_dummy.c:73
struct m0_client * re_instance
Definition: client.h:873
static struct m0_layout_enum mock_layout_enum
Definition: io_pargrp.c:991
static void ut_test_seg_collate(void)
Definition: io_pargrp.c:257
struct m0_pool_version * pc_cur_pver
Definition: pool.h:220
M0_INTERNAL void m0_fid_convert_gob2cob(const struct m0_fid *gob_fid, struct m0_fid *cob_fid, uint32_t device_id)
Definition: fid_convert.c:55
#define M0T1FS_LAYOUT_N
Definition: client.h:62
#define out(...)
Definition: gen.c:41
static void ut_test_data_buf_fini(void)
Definition: io_pargrp.c:153
static void ut_test_io_spare_map(void)
Definition: io_pargrp.c:1144
M0_INTERNAL void m0_client_init_io_op(void)
Definition: io.c:815
static void data_buf_dealloc_fini(struct data_buf *buf)
Definition: io_pargrp.c:290
struct m0_fid gfid
Definition: dir.c:626
static void ut_test_pargrp_iomap_readold_auxbuf_alloc(void)
Definition: io_pargrp.c:609
struct target_ioreq * db_tioreq
void m0_free(void *data)
Definition: memory.c:146
M0_INTERNAL void ut_dummy_data_buf_delete(struct data_buf *db)
Definition: io_dummy.c:209
int32_t rc
Definition: trigger_fop.h:47
#define UT_DEFAULT_BLOCK_SHIFT
Definition: io_pargrp.c:51
M0_INTERNAL int pargrp_iomap_init(struct pargrp_iomap *map, struct m0_op_io *ioo, uint64_t grpid)
Definition: io_pargrp.c:2387
#define M0_UT_ASSERT(a)
Definition: ut.h:46
uint32_t pmi_parity_count
Definition: parity_math.h:128
struct pargrp_iomap ** ioo_iomaps