Skip to content

Commit

Permalink
mgr/pg_autoscaler: apply pg_num_max
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Jan 3, 2022
1 parent 4439035 commit 73893f4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pybind/mgr/pg_autoscaler/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,11 @@ def _calc_final_pg_target(
final_ratio = 1 / (pool_count - root_map[root_id].pool_used)
pool_pg_target = (final_ratio * root_map[root_id].pg_left) / p['size'] * bias

final_pg_target = max(p.get('options', {}).get('pg_num_min', PG_NUM_MIN),
nearest_power_of_two(pool_pg_target))
min_pg = p.get('options', {}).get('pg_num_min', PG_NUM_MIN)
max_pg = p.get('options', {}).get('pg_num_max')
final_pg_target = max(min_pg, nearest_power_of_two(pool_pg_target))
if max_pg and max_pg < final_pg_target:
final_pg_target = max_pg
self.log.info("Pool '{0}' root_id {1} using {2} of space, bias {3}, "
"pg target {4} quantized to {5} (current {6})".format(
p['pool_name'],
Expand Down

0 comments on commit 73893f4

Please sign in to comment.