Motr  M0
common.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_FD_UT_COMMON_H__
26 #define __MOTR_FD_UT_COMMON_H__
27 
29  la_N = 8,
30  la_K = 2,
31  la_S = 2
32 };
33 
35  /* Max number of racks in a pool version. */
36  TUA_RACKS = 8,
37  /* Max number of enclosures per rack. */
38  TUA_ENC = 7,
39  /* Max number of controllers per enclosure. */
40  TUA_CON = 2,
41  /* Max number of disks per controller. */
42  TUA_DISKS = 82,
43  TUA_ITER = 20,
44  /* Max number of children for any node in UT for the m0_fd_tree-tree. */
46  /* Maximum pool width of system. */
48 };
51 
52 enum tree_type {
59 };
60 
62  /* Generation with deterministic parameters. */
64  /* Generation with random parameters. */
66 };
67 
68 enum tree_attr {
69  /* A tree in which all nodes at same level have same number of
70  * children. */
72  /* A tree that is not TA_SYMM. */
74 };
75 
76 M0_INTERNAL int fd_ut_tree_init(struct m0_fd_tree *tree, uint64_t tree_depth);
77 
78 M0_INTERNAL void fd_ut_children_populate(uint64_t *child_nr, uint32_t length);
79 
80 
81 M0_INTERNAL void fd_ut_symm_tree_create(struct m0_fd_tree *tree,
82  enum tree_gen_type tg_type,
83  uint64_t *child_nr, uint64_t depth);
84 
85 M0_INTERNAL int fd_ut_tree_level_populate(struct m0_fd_tree *tree,
86  uint64_t children, uint16_t level,
87  enum tree_attr ta);
88 
89 M0_INTERNAL void fd_ut_symm_tree_get(struct m0_fd_tree *tree, uint64_t *children_nr);
90 M0_INTERNAL uint64_t fd_ut_random_cnt_get(uint64_t max_cnt);
91 
92 #endif
93 /*
94  * Local variables:
95  * c-indentation-style: "K&R"
96  * c-basic-offset: 8
97  * tab-width: 8
98  * fill-column: 80
99  * scroll-step: 1
100  * End:
101  */
Definition: common.h:38
tree_gen_type
Definition: common.h:61
M0_INTERNAL int fd_ut_tree_level_populate(struct m0_fd_tree *tree, uint64_t children, uint16_t level, enum tree_attr ta)
Definition: common.c:69
M0_INTERNAL void fd_ut_children_populate(uint64_t *child_nr, uint32_t length)
Definition: common.c:56
enum m0_trace_level level
Definition: trace.c:111
Definition: common.h:30
M0_BASSERT(TUA_CHILD_NR_MAX >=la_N+la_K+la_S &&TUA_MAX_POOL_WIDTH >=TUA_CHILD_NR_MAX)
Definition: common.h:71
Definition: common.h:29
layout_attr
Definition: common.h:28
Definition: common.h:31
tree_ut_attr
Definition: common.h:34
static unsigned depth
Definition: base.c:377
M0_INTERNAL void fd_ut_symm_tree_get(struct m0_fd_tree *tree, uint64_t *children_nr)
Definition: common.c:130
M0_INTERNAL uint64_t fd_ut_random_cnt_get(uint64_t max_cnt)
Definition: common.c:159
tree_type
Definition: common.h:52
M0_INTERNAL void fd_ut_symm_tree_create(struct m0_fd_tree *tree, enum tree_gen_type tg_type, uint64_t *child_nr, uint64_t depth)
Definition: common.c:33
M0_INTERNAL int fd_ut_tree_init(struct m0_fd_tree *tree, uint64_t tree_depth)
Definition: common.c:114
tree_attr
Definition: common.h:68
Definition: common.h:53
Definition: common.h:58
Definition: fd.h:199
Definition: common.h:40