Index: sys/kern/subr_blist.c =================================================================== --- sys/kern/subr_blist.c +++ sys/kern/subr_blist.c @@ -151,17 +151,20 @@ * in the 'meta' functions that process subtrees. Since integer division * discards remainders, we can express this computation as * skip = (m * m**h) / (m - 1) - * skip = (m * radix / BLIST_BMAP_RADIX) / (m - 1) - * and if m divides BLIST_BMAP_RADIX, we can simplify further to - * skip = radix / (BLIST_BMAP_RADIX / m * (m - 1)) - * so that a simple integer division is enough for the calculation. + * skip = (m * (radix / BLIST_BMAP_RADIX)) / (m - 1) + * and since m divides BLIST_BMAP_RADIX, we can simplify further to + * skip = (radix / (BLIST_BMAP_RADIX / m)) / (m - 1) + * skip = radix / ((BLIST_BMAP_RADIX / m) * (m - 1)) + * so that simple integer division by a constant can safely be used for the + * calculation. */ +CTASSERT(BLIST_BMAP_RADIX % BLIST_META_RADIX == 0); static inline daddr_t radix_to_skip(daddr_t radix) { return (radix / - (BLIST_BMAP_RADIX / BLIST_META_RADIX * (BLIST_META_RADIX - 1))); + ((BLIST_BMAP_RADIX / BLIST_META_RADIX) * (BLIST_META_RADIX - 1))); } /*