mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 09:43:59 +08:00
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>
This commit is contained in:
parent
6283815d18
commit
23242fbb47
@ -112,7 +112,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
|
|||||||
dev_info_t **table;
|
dev_info_t **table;
|
||||||
mdk_rdev_t *rdev;
|
mdk_rdev_t *rdev;
|
||||||
int i, nb_zone, cnt;
|
int i, nb_zone, cnt;
|
||||||
sector_t min_spacing;
|
sector_t min_sectors;
|
||||||
sector_t curr_sector;
|
sector_t curr_sector;
|
||||||
struct list_head *tmp;
|
struct list_head *tmp;
|
||||||
|
|
||||||
@ -155,23 +155,23 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
min_spacing = conf->array_sectors / 2;
|
min_sectors = conf->array_sectors;
|
||||||
sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
|
sector_div(min_sectors, PAGE_SIZE/sizeof(struct dev_info *));
|
||||||
|
|
||||||
/* min_spacing is the minimum spacing that will fit the hash
|
/* min_sectors is the minimum spacing that will fit the hash
|
||||||
* table in one PAGE. This may be much smaller than needed.
|
* table in one PAGE. This may be much smaller than needed.
|
||||||
* We find the smallest non-terminal set of consecutive devices
|
* We find the smallest non-terminal set of consecutive devices
|
||||||
* that is larger than min_spacing and use the size of that as
|
* that is larger than min_sectors and use the size of that as
|
||||||
* the actual spacing
|
* the actual spacing
|
||||||
*/
|
*/
|
||||||
conf->hash_spacing = conf->array_sectors / 2;
|
conf->hash_spacing = conf->array_sectors / 2;
|
||||||
for (i=0; i < cnt-1 ; i++) {
|
for (i=0; i < cnt-1 ; i++) {
|
||||||
sector_t sz = 0;
|
sector_t tmp = 0;
|
||||||
int j;
|
int j;
|
||||||
for (j = i; j < cnt - 1 && sz < min_spacing; j++)
|
for (j = i; j < cnt - 1 && tmp < min_sectors; j++)
|
||||||
sz += conf->disks[j].num_sectors / 2;
|
tmp += conf->disks[j].num_sectors;
|
||||||
if (sz >= min_spacing && sz < conf->hash_spacing)
|
if (tmp >= min_sectors && tmp < conf->hash_spacing * 2)
|
||||||
conf->hash_spacing = sz;
|
conf->hash_spacing = tmp / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hash_spacing may be too large for sector_div to work with,
|
/* hash_spacing may be too large for sector_div to work with,
|
||||||
|
Loading…
Reference in New Issue
Block a user