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

md: linear: Make array_size sector-based and rename it to array_sectors.

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

authored by

Andre Noll and committed by
NeilBrown
d6e22150 f233ea5c

+9 -9
+8 -8
drivers/md/linear.c
··· 120 120 return NULL; 121 121 122 122 cnt = 0; 123 - conf->array_size = 0; 123 + conf->array_sectors = 0; 124 124 125 125 rdev_for_each(rdev, tmp, mddev) { 126 126 int j = rdev->raid_disk; ··· 144 144 blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9); 145 145 146 146 disk->size = rdev->size; 147 - conf->array_size += rdev->size; 147 + conf->array_sectors += rdev->size * 2; 148 148 149 149 cnt++; 150 150 } ··· 153 153 goto out; 154 154 } 155 155 156 - min_spacing = conf->array_size; 156 + min_spacing = conf->array_sectors / 2; 157 157 sector_div(min_spacing, PAGE_SIZE/sizeof(struct dev_info *)); 158 158 159 159 /* min_spacing is the minimum spacing that will fit the hash ··· 162 162 * that is larger than min_spacing as use the size of that as 163 163 * the actual spacing 164 164 */ 165 - conf->hash_spacing = conf->array_size; 165 + conf->hash_spacing = conf->array_sectors / 2; 166 166 for (i=0; i < cnt-1 ; i++) { 167 167 sector_t sz = 0; 168 168 int j; ··· 192 192 unsigned round; 193 193 unsigned long base; 194 194 195 - sz = conf->array_size >> conf->preshift; 195 + sz = conf->array_sectors >> (conf->preshift + 1); 196 196 sz += 1; /* force round-up */ 197 197 base = conf->hash_spacing >> conf->preshift; 198 198 round = sector_div(sz, base); ··· 219 219 curr_offset = 0; 220 220 i = 0; 221 221 for (curr_offset = 0; 222 - curr_offset < conf->array_size; 222 + curr_offset < conf->array_sectors / 2; 223 223 curr_offset += conf->hash_spacing) { 224 224 225 225 while (i < raid_disks-1 && ··· 256 256 if (!conf) 257 257 return 1; 258 258 mddev->private = conf; 259 - mddev->array_sectors = conf->array_size * 2; 259 + mddev->array_sectors = conf->array_sectors; 260 260 261 261 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); 262 262 mddev->queue->unplug_fn = linear_unplug; ··· 290 290 newconf->prev = mddev_to_conf(mddev); 291 291 mddev->private = newconf; 292 292 mddev->raid_disks++; 293 - mddev->array_sectors = newconf->array_size * 2; 293 + mddev->array_sectors = newconf->array_sectors; 294 294 set_capacity(mddev->gendisk, mddev->array_sectors); 295 295 return 0; 296 296 }
+1 -1
include/linux/raid/linear.h
··· 16 16 struct linear_private_data *prev; /* earlier version */ 17 17 dev_info_t **hash_table; 18 18 sector_t hash_spacing; 19 - sector_t array_size; 19 + sector_t array_sectors; 20 20 int preshift; /* shift before dividing by hash_spacing */ 21 21 dev_info_t disks[0]; 22 22 };