Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
md: deal with merge_bvec_fn in component devices better.

+60 -41
+7 -5
drivers/md/linear.c
··· 172 172 disk_stack_limits(mddev->gendisk, rdev->bdev, 173 173 rdev->data_offset << 9); 174 174 /* as we don't honour merge_bvec_fn, we must never risk 175 - * violating it, so limit ->max_sector to one PAGE, as 176 - * a one page request is never in violation. 175 + * violating it, so limit max_segments to 1 lying within 176 + * a single page. 177 177 */ 178 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 179 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 180 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 178 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 179 + blk_queue_max_segments(mddev->queue, 1); 180 + blk_queue_segment_boundary(mddev->queue, 181 + PAGE_CACHE_SIZE - 1); 182 + } 181 183 182 184 conf->array_sectors += rdev->sectors; 183 185 cnt++;
+12 -8
drivers/md/multipath.c
··· 301 301 rdev->data_offset << 9); 302 302 303 303 /* as we don't honour merge_bvec_fn, we must never risk 304 - * violating it, so limit ->max_sector to one PAGE, as 305 - * a one page request is never in violation. 304 + * violating it, so limit ->max_segments to one, lying 305 + * within a single page. 306 306 * (Note: it is very unlikely that a device with 307 307 * merge_bvec_fn will be involved in multipath.) 308 308 */ 309 - if (q->merge_bvec_fn && 310 - queue_max_sectors(q) > (PAGE_SIZE>>9)) 311 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 309 + if (q->merge_bvec_fn) { 310 + blk_queue_max_segments(mddev->queue, 1); 311 + blk_queue_segment_boundary(mddev->queue, 312 + PAGE_CACHE_SIZE - 1); 313 + } 312 314 313 315 conf->working_disks++; 314 316 mddev->degraded--; ··· 478 476 /* as we don't honour merge_bvec_fn, we must never risk 479 477 * violating it, not that we ever expect a device with 480 478 * a merge_bvec_fn to be involved in multipath */ 481 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 482 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 483 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 479 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 480 + blk_queue_max_segments(mddev->queue, 1); 481 + blk_queue_segment_boundary(mddev->queue, 482 + PAGE_CACHE_SIZE - 1); 483 + } 484 484 485 485 if (!test_bit(Faulty, &rdev->flags)) 486 486 conf->working_disks++;
+7 -6
drivers/md/raid0.c
··· 176 176 disk_stack_limits(mddev->gendisk, rdev1->bdev, 177 177 rdev1->data_offset << 9); 178 178 /* as we don't honour merge_bvec_fn, we must never risk 179 - * violating it, so limit ->max_sector to one PAGE, as 180 - * a one page request is never in violation. 179 + * violating it, so limit ->max_segments to 1, lying within 180 + * a single page. 181 181 */ 182 182 183 - if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && 184 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 185 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 186 - 183 + if (rdev1->bdev->bd_disk->queue->merge_bvec_fn) { 184 + blk_queue_max_segments(mddev->queue, 1); 185 + blk_queue_segment_boundary(mddev->queue, 186 + PAGE_CACHE_SIZE - 1); 187 + } 187 188 if (!smallest || (rdev1->sectors < smallest->sectors)) 188 189 smallest = rdev1; 189 190 cnt++;
+17 -11
drivers/md/raid1.c
··· 1152 1152 1153 1153 disk_stack_limits(mddev->gendisk, rdev->bdev, 1154 1154 rdev->data_offset << 9); 1155 - /* as we don't honour merge_bvec_fn, we must never risk 1156 - * violating it, so limit ->max_sector to one PAGE, as 1157 - * a one page request is never in violation. 1155 + /* as we don't honour merge_bvec_fn, we must 1156 + * never risk violating it, so limit 1157 + * ->max_segments to one lying with a single 1158 + * page, as a one page request is never in 1159 + * violation. 1158 1160 */ 1159 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 1160 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 1161 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 1161 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 1162 + blk_queue_max_segments(mddev->queue, 1); 1163 + blk_queue_segment_boundary(mddev->queue, 1164 + PAGE_CACHE_SIZE - 1); 1165 + } 1162 1166 1163 1167 p->head_position = 0; 1164 1168 rdev->raid_disk = mirror; ··· 2102 2098 disk_stack_limits(mddev->gendisk, rdev->bdev, 2103 2099 rdev->data_offset << 9); 2104 2100 /* as we don't honour merge_bvec_fn, we must never risk 2105 - * violating it, so limit ->max_sector to one PAGE, as 2106 - * a one page request is never in violation. 2101 + * violating it, so limit ->max_segments to 1 lying within 2102 + * a single page, as a one page request is never in violation. 2107 2103 */ 2108 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 2109 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 2110 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 2104 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 2105 + blk_queue_max_segments(mddev->queue, 1); 2106 + blk_queue_segment_boundary(mddev->queue, 2107 + PAGE_CACHE_SIZE - 1); 2108 + } 2111 2109 } 2112 2110 2113 2111 mddev->degraded = 0;
+17 -11
drivers/md/raid10.c
··· 1155 1155 1156 1156 disk_stack_limits(mddev->gendisk, rdev->bdev, 1157 1157 rdev->data_offset << 9); 1158 - /* as we don't honour merge_bvec_fn, we must never risk 1159 - * violating it, so limit ->max_sector to one PAGE, as 1160 - * a one page request is never in violation. 1158 + /* as we don't honour merge_bvec_fn, we must 1159 + * never risk violating it, so limit 1160 + * ->max_segments to one lying with a single 1161 + * page, as a one page request is never in 1162 + * violation. 1161 1163 */ 1162 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 1163 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 1164 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 1164 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 1165 + blk_queue_max_segments(mddev->queue, 1); 1166 + blk_queue_segment_boundary(mddev->queue, 1167 + PAGE_CACHE_SIZE - 1); 1168 + } 1165 1169 1166 1170 p->head_position = 0; 1167 1171 rdev->raid_disk = mirror; ··· 2259 2255 disk_stack_limits(mddev->gendisk, rdev->bdev, 2260 2256 rdev->data_offset << 9); 2261 2257 /* as we don't honour merge_bvec_fn, we must never risk 2262 - * violating it, so limit ->max_sector to one PAGE, as 2263 - * a one page request is never in violation. 2258 + * violating it, so limit max_segments to 1 lying 2259 + * within a single page. 2264 2260 */ 2265 - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 2266 - queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 2267 - blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 2261 + if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { 2262 + blk_queue_max_segments(mddev->queue, 1); 2263 + blk_queue_segment_boundary(mddev->queue, 2264 + PAGE_CACHE_SIZE - 1); 2265 + } 2268 2266 2269 2267 disk->head_position = 0; 2270 2268 }