Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115086
b: refs/heads/master
c: 23242fb
h: refs/heads/master
v: v3
  • Loading branch information
Andre Noll authored and NeilBrown committed Oct 13, 2008
1 parent 806bbbf commit d61d5ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6283815d1853b7daf31dc4adb83e5c1dc9568251
refs/heads/master: 23242fbb470ff4c8c4d41f178832cf1929273d7d
20 changes: 10 additions & 10 deletions trunk/drivers/md/linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
dev_info_t **table;
mdk_rdev_t *rdev;
int i, nb_zone, cnt;
sector_t min_spacing;
sector_t min_sectors;
sector_t curr_sector;
struct list_head *tmp;

Expand Down Expand Up @@ -155,23 +155,23 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
goto out;
}

min_spacing = conf->array_sectors / 2;
sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *));
min_sectors = conf->array_sectors;
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.
* 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
*/
conf->hash_spacing = conf->array_sectors / 2;
for (i=0; i < cnt-1 ; i++) {
sector_t sz = 0;
sector_t tmp = 0;
int j;
for (j = i; j < cnt - 1 && sz < min_spacing; j++)
sz += conf->disks[j].num_sectors / 2;
if (sz >= min_spacing && sz < conf->hash_spacing)
conf->hash_spacing = sz;
for (j = i; j < cnt - 1 && tmp < min_sectors; j++)
tmp += conf->disks[j].num_sectors;
if (tmp >= min_sectors && tmp < conf->hash_spacing * 2)
conf->hash_spacing = tmp / 2;
}

/* hash_spacing may be too large for sector_div to work with,
Expand Down

0 comments on commit d61d5ec

Please sign in to comment.