[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/12] VTPM mini-os: posix IO layer for blkfront in mini-os
Matthew Fioravante, le Fri 11 Mar 2011 17:34:26 -0500, a écrit : > + /*Make sure we have write permission */ > + if(dev->info.info & VDISK_READONLY || dev->info.mode != O_RDWR) { O_WRONLY too. > + aiocb.aio_dev = dev; > + aiocb.aio_buf = _xmalloc(blocksize, dev->info.sector_size); > + aiocb.aio_nbytes = blocksize; > + aiocb.aio_offset = blknum * blocksize; > + aiocb.aio_cb = NULL; > + aiocb.data = NULL; > + > + /* read operation */ > + if(!write) { > + aiocb.aio_cb = NULL; > + blkfront_read(&aiocb); > + memcpy(buf, &aiocb.aio_buf[blkoff], bytes); > + } Could you perhaps optimize when buf is actually aligned? That would save a copy. > + /* Write operation */ > + else { > + /* If we're writing a partial block, we need to read the current > contents first > + * so we don't overwrite the extra bits with garbage */ > + if(blkoff != 0 || bytes < blocksize) { > + aiocb.aio_cb = NULL; Maybe blkfront_aio_cb should do it itself? It looks odd to have to do it when reusing an aiocb structure. Apart from that it looks good. Samuel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |