From: NeilBrown Date: Tue, 17 May 2005 04:53:15 +0000 (-0700) Subject: [PATCH] md: fix splitting of md/linear request that cross a device boundary X-Git-Tag: v2.6.12-rc5~159 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29ac8e056f2016a8404edc02749d095019aa1f82;p=linux-2.6 [PATCH] md: fix splitting of md/linear request that cross a device boundary When a request crosses a boundary between devices, it needs to be split. But where we should calculate the amount of the request before the boundary to find the split-point, we care currently calculating the amount that is *after* the boundary !!! Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 161e9aa872..b1941b887f 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -269,9 +269,8 @@ static int linear_make_request (request_queue_t *q, struct bio *bio) * split it. */ struct bio_pair *bp; - bp = bio_split(bio, bio_split_pool, - (bio->bi_sector + (bio->bi_size >> 9) - - (tmp_dev->offset + tmp_dev->size))<<1); + bp = bio_split(bio, bio_split_pool, + ((tmp_dev->offset + tmp_dev->size)<<1) - bio->bi_sector); if (linear_make_request(q, &bp->bio1)) generic_make_request(&bp->bio1); if (linear_make_request(q, &bp->bio2))