Commit a70de32b authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] Fix *_mergeable_bvec routines for linear/raid0.

They take the length of the passed bvec into account, which is wrong.
parent 61e09046
......@@ -58,15 +58,12 @@ static int linear_mergeable_bvec(request_queue_t *q, struct bio *bio, struct bio
{
mddev_t *mddev = q->queuedata;
dev_info_t *dev0;
int maxsectors, bio_sectors = (bio->bi_size + biovec->bv_len) >> 9;
unsigned long maxsectors, bio_sectors = bio->bi_size >> 9;
dev0 = which_dev(mddev, bio->bi_sector);
maxsectors = (dev0->size << 1) - (bio->bi_sector - (dev0->offset<<1));
if (bio_sectors <= maxsectors)
return biovec->bv_len;
return (maxsectors << 9) - bio->bi_size;
return (maxsectors - bio_sectors) << 9;
}
static int linear_run (mddev_t *mddev)
......
......@@ -173,15 +173,15 @@ static int create_strip_zones (mddev_t *mddev)
static int raid0_mergeable_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *biovec)
{
mddev_t *mddev = q->queuedata;
sector_t block;
unsigned int chunk_size;
unsigned int bio_sz;
sector_t sector;
unsigned int chunk_sectors;
unsigned int bio_sectors;
chunk_size = mddev->chunk_size >> 10;
block = bio->bi_sector >> 1;
bio_sz = (bio->bi_size + biovec->bv_len) >> 10;
chunk_sectors = mddev->chunk_size >> 9;
sector = bio->bi_sector;
bio_sectors = bio->bi_size >> 9;
return (chunk_size - ((block & (chunk_size - 1)) + bio_sz)) << 10;
return (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
}
static int raid0_run (mddev_t *mddev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment