- /* calculate array device size */
- mddev->array_size = 0;
- ITERATE_RDEV(mddev,rdev,tmp)
- mddev->array_size += rdev->size;
-
- printk("raid0 : md_size is %llu blocks.\n",
- (unsigned long long)mddev->array_size);
- printk("raid0 : conf->hash_spacing is %llu blocks.\n",
- (unsigned long long)conf->hash_spacing);
- {
-#if __GNUC__ < 3
- volatile
-#endif
- sector_t s = mddev->array_size;
- sector_t space = conf->hash_spacing;
- int round;
- conf->preshift = 0;
- if (sizeof(sector_t) > sizeof(unsigned long)) {
- /*shift down space and s so that sector_div will work */
- while (space > (sector_t) (~(unsigned long)0)) {
- s >>= 1;
- space >>= 1;
- s += 1; /* force round-up */
- conf->preshift++;
- }
- }
- round = sector_div(s, (unsigned long)space) ? 1 : 0;
- nb_zone = s + round;
- }
- printk("raid0 : nb_zone is %d.\n", nb_zone);
-
- printk("raid0 : Allocating %Zd bytes for hash.\n",
- nb_zone*sizeof(struct strip_zone*));
- conf->hash_table = kmalloc (sizeof (struct strip_zone *)*nb_zone, GFP_KERNEL);
- if (!conf->hash_table)
- goto out_free_conf;
- size = conf->strip_zone[cur].size;
-
- for (i=0; i< nb_zone; i++) {
- conf->hash_table[i] = conf->strip_zone + cur;
- while (size <= conf->hash_spacing) {
- cur++;
- size += conf->strip_zone[cur].size;
- }
- size -= conf->hash_spacing;
- }
- if (conf->preshift) {
- conf->hash_spacing >>= conf->preshift;
- /* round hash_spacing up so when we divide by it, we
- * err on the side of too-low, which is safest
- */
- conf->hash_spacing++;