- min_spacing = conf->array_size;
- sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
-
- /* min_spacing is the minimum spacing that will fit the hash
- * table in one PAGE. This may be much smaller than needed.
- * We find the smallest non-terminal set of consecutive devices
- * that is larger than min_spacing as use the size of that as
- * the actual spacing
- */
- conf->hash_spacing = conf->array_size;
- for (i=0; i < cnt-1 ; i++) {
- sector_t sz = 0;
- int j;
- for (j = i; j < cnt - 1 && sz < min_spacing; j++)
- sz += conf->disks[j].size;
- if (sz >= min_spacing && sz < conf->hash_spacing)
- conf->hash_spacing = sz;
- }
-
- /* hash_spacing may be too large for sector_div to work with,
- * so we might need to pre-shift
- */
- conf->preshift = 0;
- if (sizeof(sector_t) > sizeof(u32)) {
- sector_t space = conf->hash_spacing;
- while (space > (sector_t)(~(u32)0)) {
- space >>= 1;
- conf->preshift++;
- }
- }