Motr  M0
fd.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_H__
26 #define __MOTR_FD_H__
27 
28 #include "layout/pdclust.h"
29 #include "conf/obj.h" /* M0_CONF_PVER_HEIGHT */
30 
98 /* import */
99 struct m0_pdclust_src_addr;
100 struct m0_confc;
101 struct m0_poolmach;
102 struct m0_pool_version;
103 
124 };
125 
126 struct m0_fd_tile {
128  uint64_t ft_rows;
132  uint64_t ft_cols;
134  uint64_t ft_G;
136  uint64_t ft_depth;
141 };
142 
145  uint64_t fpc_magic;
150  uint64_t fpc_omega;
154  struct m0_fid fpc_gfid;
155  /* Length of a permutation. */
156  uint32_t fpc_len;
170  uint64_t *fpc_lcode;
176  uint64_t *fpc_permute;
183  uint64_t *fpc_inverse;
184 };
185 
188  uint64_t fci_nr;
196  uint64_t *fci_info;
197 };
198 
199 struct m0_fd_tree {
201  uint16_t ft_depth;
207  uint64_t ft_cnt;
210 };
211 
213  /* A pointer to parent of a node. */
215  /* Level at which node resides in a tree. */
216  uint16_t ftn_depth;
217  /* Number of children a node has. */
218  uint32_t ftn_child_nr;
219  /* Index within siblings of a node. */
220  uint32_t ftn_rel_idx;
221  /* Index, when all nodes of the level ftn_depth are enumerated. */
222  uint32_t ftn_abs_idx;
223  /* An array of pointers to children. */
231 };
232 
248 M0_INTERNAL int m0_fd_tolerance_check(struct m0_conf_pver *pv,
249  uint32_t *failure_level);
265 M0_INTERNAL int m0_fd_tile_build(const struct m0_conf_pver *pv,
266  struct m0_pool_version *pool_ver,
267  uint32_t *failure_level);
268 
270 M0_INTERNAL void m0_fd_tile_destroy(struct m0_fd_tile *tile);
271 
280 M0_INTERNAL void m0_fd_src_to_tgt(const struct m0_fd_tile *tile,
281  const struct m0_pdclust_src_addr *src,
282  struct m0_pdclust_tgt_addr *tgt);
290 M0_INTERNAL void m0_fd_tgt_to_src(const struct m0_fd_tile *tile,
291  const struct m0_pdclust_tgt_addr *tgt,
292  struct m0_pdclust_src_addr *src);
293 
302 M0_INTERNAL int m0_fd_tree_build(const struct m0_conf_pver *pv,
303  struct m0_fd_tree *tree);
304 
308 M0_INTERNAL void m0_fd_tree_destroy(struct m0_fd_tree *tree);
309 
310 
318 M0_INTERNAL void m0_fd_fwd_map(struct m0_pdclust_instance *pi,
319  const struct m0_pdclust_src_addr *src,
320  struct m0_pdclust_tgt_addr *tgt);
321 
329 M0_INTERNAL void m0_fd_bwd_map(struct m0_pdclust_instance *pi,
330  const struct m0_pdclust_tgt_addr *tgt,
331  struct m0_pdclust_src_addr *src);
332 
337 M0_INTERNAL int m0_fd_perm_cache_init(struct m0_fd_perm_cache *cache,
338  uint64_t len);
339 
341 M0_INTERNAL void m0_fd_perm_cache_fini(struct m0_fd_perm_cache *cache);
342 
344 /* __MOTR_LAYOUT_FD_H__ */
345 #endif
346 
347 /*
348  * Local variables:
349  * c-indentation-style: "K&R"
350  * c-basic-offset: 8
351  * tab-width: 8
352  * fill-column: 80
353  * scroll-step: 1
354  * End:
355  */
Definition: beck.c:235
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
struct m0_fd_tile_cell * ft_cell
Definition: fd.h:140
uint64_t ft_G
Definition: fd.h:134
uint32_t ftn_child_nr
Definition: fd.h:218
uint64_t fpc_omega
Definition: fd.h:150
M0_INTERNAL void m0_fd_perm_cache_fini(struct m0_fd_perm_cache *cache)
Definition: fd.c:825
M0_INTERNAL int m0_fd_tolerance_check(struct m0_conf_pver *pv, uint32_t *failure_level)
Definition: fd.c:250
struct m0_pool_version * pv
Definition: dir.c:629
struct m0_fid fpc_gfid
Definition: fd.h:154
struct m0_pool_version pool_ver
Definition: fd.c:111
uint16_t ft_depth
Definition: fd.h:201
M0_INTERNAL int m0_fd_perm_cache_init(struct m0_fd_perm_cache *cache, uint64_t len)
Definition: fd.c:741
uint64_t ft_child[M0_CONF_PVER_HEIGHT]
Definition: fd.h:138
struct m0_fd_tree_node * ftn_parent
Definition: fd.h:214
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
M0_INTERNAL int m0_fd_tree_build(const struct m0_conf_pver *pv, struct m0_fd_tree *tree)
Definition: fd.c:598
uint64_t ft_cols
Definition: fd.h:132
uint32_t ftn_abs_idx
Definition: fd.h:222
uint64_t ft_depth
Definition: fd.h:136
M0_INTERNAL void m0_fd_tree_destroy(struct m0_fd_tree *tree)
Definition: fd.c:785
Definition: tlist.h:251
m0_ha_obj_state
Definition: note.h:119
struct m0_fd_cache_info ft_cache_info
Definition: fd.h:209
uint32_t fpc_len
Definition: fd.h:156
struct m0_pdclust_instance pi
Definition: fd.c:107
uint64_t fci_nr
Definition: fd.h:188
uint64_t fpc_magic
Definition: fd.h:145
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
struct m0_tl ft_perm_cache
Definition: fd.h:205
uint64_t * fpc_inverse
Definition: fd.h:183
uint64_t ft_cnt
Definition: fd.h:207
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
struct m0_fd_tree_node * ft_root
Definition: fd.h:203
struct m0_fd_tree_node ** ftn_children
Definition: fd.h:224
Definition: fid.h:38
uint32_t ftn_rel_idx
Definition: fd.h:220
uint16_t ftn_depth
Definition: fd.h:216
uint64_t * fci_info
Definition: fd.h:196
M0_INTERNAL void m0_fd_tile_destroy(struct m0_fd_tile *tile)
Definition: fd.c:590
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
Definition: fd.h:126
uint64_t * fpc_permute
Definition: fd.h:176
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
struct m0_pdclust_tgt_addr ftc_tgt
Definition: fd.h:118
struct m0_pdclust_src_addr src
Definition: fd.c:108
enum m0_ha_obj_state ftn_ha_state
Definition: fd.h:230
struct m0_pdclust_src_addr ftc_src
Definition: fd.h:123
uint64_t ft_rows
Definition: fd.h:128
uint64_t * fpc_lcode
Definition: fd.h:170