File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed
Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -2185,25 +2185,23 @@ int CrushWrapper::reclassify(
21852185
21862186int CrushWrapper::get_new_bucket_id ()
21872187{
2188- int id = -1 ;
2189- while (crush->buckets [-1 -id] &&
2190- -1 -id < crush->max_buckets ) {
2191- id--;
2192- }
2193- if (-1 -id == crush->max_buckets ) {
2194- ++crush->max_buckets ;
2195- crush->buckets = (struct crush_bucket **)realloc (
2196- crush->buckets ,
2197- sizeof (crush->buckets [0 ]) * crush->max_buckets );
2198- for (auto & i : choose_args) {
2199- assert (i.second .size == (__u32)crush->max_buckets - 1 );
2200- ++i.second .size ;
2201- i.second .args = (struct crush_choose_arg *)realloc (
2202- i.second .args ,
2203- sizeof (i.second .args [0 ]) * i.second .size );
2188+ for (int index = 0 ; index < crush->max_buckets ; index++) {
2189+ if (crush->buckets [index] == nullptr ) {
2190+ return -index - 1 ;
22042191 }
22052192 }
2206- return id;
2193+ ++crush->max_buckets ;
2194+ crush->buckets = (struct crush_bucket **)realloc (
2195+ crush->buckets ,
2196+ sizeof (crush->buckets [0 ]) * crush->max_buckets );
2197+ for (auto & i : choose_args) {
2198+ assert (i.second .size == (__u32)crush->max_buckets - 1 );
2199+ ++i.second .size ;
2200+ i.second .args = (struct crush_choose_arg *)realloc (
2201+ i.second .args ,
2202+ sizeof (i.second .args [0 ]) * i.second .size );
2203+ }
2204+ return -crush->max_buckets ;
22072205}
22082206
22092207void CrushWrapper::reweight (CephContext *cct)
You can’t perform that action at this time.
0 commit comments