Motr  M0
fd.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2012-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 "fd/fd.h"
24 #include "fd/fd_internal.h" /* m0_fd__tree_root_create */
25 #include "fd/ut/common.h" /* la_N */
26 #include "pool/pool.h" /* m0_pool_version */
27 #include "conf/confc.h" /* m0_confc */
28 #include "conf/diter.h" /* m0_conf_diter */
29 #include "conf/obj_ops.h" /* M0_CONF_DIRNEXT */
30 #include "lib/memory.h" /* m0_alloc */
31 #include "lib/fs.h" /* m0_file_read */
32 #include "lib/errno.h" /* EINVAL */
33 #include "conf/ut/common.h" /* m0_conf_ut_ast_thread_init */
34 #include "ut/ut.h" /* M0_UT_ASSERT */
35 
36 /* Conf parameters. */
37 
38 #ifdef __KERNEL__
39 static const char local_conf_str[] = "[35:\
40  {0x74| ((^t|1:0), 1, (11, 22), ^o|1:23, ^v|1:24, 41212,\
41  [3: \"param-0\", \"param-1\", \"param-2\"],\
42  [1: ^n|1:2],\
43  [1: ^S|2:15],\
44  [1: ^o|1:23],\
45  [1: ^p|1:0],\
46  [0])},\
47  {0x70| ((^p|1:0), [1: ^o|1:23])},\
48  {0x6e| ((^n|1:2), 16000, 2, 3, 2, [1: ^r|1:3])},\
49  {0x72| ((^r|1:3), [1:3], 0, 0, 0, 0, \"addr-0\", [6: ^s|1:4,\
50  ^s|1:5,\
51  ^s|1:6,\
52  ^s|1:7,\
53  ^s|1:8,\
54  ^s|1:9])},\
55  {0x73| ((^s|1:4), @M0_CST_MDS, [3: \"addr-0\", \"addr-1\", \"addr-2\"], [0],\
56  [0])},\
57  {0x73| ((^s|1:5), @M0_CST_IOS, [3: \"addr-0\", \"addr-1\", \"addr-2\"], [0],\
58  [5: ^d|1:10, ^d|1:11, ^d|1:12, ^d|1:13, ^d|1:14])},\
59  {0x73| ((^s|1:6), @M0_CST_CONFD, [3: \"addr-0\", \"addr-1\", \"addr-2\"],\
60  [0], [0])},\
61  {0x73| ((^s|1:7), @M0_CST_RMS, [3: \"addr-0\", \"addr-1\", \"addr-2\"], [0],\
62  [0])},\
63  {0x73| ((^s|1:8), @M0_CST_HA, [3: \"addr-0\", \"addr-1\", \"addr-2\"], [0],\
64  [0])},\
65  {0x73| ((^s|1:9), @M0_CST_IOS, [1: \"addr-3\"], [0], [0])},\
66  {0x64| ((^d|1:10), 1, 4, 1, 4096, 596000000000, 3, 4, \"/dev/sdev0\")},\
67  {0x64| ((^d|1:11), 2, 4, 1, 4096, 596000000000, 3, 4, \"/dev/sdev1\")},\
68  {0x64| ((^d|1:12), 3, 7, 2, 8192, 320000000000, 2, 4, \"/dev/sdev2\")},\
69  {0x64| ((^d|1:13), 4, 7, 2, 8192, 320000000000, 2, 4, \"/dev/sdev3\")},\
70  {0x64| ((^d|1:14), 5, 7, 2, 8192, 320000000000, 2, 4, \"/dev/sdev4\")},\
71  {0x53| ((^S|2:15), [1: ^a|1:15], [1: ^v|1:24])},\
72  {0x61| ((^a|1:15), [1: ^e|1:16], [1: ^v|1:24])},\
73  {0x65| ((^e|1:16), ^n|1:2, [1: ^c|1:17], [1: ^v|1:24])},\
74  {0x63| ((^c|1:17), [5: ^k|1:18, ^k|1:19, ^k|1:20,\
75  ^k|1:21, ^k|1:22], [1: ^v|1:24])},\
76  {0x6b| ((^k|1:18), ^d|1:10, [1: ^v|1:24])},\
77  {0x6b| ((^k|1:19), ^d|1:11, [1: ^v|1:24])},\
78  {0x6b| ((^k|1:20), ^d|1:12, [1: ^v|1:24])},\
79  {0x6b| ((^k|1:21), ^d|1:13, [1: ^v|1:24])},\
80  {0x6b| ((^k|1:22), ^d|1:14, [1: ^v|1:24])},\
81  {0x6f| ((^o|1:23), 0, [1: ^v|1:24])},\
82  {0x76| ((^v|1:24), {0| (3, 1, 1, 5, [5: 0,0,0,0,1], [1: ^j|3:25])})},\
83  {0x6a| ((^j|3:25), ^S|2:15, [1: ^j|1:25])},\
84  {0x6a| ((^j|1:25), ^a|1:15, [1: ^j|1:26])},\
85  {0x6a| ((^j|1:26), ^e|1:16, [1: ^j|1:27])},\
86  {0x6a| ((^j|1:27), ^c|1:17, [5: ^j|1:28, ^j|1:29,\
87  ^j|1:30, ^j|1:31, ^j|1:32])},\
88  {0x6a| ((^j|1:28), ^k|1:18, [0])},\
89  {0x6a| ((^j|1:29), ^k|1:19, [0])},\
90  {0x6a| ((^j|1:30), ^k|1:20, [0])},\
91  {0x6a| ((^j|1:31), ^k|1:21, [0])},\
92  {0x6a| ((^j|1:32), ^k|1:22, [0])}]";
93 #endif
94 
96  .pa_N = la_N,
97  .pa_K = la_K,
98  .pa_S = la_S,
99  .pa_P = la_N + la_K + la_S,
100  .pa_unit_size = 4096,
101  .pa_seed = {
102  .u_hi = 0,
103  .u_lo = 0,
104  }
105 };
106 
112 
113 static uint32_t parity_group_size(struct m0_pdclust_attr *la_attr);
114 static uint32_t pool_width_count(uint64_t *children, uint32_t depth);
115 static bool __filter_pv(const struct m0_conf_obj *obj);
116 static uint64_t real_child_cnt_get(uint64_t level);
117 static uint64_t pool_width_calc(struct m0_fd_tree *tree);
118 static void tree_generate(struct m0_pool_version *pv, enum tree_attr ta);
119 static void fd_mapping_check(struct m0_pool_version *pv);
120 static bool is_tgt_failed(struct m0_pool_version *pv,
121  struct m0_pdclust_tgt_addr *tgt,
122  uint64_t *failed_domains);
123 static void failed_nodes_mark(struct m0_fd_tree *tree, uint32_t level,
124  uint64_t tol, uint64_t *failed_domains);
125 static void fd_tolerance_check(struct m0_pool_version *pv);
126 
127 static void test_fd_mapping_sanity(enum tree_attr ta)
128 {
129 
130  /* Construct a failure domains tree. */
131  M0_SET0(&pool_ver);
132  tree_generate(&pool_ver, ta);
136 }
137 
138 static void tree_generate(struct m0_pool_version *pv, enum tree_attr ta)
139 {
140  uint64_t G;
141  uint64_t P;
142  int rc;
143  uint64_t children_cnt;
144  int i;
145 
146  P = 1;
148  while (G > P) {
150  M0_UT_ASSERT(rc == 0);
151  children_cnt = fd_ut_random_cnt_get(TUA_RACKS);
152  rc = m0_fd__tree_root_create(&pv->pv_fd_tree, children_cnt);
153  M0_UT_ASSERT(rc == 0);
154  for (i = 1; i < M0_CONF_PVER_HEIGHT; ++i) {
155  children_cnt = real_child_cnt_get(i);
156  children_cnt = i == pv->pv_fd_tree.ft_depth ? 0 :
157  children_cnt;
159  children_cnt, i,
160  ta);
161  M0_UT_ASSERT(rc == 0);
162  }
164  M0_UT_ASSERT(rc == 0);
166  if (G > P)
168  }
169  /* Get the attributes of symmetric tree. */
174  M0_UT_ASSERT(rc == 0);
176 }
177 
178 static uint64_t pool_width_calc(struct m0_fd_tree *tree)
179 {
180  struct m0_fd__tree_cursor cursor;
181  uint64_t P;
182  int rc;
183 
184  rc = m0_fd__tree_cursor_init(&cursor, tree, tree->ft_depth);
185  M0_UT_ASSERT(rc == 0);
186  P = 1;
187  while (m0_fd__tree_cursor_next(&cursor))
188  ++P;
189  return P;
190 }
191 
192 static void fd_mapping_check(struct m0_pool_version *pv)
193 {
194  struct m0_pdclust_instance pi;
195  uint64_t C;
196  m0_time_t seed;
197  uint64_t omega;
198  uint64_t row;
199  uint64_t col;
200  uint64_t unmapped;
201  uint64_t P;
202 
203  M0_SET0(&src);
204  M0_SET0(&src_new);
205  M0_SET0(&tgt);
206  pi.pi_base.li_l = m0_alloc(sizeof pi.pi_base.li_l[0]);
209  pv->pv_fd_tile.ft_G;
210  seed = m0_time_now();
211  omega = m0_rnd(123456, &seed);
212  pi.pi_base.li_l->l_pver = pv;
214  for (row = omega * C; row < (omega + 1) * C; ++row) {
215  src.sa_group = row;
216  for (col = 0; col < pv->pv_fd_tile.ft_G; ++col) {
217  src.sa_unit = col;
218  M0_SET0(&src_new);
219  m0_fd_fwd_map(&pi, &src, &tgt);
220  m0_fd_bwd_map(&pi, &tgt, &src_new);
223  }
224  }
225  /* Sanity check for unmapped targets. */
226  unmapped = 0;
227  tgt.ta_frame = omega * pv->pv_fd_tile.ft_rows;
229  for (tgt.ta_obj = 0; tgt.ta_obj < P; ++tgt.ta_obj) {
230  m0_fd_bwd_map(&pi, &tgt, &src_new);
231  if (src_new.sa_group == ~(uint64_t)0 &&
232  src_new.sa_unit == ~(uint64_t)0)
233  ++unmapped;
234  }
235  M0_UT_ASSERT(unmapped + pv->pv_fd_tile.ft_cols == P);
238 }
239 
240 static uint64_t real_child_cnt_get(uint64_t level)
241 {
243 
244  switch (level) {
245  case 0:
246  return TUA_RACKS;
247  case 1:
248  return TUA_ENC;
249  case 2:
250  return TUA_CON;
251  case 3:
252  return TUA_DISKS;
253  case 4:
254  return 0;
255  }
256  return 0;
257 }
258 
259 static void test_ft_mapping(void)
260 {
261  uint64_t row;
262  uint64_t col;
263  uint64_t G;
264  uint64_t C;
265  uint64_t P;
266  uint64_t *children_nr;
267  uint64_t omega;
268  m0_time_t seed;
269  uint32_t depth;
270  int rc;
271 
272 
273  M0_SET0(&pool_ver);
275  P = pd_attr.pa_K;
276  children_nr = pool_ver.pv_fd_tile.ft_child;
277  M0_SET0(&src);
278  M0_SET0(&src_new);
279  M0_SET0(&tgt);
280  for (depth = 1; depth < M0_CONF_PVER_HEIGHT; ++depth) {
281  while (G > P || P > TUA_MAX_POOL_WIDTH) {
282  fd_ut_children_populate(children_nr, depth);
283  P = pool_width_count(children_nr, depth);
284  }
287  depth);
288  M0_UT_ASSERT(rc == 0);
290  C = (pool_ver.pv_fd_tile.ft_rows * P) / G;
291  seed = m0_time_now();
292  omega = m0_rnd(123456, &seed);
293  for (row = omega * C; row < (omega + 1) * C; ++row) {
294  src.sa_group = row;
295  for (col = 0; col < G; ++col) {
296  src.sa_unit = col;
297  M0_SET0(&src_new);
299  &tgt);
301  &src_new);
304  }
305  }
307  P = la_K;
308  }
309 }
310 
311 static uint32_t parity_group_size(struct m0_pdclust_attr *la_attr)
312 {
313  M0_UT_ASSERT(la_attr != NULL);
314 
315  return la_attr->pa_N + la_attr->pa_K + la_attr->pa_S;
316 
317 }
318 
319 static uint32_t pool_width_count(uint64_t *children, uint32_t depth)
320 {
321  uint32_t i;
322  uint32_t cnt = 1;
323 
324  for (i = 0; i < depth; ++i) {
325  cnt *= children[i];
326  }
327 
328  return cnt;
329 }
330 
331 static void test_pv2fd_conv(void)
332 {
333  struct m0_confc *confc;
334  struct m0_conf_obj *root_obj = NULL;
335  struct m0_conf_diter it;
336  struct m0_conf_obj *pv_obj;
337  struct m0_conf_pver *pv;
338 #ifndef __KERNEL__
339  char *confstr = NULL;
340 #endif
341  uint32_t failure_level = 0;
342  uint64_t max_failures = 1;
343  int i;
344  int rc;
345 
347  M0_SET0(confc);
348  M0_SET0(&pool_ver);
349 #ifndef __KERNEL__
350  rc = m0_file_read(M0_SRC_PATH("fd/ut/failure-domains.xc"), &confstr);
351  M0_UT_ASSERT(rc == 0);
352  rc = m0_confc_init(confc, &m0_conf_ut_grp, NULL, NULL, confstr);
353  M0_UT_ASSERT(rc == 0);
354  m0_free0(&confstr);
355 #else
356  rc = m0_confc_init(confc, &m0_conf_ut_grp, NULL, NULL, local_conf_str);
357  M0_UT_ASSERT(rc == 0);
358 #endif
359  rc = m0_confc_open_sync(&root_obj, confc->cc_root, M0_FID0);
360  M0_UT_ASSERT(rc == 0);
361  rc = m0_conf_diter_init(&it, confc, root_obj,
362  M0_CONF_ROOT_POOLS_FID,
363  M0_CONF_POOL_PVERS_FID);
364  M0_UT_ASSERT(rc == 0);
369 
370  /*
371  * Figure out the first level for which user specified tolerance is
372  * non-zero.
373  */
374  for (i = 0; i < M0_CONF_PVER_HEIGHT; ++i)
375  if (pv->pv_u.subtree.pvs_tolerance[i] != 0) {
376  max_failures = pv->pv_u.subtree.pvs_tolerance[i];
377  failure_level = i;
378  break;
379  }
380  /*
381  * We intend to test those cases whenever supported cases are greater
382  * than or equal to the actual failures.
383  */
384 #ifndef __KERNEL__
386  pv->pv_u.subtree.pvs_tolerance[failure_level] = 0;
387 #else
388  max_failures = 1;
389 #endif
390  for (i = 0; i < max_failures; ++i) {
391  rc = m0_fd_tile_build(pv, &pool_ver, &failure_level);
392  M0_UT_ASSERT(rc == 0);
394  M0_UT_ASSERT(rc == 0);
395  memcpy(pool_ver.pv_fd_tol_vec, pv->pv_u.subtree.pvs_tolerance,
401  ++pv->pv_u.subtree.pvs_tolerance[failure_level];
402  }
403  /* Test the case when entire tolerance vector is zero. */
404  memset(pv->pv_u.subtree.pvs_tolerance, 0,
405  M0_CONF_PVER_HEIGHT * sizeof pv->pv_u.subtree.pvs_tolerance[0]);
406  memcpy(pool_ver.pv_fd_tol_vec, pv->pv_u.subtree.pvs_tolerance,
408  pv->pv_u.subtree.pvs_attr.pa_K = 0;
409  pv->pv_u.subtree.pvs_attr.pa_S = 0;
410  rc = m0_fd_tile_build(pv, &pool_ver, &failure_level);
411  M0_UT_ASSERT(rc == 0);
414  M0_UT_ASSERT(rc == 0);
419 
421  m0_confc_close(root_obj);
423  m0_free(confc);
424 }
425 
426 static bool __filter_pv(const struct m0_conf_obj *obj)
427 {
429 }
430 
431 static uint64_t pv2tree_level_conv(uint64_t level, uint64_t tree_depth)
432 {
433  M0_PRE(tree_depth < M0_CONF_PVER_HEIGHT);
434  return level - ((M0_CONF_PVER_HEIGHT - 1) - tree_depth);
435 }
436 
438 {
439  struct m0_pdclust_instance pi;
440  uint64_t C;
441  uint64_t omega;
442  uint64_t row;
443  uint64_t col;
444  m0_time_t seed;
445  uint32_t i;
446  uint32_t fail_cnt;
447  uint32_t tol;
448  uint64_t *failed_domains;
449 
451  tol = pv->pv_fd_tol_vec[i];
452  if (tol == 0)
453  continue;
454  failed_domains = m0_alloc(tol * sizeof failed_domains[0]);
455  failed_nodes_mark(&pv->pv_fd_tree, i, tol, failed_domains);
456  pi.pi_base.li_l = m0_alloc(sizeof pi.pi_base.li_l[0]);
459  pv->pv_fd_tile.ft_G;
460  seed = m0_time_now();
461  omega = m0_rnd(123456, &seed);
462  pi.pi_base.li_l->l_pver = pv;
464  fail_cnt = 0;
465  for (row = omega * C; row < (omega + 1) * C; ++row) {
466  src.sa_group = row;
467  for (col = 0; col < pv->pv_fd_tile.ft_G; ++col) {
468  src.sa_unit = col;
469  m0_fd_fwd_map(&pi, &src, &tgt);
470  if (is_tgt_failed(pv, &tgt, failed_domains))
471  ++fail_cnt;
472  M0_UT_ASSERT(fail_cnt <=
474  }
475  fail_cnt = 0;
476  }
477  m0_free(failed_domains);
479  }
480 }
481 
482 static void failed_nodes_mark(struct m0_fd_tree *tree, uint32_t level,
483  uint64_t tol, uint64_t *failed_domains)
484 {
485  struct m0_fd__tree_cursor cursor;
486  struct m0_fd_tree_node *node;
487  uint32_t toss;
488  uint32_t cnt;
489  uint32_t tree_level;
490  int rc;
491  m0_time_t seed;
492 
493  cnt = 0;
494  tree_level = pv2tree_level_conv(level, tree->ft_depth);
495  while (cnt < tol) {
496  rc = m0_fd__tree_cursor_init(&cursor, tree, tree_level);
497  M0_UT_ASSERT(rc == 0);
498  toss = 0;
499  seed = m0_time_now();
500  do {
501  toss = m0_rnd(2, &seed);
502  node = *(m0_fd__tree_cursor_get(&cursor));
503  } while (toss == 0 && m0_fd__tree_cursor_next(&cursor));
504 
505  if (node->ftn_ha_state != M0_NC_FAILED) {
506  node->ftn_ha_state = M0_NC_FAILED;
507  failed_domains[cnt] = node->ftn_abs_idx;
508  ++cnt;
509  }
510  }
511 }
512 
513 static bool is_tgt_failed(struct m0_pool_version *pv,
514  struct m0_pdclust_tgt_addr *tgt,
515  uint64_t *failed_domains)
516 {
517  struct m0_fd__tree_cursor cursor;
518  uint64_t i;
519  uint64_t P;
520  int rc;
521 
523  M0_UT_ASSERT(tgt->ta_obj < P);
526  M0_UT_ASSERT(rc == 0);
527  i = 0;
528  while (i < tgt->ta_obj) {
529  m0_fd__tree_cursor_next(&cursor);
530  ++i;
531  }
532  return (*(m0_fd__tree_cursor_get(&cursor)))->ftn_ha_state != M0_NC_ONLINE;
533 }
534 
535 void test_fd_mapping(void)
536 {
539 }
540 
542  .ts_name = "failure_domains-ut",
543  .ts_init = m0_conf_ut_ast_thread_init,
544  .ts_fini = m0_conf_ut_ast_thread_fini,
545  .ts_tests = {
546  {"test_ft_mapping", test_ft_mapping},
547  {"test_pv2fd_conv", test_pv2fd_conv},
548  {"test_fd_mapping", test_fd_mapping},
549  { NULL, NULL }
550  }
551 };
const struct m0_conf_obj_type * m0_conf_obj_type(const struct m0_conf_obj *obj)
Definition: obj.c:363
Definition: common.h:38
struct m0_conf_obj * cc_root
Definition: confc.h:404
M0_INTERNAL int m0_fd_tile_build(const struct m0_conf_pver *pv, struct m0_pool_version *pool_ver, uint32_t *failure_level)
Definition: fd.c:260
#define M0_PRE(cond)
uint64_t ft_G
Definition: fd.h:134
struct m0_layout * li_l
Definition: layout.h:590
uint64_t sa_group
Definition: pdclust.h:241
#define NULL
Definition: misc.h:38
M0_INTERNAL void fd_ut_symm_tree_get(struct m0_fd_tree *tree, uint64_t *children_nr)
Definition: common.c:130
struct m0_pool_version * l_pver
Definition: layout.h:261
uint32_t pa_N
Definition: pdclust.h:104
struct m0_pool_version * pv
Definition: dir.c:629
uint64_t m0_time_t
Definition: time.h:37
enum m0_trace_level level
Definition: trace.c:111
uint32_t pv_fd_tol_vec[M0_CONF_PVER_HEIGHT]
Definition: pool.h:141
M0_INTERNAL int m0_file_read(const char *path, char **out)
Definition: fs.c:61
const struct m0_conf_obj_type M0_CONF_PVER_TYPE
Definition: pver.c:260
M0_INTERNAL void fd_ut_children_populate(uint64_t *children, uint32_t depth)
Definition: common.c:56
static struct net_test_cmd_node * node
Definition: commands.c:72
struct m0_layout_instance pi_base
Definition: pdclust.h:173
uint32_t pa_K
Definition: pdclust.h:107
struct m0_pool_version pool_ver
Definition: fd.c:111
M0_INTERNAL int m0_confc_init(struct m0_confc *confc, struct m0_sm_group *sm_group, const char *confd_addr, struct m0_rpc_machine *rpc_mach, const char *local_conf)
Definition: confc.c:560
M0_INTERNAL int m0_pdclust_perm_cache_build(struct m0_layout *layout, struct m0_pdclust_instance *pi)
Definition: pdclust.c:805
M0_INTERNAL int m0_conf_diter_next_sync(struct m0_conf_diter *it, bool(*filter)(const struct m0_conf_obj *obj))
Definition: diter.c:555
uint16_t ft_depth
Definition: fd.h:201
uint64_t ta_obj
Definition: pdclust.h:256
Definition: common.h:30
static struct m0_be_emap_cursor it
Definition: extmap.c:46
struct m0_conf_obj pv_obj
Definition: obj.h:533
M0_INTERNAL void m0_confc_fini(struct m0_confc *confc)
Definition: confc.c:570
M0_INTERNAL int m0_fd__tree_cursor_next(struct m0_fd__tree_cursor *cursor)
Definition: fd_tree.c:142
uint32_t pa_S
Definition: pdclust.h:110
void test_fd_mapping(void)
Definition: fd.c:535
#define M0_SRC_PATH(name)
Definition: misc.h:48
#define M0_SET0(obj)
Definition: misc.h:64
Definition: ut.h:77
Definition: common.h:71
M0_INTERNAL int m0_fd__tree_root_create(struct m0_fd_tree *tree, uint64_t root_children)
Definition: fd_tree.c:181
static void fd_tolerance_check(struct m0_pool_version *pv)
Definition: fd.c:437
Definition: common.h:29
static void test_ft_mapping(void)
Definition: fd.c:259
static struct foo * obj
Definition: tlist.c:302
static uint64_t pool_width_calc(struct m0_fd_tree *tree)
Definition: fd.c:178
static void test_fd_mapping_sanity(enum tree_attr ta)
Definition: fd.c:127
uint64_t ft_child[M0_CONF_PVER_HEIGHT]
Definition: fd.h:138
Definition: common.h:31
M0_INTERNAL void m0_fd_tgt_to_src(const struct m0_fd_tile *tile, const struct m0_pdclust_tgt_addr *tgt, struct m0_pdclust_src_addr *src)
Definition: fd.c:571
int i
Definition: dir.c:1033
M0_INTERNAL int m0_fd_tree_build(const struct m0_conf_pver *pv, struct m0_fd_tree *tree)
Definition: fd.c:598
static unsigned depth
Definition: base.c:377
struct m0_ut_suite failure_domains_ut
Definition: fd.c:541
struct m0_pdclust_src_addr src_new
Definition: fd.c:109
uint64_t ft_cols
Definition: fd.h:132
M0_INTERNAL uint64_t m0_rnd(uint64_t max, uint64_t *seed)
Definition: misc.c:115
Definition: cnt.h:36
struct m0_pdclust_attr pd_attr
Definition: fd.c:95
struct m0_fd_tree pv_fd_tree
Definition: pool.h:139
M0_INTERNAL int m0_conf_ut_ast_thread_fini(void)
Definition: common.c:96
uint64_t ft_depth
Definition: fd.h:136
#define m0_free0(pptr)
Definition: memory.h:77
static struct m0_confc * confc
Definition: file.c:94
m0_time_t m0_time_now(void)
Definition: time.c:134
M0_INTERNAL void m0_fd_tree_destroy(struct m0_fd_tree *tree)
Definition: fd.c:785
uint64_t ta_frame
Definition: pdclust.h:254
struct m0_fd_tile pv_fd_tile
Definition: pool.h:136
void * m0_alloc(size_t size)
Definition: memory.c:126
static bool __filter_pv(const struct m0_conf_obj *obj)
Definition: fd.c:426
struct m0_pdclust_instance pi
Definition: fd.c:107
static void test_pv2fd_conv(void)
Definition: fd.c:331
struct m0_sm_group m0_conf_ut_grp
Definition: common.c:32
M0_INTERNAL void m0_fd_bwd_map(struct m0_pdclust_instance *pi, const struct m0_pdclust_tgt_addr *tgt, struct m0_pdclust_src_addr *src)
Definition: fd.c:959
#define M0_CONF_CAST(ptr, type)
Definition: obj.h:780
#define m0_confc_open_sync(result, origin,...)
Definition: confc.h:707
static uint32_t pool_width_count(uint64_t *children, uint32_t depth)
Definition: fd.c:319
tree_attr
Definition: common.h:68
M0_INTERNAL int m0_conf_ut_ast_thread_init(void)
Definition: common.c:86
uint64_t sa_unit
Definition: pdclust.h:243
M0_INTERNAL struct m0_conf_obj * m0_conf_diter_result(const struct m0_conf_diter *it)
Definition: diter.c:576
#define m0_conf_diter_init(iter, confc, origin,...)
Definition: diter.h:235
const char * ts_name
Definition: ut.h:99
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
static uint64_t real_child_cnt_get(uint64_t level)
Definition: fd.c:240
#define M0_ALLOC_PTR(ptr)
Definition: memory.h:86
M0_INTERNAL void m0_conf_diter_fini(struct m0_conf_diter *it)
Definition: diter.c:313
M0_INTERNAL int m0_fd__perm_cache_build(struct m0_fd_tree *tree)
Definition: fd.c:683
M0_INTERNAL int fd_ut_tree_level_populate(struct m0_fd_tree *tree, uint64_t max_children, uint16_t level, enum tree_attr ta)
Definition: common.c:69
static void failed_nodes_mark(struct m0_fd_tree *tree, uint32_t level, uint64_t tol, uint64_t *failed_domains)
Definition: fd.c:482
M0_INTERNAL uint64_t fd_ut_random_cnt_get(uint64_t max_cnt)
Definition: common.c:159
M0_INTERNAL void m0_confc_close(struct m0_conf_obj *obj)
Definition: confc.c:921
#define C(v)
M0_INTERNAL void m0_pdclust_perm_cache_destroy(struct m0_layout *layout, struct m0_pdclust_instance *pi)
Definition: pdclust.c:789
M0_INTERNAL void m0_fd_tile_destroy(struct m0_fd_tile *tile)
Definition: fd.c:590
M0_INTERNAL void m0_fd__tile_populate(struct m0_fd_tile *tile)
Definition: fd.c:487
Definition: fd.h:199
M0_INTERNAL void m0_fd_src_to_tgt(const struct m0_fd_tile *tile, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt)
Definition: fd.c:547
M0_INTERNAL int m0_fd__tile_init(struct m0_fd_tile *tile, const struct m0_pdclust_attr *la_attr, uint64_t *children, uint64_t depth)
Definition: fd.c:204
Definition: finject.c:60
Definition: common.h:40
#define M0_FID0
Definition: fid.h:93
M0_INTERNAL void m0_fd_fwd_map(struct m0_pdclust_instance *pi, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt)
Definition: fd.c:838
static void fd_mapping_check(struct m0_pool_version *pv)
Definition: fd.c:192
Definition: module.c:67
void m0_free(void *data)
Definition: memory.c:146
M0_INTERNAL int fd_ut_tree_init(struct m0_fd_tree *tree, uint64_t tree_depth)
Definition: common.c:114
static uint64_t pv2tree_level_conv(uint64_t level, uint64_t tree_depth)
Definition: fd.c:431
static void tree_generate(struct m0_pool_version *pv, enum tree_attr ta)
Definition: fd.c:138
struct m0_pdclust_src_addr src
Definition: fd.c:108
int32_t rc
Definition: trigger_fop.h:47
uint64_t ft_rows
Definition: fd.h:128
M0_INTERNAL int m0_fd__tree_cursor_init(struct m0_fd__tree_cursor *cursor, const struct m0_fd_tree *tree, uint16_t depth)
Definition: fd_tree.c:62
#define M0_UT_ASSERT(a)
Definition: ut.h:46
static bool is_tgt_failed(struct m0_pool_version *pv, struct m0_pdclust_tgt_addr *tgt, uint64_t *failed_domains)
Definition: fd.c:513
M0_INTERNAL struct m0_fd_tree_node ** m0_fd__tree_cursor_get(struct m0_fd__tree_cursor *cursor)
Definition: fd_tree.c:136
static uint32_t parity_group_size(struct m0_pdclust_attr *la_attr)
Definition: fd.c:311