On Wednesday November 20, mtl@slowbone.net wrote:
> > The mod operator on a 64-bit quantity won't work with
> > CONFIG_LBD=y, will it?
>
> Ohh.. there is such a thing.. let's use & :)
>
Here is my version which does the 'right' thing w.r.t. large sector
addresses etc.
I just sent it to Linus for the third time. Hopefully it wont be
dropped again :-(
NeilBrown
--------------------------------------------------------
Fix *_mergeable_bvec routines for linear/raid0.
They take the length of the passed bvec into account, which is wrong.
----------- Diffstat output ------------
./drivers/md/linear.c | 7 ++-----
./drivers/md/raid0.c | 16 ++++++++--------
2 files changed, 10 insertions(+), 13 deletions(-)
diff ./drivers/md/linear.c~current~ ./drivers/md/linear.c
--- ./drivers/md/linear.c~current~ 2002-11-21 09:41:47.000000000 +1100
+++ ./drivers/md/linear.c 2002-11-21 09:41:47.000000000 +1100
@@ -58,15 +58,12 @@ static int linear_mergeable_bvec(request
{
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)
diff ./drivers/md/raid0.c~current~ ./drivers/md/raid0.c
--- ./drivers/md/raid0.c~current~ 2002-11-21 09:41:47.000000000 +1100
+++ ./drivers/md/raid0.c 2002-11-21 09:41:47.000000000 +1100
@@ -173,15 +173,15 @@ static int create_strip_zones (mddev_t *
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_sectors = mddev->chunk_size >> 9;
+ sector = bio->bi_sector;
+ bio_sectors = bio->bi_size >> 9;
- chunk_size = mddev->chunk_size >> 10;
- block = bio->bi_sector >> 1;
- bio_sz = (bio->bi_size + biovec->bv_len) >> 10;
-
- 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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:34 EST