Lines Matching refs:c
265 void clear_choose_args(struct crush_map *c) in clear_choose_args() argument
267 while (!RB_EMPTY_ROOT(&c->choose_args)) { in clear_choose_args()
269 rb_entry(rb_first(&c->choose_args), in clear_choose_args()
272 erase_choose_arg_map(&c->choose_args, arg_map); in clear_choose_args()
350 static int decode_choose_args(void **p, void *end, struct crush_map *c) in decode_choose_args() argument
366 arg_map->size = c->max_buckets; in decode_choose_args()
389 arg->ids_size != c->buckets[bucket_index]->size) in decode_choose_args()
393 insert_choose_arg_map(&c->choose_args, arg_map); in decode_choose_args()
405 static void crush_finalize(struct crush_map *c) in crush_finalize() argument
410 c->working_size = sizeof(struct crush_work) + in crush_finalize()
411 c->max_buckets * sizeof(struct crush_work_bucket *); in crush_finalize()
413 for (b = 0; b < c->max_buckets; b++) { in crush_finalize()
414 if (!c->buckets[b]) in crush_finalize()
417 switch (c->buckets[b]->alg) { in crush_finalize()
423 c->working_size += sizeof(struct crush_work_bucket); in crush_finalize()
427 c->working_size += c->buckets[b]->size * sizeof(__u32); in crush_finalize()
433 struct crush_map *c; in crush_decode() local
442 c = kzalloc(sizeof(*c), GFP_NOFS); in crush_decode()
443 if (c == NULL) in crush_decode()
446 c->type_names = RB_ROOT; in crush_decode()
447 c->names = RB_ROOT; in crush_decode()
448 c->choose_args = RB_ROOT; in crush_decode()
451 c->choose_local_tries = 2; in crush_decode()
452 c->choose_local_fallback_tries = 5; in crush_decode()
453 c->choose_total_tries = 19; in crush_decode()
454 c->chooseleaf_descend_once = 0; in crush_decode()
463 c->max_buckets = ceph_decode_32(p); in crush_decode()
464 c->max_rules = ceph_decode_32(p); in crush_decode()
465 c->max_devices = ceph_decode_32(p); in crush_decode()
467 c->buckets = kcalloc(c->max_buckets, sizeof(*c->buckets), GFP_NOFS); in crush_decode()
468 if (c->buckets == NULL) in crush_decode()
470 c->rules = kcalloc(c->max_rules, sizeof(*c->rules), GFP_NOFS); in crush_decode()
471 if (c->rules == NULL) in crush_decode()
475 for (i = 0; i < c->max_buckets; i++) { in crush_decode()
482 c->buckets[i] = NULL; in crush_decode()
508 b = c->buckets[i] = kzalloc(size, GFP_NOFS); in crush_decode()
566 dout("rule vec is %p\n", c->rules); in crush_decode()
567 for (i = 0; i < c->max_rules; i++) { in crush_decode()
575 c->rules[i] = NULL; in crush_decode()
593 c->rules[i] = r; in crush_decode()
604 err = decode_crush_names(p, end, &c->type_names); in crush_decode()
608 err = decode_crush_names(p, end, &c->names); in crush_decode()
616 c->choose_local_tries = ceph_decode_32(p); in crush_decode()
617 c->choose_local_fallback_tries = ceph_decode_32(p); in crush_decode()
618 c->choose_total_tries = ceph_decode_32(p); in crush_decode()
620 c->choose_local_tries); in crush_decode()
622 c->choose_local_fallback_tries); in crush_decode()
624 c->choose_total_tries); in crush_decode()
627 c->chooseleaf_descend_once = ceph_decode_32(p); in crush_decode()
629 c->chooseleaf_descend_once); in crush_decode()
632 c->chooseleaf_vary_r = ceph_decode_8(p); in crush_decode()
634 c->chooseleaf_vary_r); in crush_decode()
641 c->chooseleaf_stable = ceph_decode_8(p); in crush_decode()
643 c->chooseleaf_stable); in crush_decode()
655 err = decode_choose_args(p, end, c); in crush_decode()
661 crush_finalize(c); in crush_decode()
663 return c; in crush_decode()
669 crush_destroy(c); in crush_decode()
990 static struct crush_work *alloc_workspace(const struct crush_map *c) in alloc_workspace() argument
995 WARN_ON(!c->working_size); in alloc_workspace()
996 work_size = crush_work_size(c, CEPH_PG_MAX_SIZE); in alloc_workspace()
1004 crush_init_workspace(c, work); in alloc_workspace()
1052 const struct crush_map *c) in get_workspace() argument
1081 work = alloc_workspace(c); in get_workspace()
3032 static int get_immediate_parent(struct crush_map *c, int id, in get_immediate_parent() argument
3040 for (i = 0; i < c->max_buckets; i++) { in get_immediate_parent()
3041 b = c->buckets[i]; in get_immediate_parent()
3046 cn = lookup_crush_name(&c->names, b->id); in get_immediate_parent()
3055 type_cn = lookup_crush_name(&c->type_names, b->type); in get_immediate_parent()