Re: [PATCH] remove useless highmem bounce from loop/cryptoloop

From: Ben Slusky
Date: Wed Nov 12 2003 - 22:09:14 EST


One more patch --- this fixes a minor bio handling bug in the filebacked
code path. I'd fixed it incidentally in the loop-recycle patch.

I don't think you could actually see damage from this bug unless you
run device mapper on top of loop devices, but still this is the correct
behavior. Please apply.

This should also apply cleanly over 2.6.0-test9-mm2.

-
-Ben


--
Ben Slusky | I'm amazed that I'm still
sluskyb@xxxxxxxxxxxxxx | standing and I demand that we
sluskyb@xxxxxxxxxx | all blend in
PGP keyID ADA44B3B | -Foo Fighters
--- linux-2.6.0-test9-akpm/drivers/block/loop.c 2003-11-08 19:28:07.000000000 -0500
+++ linux-2.6.0-test9-sluskyb/drivers/block/loop.c 2003-11-08 19:14:41.000000000 -0500
@@ -264,12 +264,10 @@ fail:
static int
lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
{
- unsigned vecnr;
- int ret = 0;
-
- for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) {
- struct bio_vec *bvec = &bio->bi_io_vec[vecnr];
+ struct bio_vec *bvec;
+ int i, ret = 0;

+ bio_for_each_segment(bvec, bio, i) {
ret = do_lo_send(lo, bvec, bsize, pos);
if (ret < 0)
break;
@@ -333,12 +331,10 @@ do_lo_receive(struct loop_device *lo,
static int
lo_receive(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
{
- unsigned vecnr;
- int ret = 0;
-
- for (vecnr = 0; vecnr < bio->bi_vcnt; vecnr++) {
- struct bio_vec *bvec = &bio->bi_io_vec[vecnr];
+ struct bio_vec *bvec;
+ int i, ret = 0;

+ bio_for_each_segment(bvec, bio, i) {
ret = do_lo_receive(lo, bvec, bsize, pos);
if (ret < 0)
break;