PERFORCE change 133646 for review
Scott Long
scottl at FreeBSD.org
Sat Jan 19 01:13:03 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=133646
Change 133646 by scottl at scottl-ix on 2008/01/19 09:12:20
Don't spam bp->bio_data while doing a re-aligned I/O operation.
For reasons I don't understand, it causes problems during writes,
but not during reads.
Affected files ...
.. //depot/projects/xen31-xenbus/sys/dev/xen/blkfront/blkfront.c#3 edit
Differences ...
==== //depot/projects/xen31-xenbus/sys/dev/xen/blkfront/blkfront.c#3 (text+ko) ====
@@ -656,6 +656,7 @@
*/
static int blkif_queue_request(struct bio *bp)
{
+ caddr_t alignbuf;
unsigned long buffer_ma;
blkif_request_t *ring_req;
unsigned long id;
@@ -683,16 +684,18 @@
PAGE_SIZE;
caddr_t newbuf = malloc(bp->bio_bcount + align, M_DEVBUF,
M_NOWAIT);
- caddr_t alignbuf = (char *)roundup2((u_long)newbuf, align);
+
+ alignbuf = (char *)roundup2((u_long)newbuf, align);
/* save a copy of the current buffer */
- bp->bio_driver1 = bp->bio_data;
+ bp->bio_driver1 = newbuf;
+ bp->bio_driver2 = alignbuf;
/* Copy the data for a write */
if (bp->bio_cmd == BIO_WRITE)
bcopy(bp->bio_data, alignbuf, bp->bio_bcount);
- bp->bio_data = alignbuf;
- }
+ } else
+ alignbuf = bp->bio_data;
/* Fill out a communications ring structure. */
ring_req = RING_GET_REQUEST(&info->ring,
@@ -711,7 +714,7 @@
* chaining is not supported.
*/
- buffer_ma = vtomach(bp->bio_data);
+ buffer_ma = vtomach(alignbuf);
fsect = (buffer_ma & PAGE_MASK) >> XBD_SECTOR_SHFT;
lsect = fsect + (bp->bio_bcount >> XBD_SECTOR_SHFT) - 1;
/* install a grant reference. */
@@ -823,14 +826,15 @@
switch (bret->operation) {
case BLKIF_OP_READ:
/* had an unaligned buffer that needs to be copied */
- if (bp->bio_driver1)
- bcopy(bp->bio_data, bp->bio_driver1, bp->bio_bcount);
+ if (bp->bio_driver1) {
+ bcopy(bp->bio_driver2, bp->bio_data, bp->bio_bcount);
+ bp->bio_driver1 = NULL;
+ }
case BLKIF_OP_WRITE:
/* free the copy buffer */
if (bp->bio_driver1) {
- free(bp->bio_data, M_DEVBUF);
- bp->bio_data = bp->bio_driver1;
+ free(bp->bio_driver1, M_DEVBUF);
bp->bio_driver1 = NULL;
}
More information about the p4-projects
mailing list