Lines Matching refs:c
249 void clear_choose_args(struct crush_map *c) in clear_choose_args() argument
251 while (!RB_EMPTY_ROOT(&c->choose_args)) { in clear_choose_args()
253 rb_entry(rb_first(&c->choose_args), in clear_choose_args()
256 erase_choose_arg_map(&c->choose_args, arg_map); in clear_choose_args()
334 static int decode_choose_args(void **p, void *end, struct crush_map *c) in decode_choose_args() argument
350 arg_map->size = c->max_buckets; in decode_choose_args()
373 arg->ids_size != c->buckets[bucket_index]->size) in decode_choose_args()
377 insert_choose_arg_map(&c->choose_args, arg_map); in decode_choose_args()
389 static void crush_finalize(struct crush_map *c) in crush_finalize() argument
394 c->working_size = sizeof(struct crush_work) + in crush_finalize()
395 c->max_buckets * sizeof(struct crush_work_bucket *); in crush_finalize()
397 for (b = 0; b < c->max_buckets; b++) { in crush_finalize()
398 if (!c->buckets[b]) in crush_finalize()
401 switch (c->buckets[b]->alg) { in crush_finalize()
407 c->working_size += sizeof(struct crush_work_bucket); in crush_finalize()
411 c->working_size += c->buckets[b]->size * sizeof(__u32); in crush_finalize()
417 struct crush_map *c; in crush_decode() local
426 c = kzalloc(sizeof(*c), GFP_NOFS); in crush_decode()
427 if (c == NULL) in crush_decode()
430 c->type_names = RB_ROOT; in crush_decode()
431 c->names = RB_ROOT; in crush_decode()
432 c->choose_args = RB_ROOT; in crush_decode()
435 c->choose_local_tries = 2; in crush_decode()
436 c->choose_local_fallback_tries = 5; in crush_decode()
437 c->choose_total_tries = 19; in crush_decode()
438 c->chooseleaf_descend_once = 0; in crush_decode()
447 c->max_buckets = ceph_decode_32(p); in crush_decode()
448 c->max_rules = ceph_decode_32(p); in crush_decode()
449 c->max_devices = ceph_decode_32(p); in crush_decode()
451 c->buckets = kcalloc(c->max_buckets, sizeof(*c->buckets), GFP_NOFS); in crush_decode()
452 if (c->buckets == NULL) in crush_decode()
454 c->rules = kcalloc(c->max_rules, sizeof(*c->rules), GFP_NOFS); in crush_decode()
455 if (c->rules == NULL) in crush_decode()
459 for (i = 0; i < c->max_buckets; i++) { in crush_decode()
466 c->buckets[i] = NULL; in crush_decode()
492 b = c->buckets[i] = kzalloc(size, GFP_NOFS); in crush_decode()
550 dout("rule vec is %p\n", c->rules); in crush_decode()
551 for (i = 0; i < c->max_rules; i++) { in crush_decode()
559 c->rules[i] = NULL; in crush_decode()
574 c->rules[i] = r; in crush_decode()
588 err = decode_crush_names(p, end, &c->type_names); in crush_decode()
592 err = decode_crush_names(p, end, &c->names); in crush_decode()
600 c->choose_local_tries = ceph_decode_32(p); in crush_decode()
601 c->choose_local_fallback_tries = ceph_decode_32(p); in crush_decode()
602 c->choose_total_tries = ceph_decode_32(p); in crush_decode()
604 c->choose_local_tries); in crush_decode()
606 c->choose_local_fallback_tries); in crush_decode()
608 c->choose_total_tries); in crush_decode()
611 c->chooseleaf_descend_once = ceph_decode_32(p); in crush_decode()
613 c->chooseleaf_descend_once); in crush_decode()
616 c->chooseleaf_vary_r = ceph_decode_8(p); in crush_decode()
618 c->chooseleaf_vary_r); in crush_decode()
625 c->chooseleaf_stable = ceph_decode_8(p); in crush_decode()
627 c->chooseleaf_stable); in crush_decode()
639 err = decode_choose_args(p, end, c); in crush_decode()
645 crush_finalize(c); in crush_decode()
647 return c; in crush_decode()
653 crush_destroy(c); in crush_decode()
974 static struct crush_work *alloc_workspace(const struct crush_map *c) in alloc_workspace() argument
979 WARN_ON(!c->working_size); in alloc_workspace()
980 work_size = crush_work_size(c, CEPH_PG_MAX_SIZE); in alloc_workspace()
988 crush_init_workspace(c, work); in alloc_workspace()
1036 const struct crush_map *c) in get_workspace() argument
1065 work = alloc_workspace(c); in get_workspace()
3016 static int get_immediate_parent(struct crush_map *c, int id, in get_immediate_parent() argument
3024 for (i = 0; i < c->max_buckets; i++) { in get_immediate_parent()
3025 b = c->buckets[i]; in get_immediate_parent()
3030 cn = lookup_crush_name(&c->names, b->id); in get_immediate_parent()
3039 type_cn = lookup_crush_name(&c->type_names, b->type); in get_immediate_parent()