Changeset 34217 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Nov 21, 2010 2:45:14 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67961
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VD.cpp
r33745 r34217 903 903 DECLINLINE(PVDIOCTX) vdIoCtxAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 904 904 uint64_t uOffset, size_t cbTransfer, 905 PCRTSGSEG pcaSeg, unsigned cSeg, 906 void *pvAllocation, 905 PCRTSGBUF pcSgBuf, void *pvAllocation, 907 906 PFNVDIOCTXTRANSFER pfnIoCtxTransfer) 908 907 { … … 928 927 /* There is no S/G list for a flush request. */ 929 928 if (enmTxDir != VDIOCTXTXDIR_FLUSH) 930 RTSgBuf Init(&pIoCtx->SgBuf, pcaSeg, cSeg);929 RTSgBufClone(&pIoCtx->SgBuf, pcSgBuf); 931 930 else 932 931 memset(&pIoCtx->SgBuf, 0, sizeof(RTSGBUF)); … … 938 937 DECLINLINE(PVDIOCTX) vdIoCtxRootAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 939 938 uint64_t uOffset, size_t cbTransfer, 940 PCRTSG SEG paSeg, unsigned cSeg,939 PCRTSGBUF pcSgBuf, 941 940 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 942 941 void *pvUser1, void *pvUser2, … … 945 944 { 946 945 PVDIOCTX pIoCtx = vdIoCtxAlloc(pDisk, enmTxDir, uOffset, cbTransfer, 947 p aSeg, cSeg, pvAllocation, pfnIoCtxTransfer);946 pcSgBuf, pvAllocation, pfnIoCtxTransfer); 948 947 949 948 if (RT_LIKELY(pIoCtx)) … … 961 960 DECLINLINE(PVDIOCTX) vdIoCtxChildAlloc(PVBOXHDD pDisk, VDIOCTXTXDIR enmTxDir, 962 961 uint64_t uOffset, size_t cbTransfer, 963 PCRTSG SEG paSeg, unsigned cSeg,962 PCRTSGBUF pcSgBuf, 964 963 PVDIOCTX pIoCtxParent, size_t cbTransferParent, 965 964 size_t cbWriteParent, void *pvAllocation, … … 967 966 { 968 967 PVDIOCTX pIoCtx = vdIoCtxAlloc(pDisk, enmTxDir, uOffset, cbTransfer, 969 p aSeg, cSeg, pvAllocation, pfnIoCtxTransfer);968 pcSgBuf, pvAllocation, pfnIoCtxTransfer); 970 969 971 970 AssertPtr(pIoCtxParent); … … 1934 1933 * A bit hackish but avoids the need to allocate memory twice. 1935 1934 */ 1936 PRTSG SEG pTmp = (PRTSGSEG)RTMemAlloc(cbPreRead + cbThisWrite + cbPostRead + sizeof(RTSGSEG));1935 PRTSGBUF pTmp = (PRTSGBUF)RTMemAlloc(cbPreRead + cbThisWrite + cbPostRead + sizeof(RTSGSEG) + sizeof(RTSGBUF)); 1937 1936 AssertBreakStmt(VALID_PTR(pTmp), rc = VERR_NO_MEMORY); 1938 1939 pTmp->pvSeg = pTmp + 1; 1940 pTmp->cbSeg = cbPreRead + cbThisWrite + cbPostRead; 1937 PRTSGSEG pSeg = (PRTSGSEG)(pTmp + 1); 1938 1939 pSeg->pvSeg = pSeg + 1; 1940 pSeg->cbSeg = cbPreRead + cbThisWrite + cbPostRead; 1941 RTSgBufInit(pTmp, pSeg, 1); 1941 1942 1942 1943 PVDIOCTX pIoCtxWrite = vdIoCtxChildAlloc(pDisk, VDIOCTXTXDIR_WRITE, 1943 uOffset, p Tmp->cbSeg,1944 pTmp, 1,1944 uOffset, pSeg->cbSeg, 1945 pTmp, 1945 1946 pIoCtx, cbThisWrite, 1946 1947 cbWrite, … … 7918 7919 7919 7920 VBOXDDU_DECL(int) VDAsyncRead(PVBOXHDD pDisk, uint64_t uOffset, size_t cbRead, 7920 PCRTSG SEG paSeg, unsigned cSeg,7921 PCRTSGBUF pcSgBuf, 7921 7922 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 7922 7923 void *pvUser1, void *pvUser2) … … 7927 7928 PVDIOCTX pIoCtx = NULL; 7928 7929 7929 LogFlowFunc(("pDisk=%#p uOffset=%llu p aSeg=%p cSeg=%ucbRead=%zu pvUser1=%#p pvUser2=%#p\n",7930 pDisk, uOffset, p aSeg, cSeg, cbRead, pvUser1, pvUser2));7930 LogFlowFunc(("pDisk=%#p uOffset=%llu pcSgBuf=%#p cbRead=%zu pvUser1=%#p pvUser2=%#p\n", 7931 pDisk, uOffset, pcSgBuf, cbRead, pvUser1, pvUser2)); 7931 7932 7932 7933 do … … 7940 7941 ("cbRead=%zu\n", cbRead), 7941 7942 rc = VERR_INVALID_PARAMETER); 7942 AssertMsgBreakStmt(VALID_PTR(paSeg), 7943 ("paSeg=%#p\n", paSeg), 7944 rc = VERR_INVALID_PARAMETER); 7945 AssertMsgBreakStmt(cSeg, 7946 ("cSeg=%zu\n", cSeg), 7943 AssertMsgBreakStmt(VALID_PTR(pcSgBuf), 7944 ("pcSgBuf=%#p\n", pcSgBuf), 7947 7945 rc = VERR_INVALID_PARAMETER); 7948 7946 … … 7957 7955 7958 7956 pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_READ, uOffset, 7959 cbRead, p aSeg, cSeg,7957 cbRead, pcSgBuf, 7960 7958 pfnComplete, pvUser1, pvUser2, 7961 7959 NULL, vdReadHelperAsync); … … 7995 7993 7996 7994 VBOXDDU_DECL(int) VDAsyncWrite(PVBOXHDD pDisk, uint64_t uOffset, size_t cbWrite, 7997 PCRTSG SEG paSeg, unsigned cSeg,7995 PCRTSGBUF pcSgBuf, 7998 7996 PFNVDASYNCTRANSFERCOMPLETE pfnComplete, 7999 7997 void *pvUser1, void *pvUser2) … … 8004 8002 PVDIOCTX pIoCtx = NULL; 8005 8003 8006 LogFlowFunc(("pDisk=%#p uOffset=%llu paSeg=%p cSeg=%ucbWrite=%zu pvUser1=%#p pvUser2=%#p\n",8007 pDisk, uOffset, p aSeg, cSeg, cbWrite, pvUser1, pvUser2));8004 LogFlowFunc(("pDisk=%#p uOffset=%llu cSgBuf=%#p cbWrite=%zu pvUser1=%#p pvUser2=%#p\n", 8005 pDisk, uOffset, pcSgBuf, cbWrite, pvUser1, pvUser2)); 8008 8006 do 8009 8007 { … … 8016 8014 ("cbWrite=%zu\n", cbWrite), 8017 8015 rc = VERR_INVALID_PARAMETER); 8018 AssertMsgBreakStmt(VALID_PTR(paSeg), 8019 ("paSeg=%#p\n", paSeg), 8020 rc = VERR_INVALID_PARAMETER); 8021 AssertMsgBreakStmt(cSeg, 8022 ("cSeg=%zu\n", cSeg), 8016 AssertMsgBreakStmt(VALID_PTR(pcSgBuf), 8017 ("pcSgBuf=%#p\n", pcSgBuf), 8023 8018 rc = VERR_INVALID_PARAMETER); 8024 8019 … … 8033 8028 8034 8029 pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_WRITE, uOffset, 8035 cbWrite, p aSeg, cSeg,8030 cbWrite, pcSgBuf, 8036 8031 pfnComplete, pvUser1, pvUser2, 8037 8032 NULL, vdWriteHelperAsync); … … 8091 8086 8092 8087 pIoCtx = vdIoCtxRootAlloc(pDisk, VDIOCTXTXDIR_FLUSH, 0, 8093 0, NULL, 0,8088 0, NULL, 8094 8089 pfnComplete, pvUser1, pvUser2, 8095 8090 NULL, vdFlushHelperAsync);
Note:
See TracChangeset
for help on using the changeset viewer.