diff options
author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2013-01-07 20:19:15 +0000 |
---|---|---|
committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2013-01-07 20:19:15 +0000 |
commit | 0b7432c58d2d92850905683b41c515809139ffc1 (patch) | |
tree | 899b0b2ff99e5bc529e3b4fda4bc7b3b25a74e73 /src/VBox/Storage/ISCSI.cpp | |
parent | 5b2e40bf2b5d8d9c9490bad8e9bf9a3dc9ed33f1 (diff) | |
download | VirtualBox-svn-0b7432c58d2d92850905683b41c515809139ffc1.tar.gz |
Storage: Next step in the sync/async I/O unification, change all calls to pfnRead/pfnWrite/pfnFlush to pfnAsyncRead/pfnAsyncWrite/pfnFlush
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@44242 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/Storage/ISCSI.cpp')
-rw-r--r-- | src/VBox/Storage/ISCSI.cpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/VBox/Storage/ISCSI.cpp b/src/VBox/Storage/ISCSI.cpp index 5ed7994721a..8e46699396f 100644 --- a/src/VBox/Storage/ISCSI.cpp +++ b/src/VBox/Storage/ISCSI.cpp @@ -5279,12 +5279,14 @@ static void iscsiDump(void *pBackendData) static int iscsiAsyncRead(void *pBackendData, uint64_t uOffset, size_t cbToRead, PVDIOCTX pIoCtx, size_t *pcbActuallyRead) { - LogFlowFunc(("pBackendData=%p uOffset=%#llx pIoCtx=%#p cbToRead=%u pcbActuallyRead=%p\n", - pBackendData, uOffset, pIoCtx, cbToRead, pcbActuallyRead)); PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData; int rc = VINF_SUCCESS; - if (uOffset + cbToRead > pImage->cbSize) + LogFlowFunc(("pBackendData=%p uOffset=%#llx pIoCtx=%#p cbToRead=%u pcbActuallyRead=%p\n", + pBackendData, uOffset, pIoCtx, cbToRead, pcbActuallyRead)); + + if ( uOffset + cbToRead > pImage->cbSize + || cbToRead == 0) return VERR_INVALID_PARAMETER; /* @@ -5292,6 +5294,20 @@ static int iscsiAsyncRead(void *pBackendData, uint64_t uOffset, size_t cbToRead, */ cbToRead = RT_MIN(cbToRead, pImage->cbRecvDataLength); + /** @todo: Remove iscsiRead and integrate properly. */ + if (vdIfIoIntIoCtxIsSynchronous(pImage->pIfIo, pIoCtx)) + { + RTSGSEG Segment; + unsigned cSegments = 1; + size_t cbSegs; + + cbSegs = pImage->pIfIo->pfnIoCtxSegArrayCreate(pImage->pIfIo->Core.pvUser, pIoCtx, + &Segment, &cSegments, cbToRead); + Assert(cbSegs == cbToRead); + + return iscsiRead(pBackendData, uOffset, Segment.pvSeg, cbToRead, pcbActuallyRead); + } + unsigned cT2ISegs = 0; size_t cbSegs = 0; @@ -5417,6 +5433,21 @@ static int iscsiAsyncWrite(void *pBackendData, uint64_t uOffset, size_t cbToWrit */ cbToWrite = RT_MIN(cbToWrite, pImage->cbSendDataLength); + /** @todo: Remove iscsiWrite and integrate properly. */ + if (vdIfIoIntIoCtxIsSynchronous(pImage->pIfIo, pIoCtx)) + { + RTSGSEG Segment; + unsigned cSegments = 1; + size_t cbSegs; + + cbSegs = pImage->pIfIo->pfnIoCtxSegArrayCreate(pImage->pIfIo->Core.pvUser, pIoCtx, + &Segment, &cSegments, cbToWrite); + Assert(cbSegs == cbToWrite); + + return iscsiWrite(pBackendData, uOffset, Segment.pvSeg, cbToWrite, + pcbWriteProcess, pcbPreRead, pcbPostRead, fWrite); + } + unsigned cI2TSegs = 0; size_t cbSegs = 0; @@ -5526,6 +5557,10 @@ static int iscsiAsyncFlush(void *pBackendData, PVDIOCTX pIoCtx) PISCSIIMAGE pImage = (PISCSIIMAGE)pBackendData; int rc = VINF_SUCCESS; + /** @todo: Remove iscsiFlush and integrate properly. */ + if (vdIfIoIntIoCtxIsSynchronous(pImage->pIfIo, pIoCtx)) + return iscsiFlush(pBackendData); + PSCSIREQASYNC pReqAsync = (PSCSIREQASYNC)RTMemAllocZ(sizeof(SCSIREQASYNC)); if (RT_LIKELY(pReqAsync)) { |