Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

md: linear.c: Make two local variables sector-based.

This is a preparation for representing also the remaining fields of struct
linear_private_data as sectors.

Signed-off-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: NeilBrown <neilb@suse.de>

authored by

Andre Noll and committed by
NeilBrown
23242fbb 6283815d

+10 -10
+10 -10
drivers/md/linear.c
··· 112 112 dev_info_t **table; 113 113 mdk_rdev_t *rdev; 114 114 int i, nb_zone, cnt; 115 - sector_t min_spacing; 115 + sector_t min_sectors; 116 116 sector_t curr_sector; 117 117 struct list_head *tmp; 118 118 ··· 155 155 goto out; 156 156 } 157 157 158 - min_spacing = conf->array_sectors / 2; 159 - sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); 158 + min_sectors = conf->array_sectors; 159 + sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *)); 160 160 161 - /* min_spacing is the minimum spacing that will fit the hash 161 + /* min_sectors is the minimum spacing that will fit the hash 162 162 * table in one PAGE. This may be much smaller than needed. 163 163 * We find the smallest non-terminal set of consecutive devices 164 - * that is larger than min_spacing and use the size of that as 164 + * that is larger than min_sectors and use the size of that as 165 165 * the actual spacing 166 166 */ 167 167 conf->hash_spacing = conf->array_sectors / 2; 168 168 for (i=0; i < cnt-1 ; i++) { 169 - sector_t sz = 0; 169 + sector_t tmp = 0; 170 170 int j; 171 - for (j = i; j < cnt - 1 && sz < min_spacing; j++) 172 - sz += conf->disks[j].num_sectors / 2; 173 - if (sz >= min_spacing && sz < conf->hash_spacing) 174 - conf->hash_spacing = sz; 171 + for (j = i; j < cnt - 1 && tmp < min_sectors; j++) 172 + tmp += conf->disks[j].num_sectors; 173 + if (tmp >= min_sectors && tmp < conf->hash_spacing * 2) 174 + conf->hash_spacing = tmp / 2; 175 175 } 176 176 177 177 /* hash_spacing may be too large for sector_div to work with,