[PATCH] loopy loop loop

Hugh Dickins (hugh@veritas.com)
Tue, 4 Feb 2003 20:11:36 +0000 (GMT)


The loop driver's loop over elements of bi_io_vec is in lo_send and
lo_receive: iterating that same transfer bi_vcnt times at the level
above is, er, excessive. (And no need to increment bi_idx here.)

Hugh

--- 2.5.59/drivers/block/loop.c Tue Dec 10 05:49:02 2002
+++ linux/drivers/block/loop.c Tue Feb 4 19:44:01 2003
@@ -350,15 +350,10 @@
int ret;

pos = ((loff_t) bio->bi_sector << 9) + lo->lo_offset;
-
- do {
- if (bio_rw(bio) == WRITE)
- ret = lo_send(lo, bio, lo->lo_blocksize, pos);
- else
- ret = lo_receive(lo, bio, lo->lo_blocksize, pos);
-
- } while (++bio->bi_idx < bio->bi_vcnt);
-
+ if (bio_rw(bio) == WRITE)
+ ret = lo_send(lo, bio, lo->lo_blocksize, pos);
+ else
+ ret = lo_receive(lo, bio, lo->lo_blocksize, pos);
return ret;
}

-
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/