Simplify extent_quantize().

2cdf07aba9 (Fix extent_quantize() to
handle greater-than-huge-size extents.) solved a non-problem; the
expression passed in to index2size() was never too large.  However the
expression could in principle underflow, so fix the actual (latent) bug
and remove unnecessary complexity.
This commit is contained in:
Jason Evans 2016-11-11 22:46:55 -08:00
parent a2af09f025
commit 1aeea0f391

View File

@ -16,12 +16,9 @@ extent_quantize(size_t size)
assert(size > 0); assert(size > 0);
ind = size2index(size + 1); ind = size2index(size + 1);
if (ind == NSIZES) { if (ind == 0) {
/* /* Avoid underflow. */
* Allocation requests can't directly create extents that exceed return (index2size(0));
* HUGE_MAXCLASS, but extent merging can create them.
*/
return (HUGE_MAXCLASS);
} }
ret = index2size(ind - 1); ret = index2size(ind - 1);
assert(ret <= size); assert(ret <= size);