diff options
author | NeilBrown <neilb@suse.de> | 2010-03-08 00:44:38 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-03-16 02:04:24 -0400 |
commit | 627a2d3c29427637f4c5d31ccc7fcbd8d312cd71 (patch) | |
tree | f0de68842ca3b47d0152254e60d31cc561009119 /drivers/md/multipath.c | |
parent | 25cf84cf377c0aae5dbcf937ea89bc7893db5176 (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/multipath.c')
-rw-r--r-- | drivers/md/multipath.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 4b323f45ad74..5558ebc705c8 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -301,14 +301,16 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) | |||
301 | rdev->data_offset << 9); | 301 | rdev->data_offset << 9); |
302 | 302 | ||
303 | /* as we don't honour merge_bvec_fn, we must never risk | 303 | /* as we don't honour merge_bvec_fn, we must never risk |
304 | * violating it, so limit ->max_sector to one PAGE, as | 304 | * violating it, so limit ->max_segments to one, lying |
305 | * a one page request is never in violation. | 305 | * within a single page. |
306 | * (Note: it is very unlikely that a device with | 306 | * (Note: it is very unlikely that a device with |
307 | * merge_bvec_fn will be involved in multipath.) | 307 | * merge_bvec_fn will be involved in multipath.) |
308 | */ | 308 | */ |
309 | if (q->merge_bvec_fn && | 309 | if (q->merge_bvec_fn) { |
310 | queue_max_sectors(q) > (PAGE_SIZE>>9)) | 310 | blk_queue_max_segments(mddev->queue, 1); |
311 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); | 311 | blk_queue_segment_boundary(mddev->queue, |
312 | PAGE_CACHE_SIZE - 1); | ||
313 | } | ||
312 | 314 | ||
313 | conf->working_disks++; | 315 | conf->working_disks++; |
314 | mddev->degraded--; | 316 | mddev->degraded--; |
@@ -476,9 +478,11 @@ static int multipath_run (mddev_t *mddev) | |||
476 | /* as we don't honour merge_bvec_fn, we must never risk | 478 | /* as we don't honour merge_bvec_fn, we must never risk |
477 | * violating it, not that we ever expect a device with | 479 | * violating it, not that we ever expect a device with |
478 | * a merge_bvec_fn to be involved in multipath */ | 480 | * a merge_bvec_fn to be involved in multipath */ |
479 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn && | 481 | if (rdev->bdev->bd_disk->queue->merge_bvec_fn) { |
480 | queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) | 482 | blk_queue_max_segments(mddev->queue, 1); |
481 | blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); | 483 | blk_queue_segment_boundary(mddev->queue, |
484 | PAGE_CACHE_SIZE - 1); | ||
485 | } | ||
482 | 486 | ||
483 | if (!test_bit(Faulty, &rdev->flags)) | 487 | if (!test_bit(Faulty, &rdev->flags)) |
484 | conf->working_disks++; | 488 | conf->working_disks++; |