Motr  M0
pdclust.h
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 #pragma once
24 
25 #ifndef __MOTR_LAYOUT_PDCLUST_H__
26 #define __MOTR_LAYOUT_PDCLUST_H__
27 
71 /* import */
72 #include "lib/arith.h" /* M0_IS_8ALIGNED */
73 #include "sns/parity_math.h"
74 #include "layout/layout.h"
75 
76 #define M0_PDCLUST_SEED "upjumpandpumpim,"
77 
78 struct m0_pool;
79 
80 /* export */
81 struct m0_pdclust_attr;
83 struct m0_pdclust_layout;
84 struct m0_pdclust_instance;
85 struct m0_pdclust_src_addr;
86 struct m0_pdclust_tgt_addr;
87 
94 };
95 
104  uint32_t pa_N;
105 
107  uint32_t pa_K;
108 
110  uint32_t pa_S;
111 
115  uint32_t pa_P;
116 
118  uint64_t pa_unit_size;
119 
122 };
123 
131  uint32_t pr_let_id;
132 
134 };
136 
155  uint32_t pl_C;
160  uint32_t pl_L;
161 
162  uint64_t pl_magic;
163 };
164 
172  /* Super class, storing pointer to the layout being used. */
184  struct tile_cache {
186  uint64_t tc_tile_no;
187 
194  uint32_t *tc_permute;
195 
202  uint32_t *tc_inverse;
203 
217  uint32_t *tc_lcode;
218  } pi_tile_cache;
219 
220  uint64_t pi_cache_nr;
224 
225  uint64_t pi_magic;
226 
231 };
232 
241  uint64_t sa_group;
243  uint64_t sa_unit;
244 };
245 
254  uint64_t ta_frame;
256  uint64_t ta_obj;
257 };
258 
272 M0_INTERNAL int m0_pdclust_build(struct m0_layout_domain *dom,
273  uint64_t lid,
274  const struct m0_pdclust_attr *attr,
275  struct m0_layout_enum *le,
276  struct m0_pdclust_layout **out);
277 
279 M0_INTERNAL bool m0_pdclust_attr_check(const struct m0_pdclust_attr *attr);
280 M0_INTERNAL uint32_t m0_pdclust_N(const struct m0_pdclust_layout *pl);
281 M0_INTERNAL uint32_t m0_pdclust_K(const struct m0_pdclust_layout *pl);
282 M0_INTERNAL uint32_t m0_pdclust_S(const struct m0_pdclust_layout *pl);
283 M0_INTERNAL uint32_t m0_pdclust_P(const struct m0_pdclust_layout *pl);
284 M0_INTERNAL uint32_t m0_pdclust_size(const struct m0_pdclust_layout *pl);
285 M0_INTERNAL uint64_t m0_pdclust_unit_size(const struct m0_pdclust_layout *pl);
286 
288 M0_INTERNAL struct m0_pdclust_layout *m0_layout_to_pdl(const struct m0_layout
289  *l);
290 
292 M0_INTERNAL struct m0_layout *m0_pdl_to_layout(struct m0_pdclust_layout *pl);
293 
295 M0_INTERNAL enum m0_pdclust_unit_type
296 m0_pdclust_unit_classify(const struct m0_pdclust_layout *play, int unit);
297 
299 M0_INTERNAL struct m0_pdclust_instance *
301 
309 M0_INTERNAL void m0_pdclust_instance_map(struct m0_pdclust_instance *pi,
310  const struct m0_pdclust_src_addr *src,
311  struct m0_pdclust_tgt_addr *tgt);
318 M0_INTERNAL void m0_pdclust_instance_inv(struct m0_pdclust_instance *pi,
319  const struct m0_pdclust_tgt_addr *tgt,
320  struct m0_pdclust_src_addr *src);
321 
322 M0_INTERNAL int m0_pdclust_perm_cache_build(struct m0_layout *layout,
323  struct m0_pdclust_instance *pi);
324 
325 M0_INTERNAL void m0_pdclust_perm_cache_destroy(struct m0_layout *layout,
326  struct m0_pdclust_instance *pi);
327 
328 M0_INTERNAL bool m0_pdclust_is_replicated(struct m0_pdclust_layout *play);
330 
332 
335 /* __MOTR_LAYOUT_PDCLUST_H__ */
336 #endif
337 
338 /*
339  * Local variables:
340  * c-indentation-style: "K&R"
341  * c-basic-offset: 8
342  * tab-width: 8
343  * fill-column: 80
344  * scroll-step: 1
345  * End:
346  */
M0_INTERNAL bool m0_pdclust_is_replicated(struct m0_pdclust_layout *play)
Definition: pdclust.c:829
uint64_t sa_group
Definition: pdclust.h:241
uint64_t pa_unit_size
Definition: pdclust.h:118
uint32_t pa_N
Definition: pdclust.h:104
uint32_t pr_let_id
Definition: pdclust.h:131
struct m0_layout_instance pi_base
Definition: pdclust.h:173
uint32_t pa_K
Definition: pdclust.h:107
M0_INTERNAL int m0_pdclust_perm_cache_build(struct m0_layout *layout, struct m0_pdclust_instance *pi)
Definition: pdclust.c:805
uint64_t ta_obj
Definition: pdclust.h:256
uint32_t pa_S
Definition: pdclust.h:110
uint64_t pi_magic
Definition: pdclust.h:225
struct m0_pdclust_attr pl_attr
Definition: pdclust.h:150
uint32_t pl_C
Definition: pdclust.h:155
struct m0_pdclust_attr pr_attr
Definition: pdclust.h:133
m0_pdclust_unit_type
Definition: pdclust.h:89
struct m0_layout_type m0_pdclust_layout_type
Definition: pdclust.c:968
M0_BASSERT(M0_IS_8ALIGNED(sizeof(struct m0_layout_pdclust_rec)))
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
Definition: dump.c:949
struct m0_parity_math pi_math
Definition: pdclust.h:223
struct m0_striped_layout pl_base
Definition: pdclust.h:148
M0_INTERNAL uint32_t m0_pdclust_N(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:352
M0_EXTERN const struct m0_pdclust_src_addr M0_PDCLUST_SRC_NULL
Definition: pdclust.h:331
uint64_t ta_frame
Definition: pdclust.h:254
static struct m0_stob_domain * dom
Definition: storage.c:38
M0_INTERNAL uint32_t m0_pdclust_S(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:362
M0_INTERNAL struct m0_pdclust_layout * m0_layout_to_pdl(const struct m0_layout *l)
Definition: pdclust.c:382
struct m0_pdclust_instance pi
Definition: fd.c:107
M0_INTERNAL uint32_t m0_pdclust_K(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:357
M0_INTERNAL void m0_pdclust_instance_map(struct m0_pdclust_instance *pi, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt)
Definition: pdclust.c:701
struct m0_pdclust_instance::tile_cache pi_tile_cache
uint64_t pl_magic
Definition: pdclust.h:162
M0_INTERNAL void m0_pdclust_instance_inv(struct m0_pdclust_instance *pi, const struct m0_pdclust_tgt_addr *tgt, struct m0_pdclust_src_addr *src)
Definition: pdclust.c:746
static struct m0_clink l[NR]
Definition: chan.c:37
uint32_t pl_L
Definition: pdclust.h:160
struct m0_uint128 pa_seed
Definition: pdclust.h:121
M0_INTERNAL struct m0_layout * m0_pdl_to_layout(struct m0_pdclust_layout *pl)
Definition: pdclust.c:393
M0_INTERNAL uint32_t m0_pdclust_size(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:372
uint64_t sa_unit
Definition: pdclust.h:243
struct m0_mutex pi_mutex
Definition: pdclust.h:230
struct m0_pdclust_tgt_addr tgt
Definition: fd.c:110
uint64_t pi_cache_nr
Definition: pdclust.h:220
struct m0_fd_perm_cache * pi_perm_cache
Definition: pdclust.h:221
uint32_t pa_P
Definition: pdclust.h:115
M0_INTERNAL enum m0_pdclust_unit_type m0_pdclust_unit_classify(const struct m0_pdclust_layout *pl, int unit)
Definition: pdclust.c:425
M0_INTERNAL int m0_pdclust_build(struct m0_layout_domain *dom, uint64_t lid, const struct m0_pdclust_attr *attr, struct m0_layout_enum *le, struct m0_pdclust_layout **out)
Definition: pdclust.c:305
M0_INTERNAL void m0_pdclust_perm_cache_destroy(struct m0_layout *layout, struct m0_pdclust_instance *pi)
Definition: pdclust.c:789
Definition: pool.h:80
M0_INTERNAL struct m0_pdclust_instance * m0_layout_instance_to_pdi(const struct m0_layout_instance *li)
Definition: pdclust.c:400
#define M0_IS_8ALIGNED(val)
Definition: arith.h:190
#define out(...)
Definition: gen.c:41
Definition: mutex.h:47
struct m0_pdclust_src_addr src
Definition: fd.c:108
M0_INTERNAL uint32_t m0_pdclust_P(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:367
M0_INTERNAL uint64_t m0_pdclust_unit_size(const struct m0_pdclust_layout *pl)
Definition: pdclust.c:377
M0_INTERNAL bool m0_pdclust_attr_check(const struct m0_pdclust_attr *attr)
Definition: pdclust.c:340