repart: do not assign new size larger than acquired or the specified maximum
The acquired size may be larger than the requested maximum. So, let's cap the value. Note, at the final phase, the acquired size should be larger than the requested minimum. Hence, the assertion about that is added.
This commit is contained in:
@@ -796,7 +796,8 @@ static bool context_grow_partitions_phase(
|
||||
* assigning this shouldn't impact the shares of the other
|
||||
* partitions. */
|
||||
|
||||
p->new_size = MAX(round_down_size(share, context->grain_size), rsz);
|
||||
assert(share >= rsz);
|
||||
p->new_size = CLAMP(round_down_size(share, context->grain_size), rsz, xsz);
|
||||
charge = true;
|
||||
}
|
||||
|
||||
@@ -822,7 +823,8 @@ static bool context_grow_partitions_phase(
|
||||
p->new_padding = xsz;
|
||||
charge = try_again = true;
|
||||
} else if (phase == PHASE_DISTRIBUTE) {
|
||||
p->new_padding = MAX(round_down_size(share, context->grain_size), rsz);
|
||||
assert(share >= rsz);
|
||||
p->new_padding = CLAMP(round_down_size(share, context->grain_size), rsz, xsz);
|
||||
charge = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user