81 if (unit < play->pl_attr.pa_N)
83 else if (unit < play->pl_attr.pa_N + play->
pl_attr.
pa_K)
110 uint32_t incidence[
attr.pa_P][
attr.pa_P];
117 const char *brace[
M0_PUT_NR] = {
"[]",
"<>",
"{}" };
147 for (unit = 0; unit < W; ++unit) {
158 for (unit = 0; unit < W; ++unit) {
159 for (
i = 0;
i < W; ++
i)
160 incidence[where[unit]][where[
i]]++;
182 printf(
"usage : \n");
186 printf(
"%5s : ",
head[
i]);
195 avg = ((double)
sum)/
P;
197 sqrt(sq/
P - avg*avg)*100.0/avg);
199 printf(
"\nincidence:\n");
203 for (
i = 0;
i <
P; ++
i) {
205 u = incidence[
obj][
i];
214 avg = ((double)
sum)/(
P - 1);
216 sqrt(sq/(
P - 1) - avg*avg)*100.0/avg);
221 int main(
int argc,
char **argv)
232 uint64_t unitsize = 4096;
245 if (argc != 7 && argc != 9) {
247 "\t\tm0layout N K S P R I\nwhere\n" 248 "\tN : number of data units in a parity group\n" 249 "\tK : number of parity units in a parity group\n" 250 "\tS : number of spare uints in a parity group\n" 251 "\tP : number of target objects to stripe over\n" 252 "\tR : number of frames to show in a layout map\n" 253 "\tI : number of groups to iterate over while\n" 254 "\t calculating incidence and frame distributions\n" 255 "\tf_c: container-id for gfid\n" 256 "\tf_k: key for gfid\n" 258 "\tmap: an R*P map showing initial fragment of layout\n" 259 "\t [G, U] - data unit U from a group G\n" 260 "\t <G, U> - parity unit U from a group G\n" 261 "\t {G, U} - spare unit U from a group G\n" 262 "\tusage: counts of data, parity, spare and total frames\n" 263 "\t occupied on each target object, followed by MIN,\n" 264 "\t MAX, AVG, STD/AVG\n" 265 "\tincidence: a matrix showing a number of parity groups having\n" 266 "\t units on a given pair of target objects, followed by\n" 267 "\t MIN, MAX, AVG, STD/AVG\n");
277 id = 0x4A494E4E49455349;
290 attr.pa_unit_size = unitsize;
299 strtol(argv[7],
NULL, 0),
300 strtol(argv[8],
NULL, 0));
309 if (cache_len ==
NULL) {
#define M0_ALLOC_ARR(arr, nr)
M0_INTERNAL void m0_pool_fini(struct m0_pool *pool)
M0_INTERNAL void m0_fid_gob_make(struct m0_fid *gob_fid, uint32_t container, uint64_t key)
M0_INTERNAL int m0_layout_domain_init(struct m0_layout_domain *dom)
#define M0_FID_INIT(container, key)
struct m0_layout_instance pi_base
M0_INTERNAL void m0_uint128_init(struct m0_uint128 *u128, const char *magic)
M0_INTERNAL void m0_layout_domain_fini(struct m0_layout_domain *dom)
struct m0_pool_version pool_ver
M0_INTERNAL int m0_linear_enum_build(struct m0_layout_domain *dom, const struct m0_layout_linear_attr *attr, struct m0_layout_linear_enum **out)
int m0_init(struct m0 *instance)
struct m0_pdclust_attr pl_attr
M0_INTERNAL int m0_layout_instance_build(struct m0_layout *l, const struct m0_fid *fid, struct m0_layout_instance **out)
M0_INTERNAL int m0_pool_init(struct m0_pool *pool, const struct m0_fid *id, enum m0_pver_policy_code pver_policy)
static int head(struct m0_sm *mach)
void layout_demo(struct m0_pdclust_instance *pi, struct m0_pdclust_layout *pl, int R, int I, bool print)
static M0_UNUSED void print(struct m0_be_list *list)
struct m0_layout_enum lle_base
static void attr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
struct m0_fd_tree pv_fd_tree
struct m0_fd_cache_info ft_cache_info
int main(int argc, char **argv)
static long long max(long long a, long long b)
struct m0_pdclust_instance pi
static int dummy_create(struct m0_layout_domain *domain, uint64_t lid, struct m0_pdclust_attr *attr, struct m0_pdclust_layout **pl)
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)
M0_INTERNAL int m0_layout_standard_types_register(struct m0_layout_domain *dom)
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)
static struct m0_clink l[NR]
static struct m0_pool pool
M0_INTERNAL struct m0_layout * m0_pdl_to_layout(struct m0_pdclust_layout *pl)
struct m0_pdclust_tgt_addr tgt
static long long min(long long a, long long b)
static uint32_t min32u(uint32_t a, uint32_t b)
const struct m0_layout_instance_ops * li_ops
static uint32_t max32u(uint32_t a, uint32_t b)
void(* lio_fini)(struct m0_layout_instance *li)
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)
M0_INTERNAL void m0_layout_standard_types_unregister(struct m0_layout_domain *dom)
static struct m0 instance
M0_INTERNAL struct m0_pdclust_instance * m0_layout_instance_to_pdi(const struct m0_layout_instance *li)
M0_INTERNAL void m0_layout_put(struct m0_layout *l)
static struct m0_layout_domain domain
struct m0_pdclust_src_addr src
enum m0_pdclust_unit_type classify(const struct m0_pdclust_layout *play, int unit)