mirror of
https://github.com/ceph/ceph
synced 2025-01-18 17:12:29 +00:00
handle ids greater that max_buckets
This commit is contained in:
parent
3fa7f1da34
commit
47b85cfcf7
@ -120,7 +120,7 @@ int crush_add_bucket(struct crush_map *map,
|
||||
id = crush_get_next_bucket_id(map);
|
||||
pos = -1 - id;
|
||||
|
||||
if (pos == map->max_buckets) {
|
||||
while (pos > map->max_buckets) {
|
||||
/* expand array */
|
||||
oldsize = map->max_buckets;
|
||||
if (map->max_buckets)
|
||||
@ -130,11 +130,13 @@ int crush_add_bucket(struct crush_map *map,
|
||||
map->buckets = realloc(map->buckets, map->max_buckets * sizeof(map->buckets[0]));
|
||||
memset(map->buckets + oldsize, 0, (map->max_buckets-oldsize) * sizeof(map->buckets[0]));
|
||||
}
|
||||
|
||||
assert(map->buckets[pos] == 0);
|
||||
|
||||
/* add it */
|
||||
/* add it */
|
||||
bucket->id = id;
|
||||
map->buckets[pos] = bucket;
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user