diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/linear.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 1dadb134e0bb..13e928bde7cd 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -112,7 +112,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
112 | dev_info_t **table; | 112 | dev_info_t **table; |
113 | mdk_rdev_t *rdev; | 113 | mdk_rdev_t *rdev; |
114 | int i, nb_zone, cnt; | 114 | int i, nb_zone, cnt; |
115 | sector_t min_spacing; | 115 | sector_t min_sectors; |
116 | sector_t curr_sector; | 116 | sector_t curr_sector; |
117 | struct list_head *tmp; | 117 | struct list_head *tmp; |
118 | 118 | ||
@@ -155,23 +155,23 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
155 | goto out; | 155 | goto out; |
156 | } | 156 | } |
157 | 157 | ||
158 | min_spacing = conf->array_sectors / 2; | 158 | min_sectors = conf->array_sectors; |
159 | sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); | 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 | * table in one PAGE. This may be much smaller than needed. | 162 | * table in one PAGE. This may be much smaller than needed. |
163 | * We find the smallest non-terminal set of consecutive devices | 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 | * the actual spacing | 165 | * the actual spacing |
166 | */ | 166 | */ |
167 | conf->hash_spacing = conf->array_sectors / 2; | 167 | conf->hash_spacing = conf->array_sectors / 2; |
168 | for (i=0; i < cnt-1 ; i++) { | 168 | for (i=0; i < cnt-1 ; i++) { |
169 | sector_t sz = 0; | 169 | sector_t tmp = 0; |
170 | int j; | 170 | int j; |
171 | for (j = i; j < cnt - 1 && sz < min_spacing; j++) | 171 | for (j = i; j < cnt - 1 && tmp < min_sectors; j++) |
172 | sz += conf->disks[j].num_sectors / 2; | 172 | tmp += conf->disks[j].num_sectors; |
173 | if (sz >= min_spacing && sz < conf->hash_spacing) | 173 | if (tmp >= min_sectors && tmp < conf->hash_spacing * 2) |
174 | conf->hash_spacing = sz; | 174 | conf->hash_spacing = tmp / 2; |
175 | } | 175 | } |
176 | 176 | ||
177 | /* hash_spacing may be too large for sector_div to work with, | 177 | /* hash_spacing may be too large for sector_div to work with, |