aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-03-08 00:44:38 -0500
committerNeilBrown <neilb@suse.de>2010-03-16 02:04:24 -0400
commit627a2d3c29427637f4c5d31ccc7fcbd8d312cd71 (patch)
treef0de68842ca3b47d0152254e60d31cc561009119 /drivers/md/raid0.c
parent25cf84cf377c0aae5dbcf937ea89bc7893db5176 (diff)
md: deal with merge_bvec_fn in component devices better.
If a component device has a merge_bvec_fn then as we never call it we must ensure we never need to. Currently this is done by setting max_sector to 1 PAGE, however this does not stop a bio being created with several sub-page iovecs that would violate the merge_bvec_fn. So instead set max_segments to 1 and set the segment boundary to the same as a page boundary to ensure there is only ever one single-page segment of IO requested at a time. This can particularly be an issue when 'xen' is used as it is known to submit multiple small buffers in a single bio. Signed-off-by: NeilBrown <neilb@suse.de> Cc: stable@kernel.org
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r--drivers/md/raid0.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index a1f7147b757f..377cf2a3c333 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -176,14 +176,15 @@ static int create_strip_zones(mddev_t *mddev)
176 disk_stack_limits(mddev->gendisk, rdev1->bdev, 176 disk_stack_limits(mddev->gendisk, rdev1->bdev,
177 rdev1->data_offset << 9); 177 rdev1->data_offset << 9);
178 /* as we don't honour merge_bvec_fn, we must never risk 178 /* as we don't honour merge_bvec_fn, we must never risk
179 * violating it, so limit ->max_sector to one PAGE, as 179 * violating it, so limit ->max_segments to 1, lying within
180 * a one page request is never in violation. 180 * a single page.
181 */ 181 */
182 182
183 if (rdev1->bdev->bd_disk->queue->merge_bvec_fn && 183 if (rdev1->bdev->bd_disk->queue->merge_bvec_fn) {
184 queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 184 blk_queue_max_segments(mddev->queue, 1);
185 blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 185 blk_queue_segment_boundary(mddev->queue,
186 186 PAGE_CACHE_SIZE - 1);
187 }
187 if (!smallest || (rdev1->sectors < smallest->sectors)) 188 if (!smallest || (rdev1->sectors < smallest->sectors))
188 smallest = rdev1; 189 smallest = rdev1;
189 cnt++; 190 cnt++;