aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 5a06122abd3b..e59b10e66edb 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -31,6 +31,7 @@
31 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 */ 32 */
33 33
34#include <linux/slab.h>
34#include <linux/delay.h> 35#include <linux/delay.h>
35#include <linux/blkdev.h> 36#include <linux/blkdev.h>
36#include <linux/seq_file.h> 37#include <linux/seq_file.h>
@@ -1152,13 +1153,17 @@ static int raid1_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)
1152 1153
1153 disk_stack_limits(mddev->gendisk, rdev->bdev, 1154 disk_stack_limits(mddev->gendisk, rdev->bdev,
1154 rdev->data_offset << 9); 1155 rdev->data_offset << 9);
1155 /* as we don't honour merge_bvec_fn, we must never risk 1156 /* as we don't honour merge_bvec_fn, we must
1156 * violating it, so limit ->max_sector to one PAGE, as 1157 * never risk violating it, so limit
1157 * a one page request is never in violation. 1158 * ->max_segments to one lying with a single
1159 * page, as a one page request is never in
1160 * violation.
1158 */ 1161 */
1159 if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 1162 if (rdev->bdev->bd_disk->queue->merge_bvec_fn) {
1160 queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 1163 blk_queue_max_segments(mddev->queue, 1);
1161 blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 1164 blk_queue_segment_boundary(mddev->queue,
1165 PAGE_CACHE_SIZE - 1);
1166 }
1162 1167
1163 p->head_position = 0; 1168 p->head_position = 0;
1164 rdev->raid_disk = mirror; 1169 rdev->raid_disk = mirror;
@@ -2098,12 +2103,14 @@ static int run(mddev_t *mddev)
2098 disk_stack_limits(mddev->gendisk, rdev->bdev, 2103 disk_stack_limits(mddev->gendisk, rdev->bdev,
2099 rdev->data_offset << 9); 2104 rdev->data_offset << 9);
2100 /* as we don't honour merge_bvec_fn, we must never risk 2105 /* as we don't honour merge_bvec_fn, we must never risk
2101 * violating it, so limit ->max_sector to one PAGE, as 2106 * violating it, so limit ->max_segments to 1 lying within
2102 * a one page request is never in violation. 2107 * a single page, as a one page request is never in violation.
2103 */ 2108 */
2104 if (rdev->bdev->bd_disk->queue->merge_bvec_fn && 2109 if (rdev->bdev->bd_disk->queue->merge_bvec_fn) {
2105 queue_max_sectors(mddev->queue) > (PAGE_SIZE>>9)) 2110 blk_queue_max_segments(mddev->queue, 1);
2106 blk_queue_max_hw_sectors(mddev->queue, PAGE_SIZE>>9); 2111 blk_queue_segment_boundary(mddev->queue,
2112 PAGE_CACHE_SIZE - 1);
2113 }
2107 } 2114 }
2108 2115
2109 mddev->degraded = 0; 2116 mddev->degraded = 0;