From ebdf80edfecfbd5a842b71fbe5732857994380c1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 26 Apr 2012 22:12:40 -0700 Subject: [PATCH] crush: remove parent maps These were used (poorly) for forcefeeding, but they are useless now. Which is good, because we allow items to appear in multiple trees, which means they have no single parent. Good riddance! Signed-off-by: Sage Weil --- src/crush/builder.c | 9 --------- src/crush/crush.c | 26 -------------------------- src/crush/crush.h | 11 ----------- 3 files changed, 46 deletions(-) diff --git a/src/crush/builder.c b/src/crush/builder.c index c68fdf04eed2e..73a295cb8203f 100644 --- a/src/crush/builder.c +++ b/src/crush/builder.c @@ -37,15 +37,6 @@ void crush_finalize(struct crush_map *map) if (map->buckets[b]->items[i] >= map->max_devices) map->max_devices = map->buckets[b]->items[i] + 1; } - - /* allocate arrays */ - map->device_parents = malloc(sizeof(map->device_parents[0]) * map->max_devices); - memset(map->device_parents, 0, sizeof(map->device_parents[0]) * map->max_devices); - map->bucket_parents = malloc(sizeof(map->bucket_parents[0]) * map->max_buckets); - memset(map->bucket_parents, 0, sizeof(map->bucket_parents[0]) * map->max_buckets); - - /* build parent maps */ - crush_calc_parents(map); } diff --git a/src/crush/crush.c b/src/crush/crush.c index 2190d5bff65dc..83bbbd0dcad9c 100644 --- a/src/crush/crush.c +++ b/src/crush/crush.c @@ -44,30 +44,6 @@ int crush_get_bucket_item_weight(const struct crush_bucket *b, int p) return 0; } -/** - * crush_calc_parents - Calculate parent vectors for the given crush map. - * @param map crush_map pointer - */ -void crush_calc_parents(struct crush_map *map) -{ - int b, c; - __u32 i; - - for (b = 0; b < map->max_buckets; b++) { - if (map->buckets[b] == NULL) - continue; - for (i = 0; i < map->buckets[b]->size; i++) { - c = map->buckets[b]->items[i]; - BUG_ON(c >= map->max_devices || - c < -map->max_buckets); - if (c >= 0) - map->device_parents[c] = map->buckets[b]->id; - else - map->bucket_parents[-1-c] = map->buckets[b]->id; - } - } -} - void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b) { kfree(b->h.perm); @@ -144,8 +120,6 @@ void crush_destroy(struct crush_map *map) kfree(map->rules); } - kfree(map->bucket_parents); - kfree(map->device_parents); kfree(map); } diff --git a/src/crush/crush.h b/src/crush/crush.h index 5a07a2f9d8f84..884b9289dbd89 100644 --- a/src/crush/crush.h +++ b/src/crush/crush.h @@ -155,16 +155,6 @@ struct crush_map { struct crush_bucket **buckets; struct crush_rule **rules; - /* - * Parent pointers to identify the parent bucket a device or - * bucket in the hierarchy. If an item appears more than - * once, this is the _last_ time it appeared (where buckets - * are processed in bucket id order, from -1 on down to - * -max_buckets. - */ - __u32 *bucket_parents; - __u32 *device_parents; - __s32 max_buckets; __u32 max_rules; __s32 max_devices; @@ -173,7 +163,6 @@ struct crush_map { /* crush.c */ extern int crush_get_bucket_item_weight(const struct crush_bucket *b, int pos); -extern void crush_calc_parents(struct crush_map *map); extern void crush_destroy_bucket_uniform(struct crush_bucket_uniform *b); extern void crush_destroy_bucket_list(struct crush_bucket_list *b); extern void crush_destroy_bucket_tree(struct crush_bucket_tree *b); -- 2.39.5