Changeset 31586 in vbox for trunk/src/VBox
- Timestamp:
- Aug 11, 2010 10:20:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VBoxHDD.cpp
r31573 r31586 905 905 && !pIoCtx->cDataTransfersPending) 906 906 rc = VINF_VD_ASYNC_IO_FINISHED; 907 else if (RT_SUCCESS(rc) || rc == VERR_VD_NOT_ENOUGH_METADATA) 907 else if ( RT_SUCCESS(rc) 908 || rc == VERR_VD_NOT_ENOUGH_METADATA 909 || rc == VERR_VD_IOCTX_HALT) 908 910 rc = VERR_VD_ASYNC_IO_IN_PROGRESS; 909 911 else if (RT_FAILURE(rc) && (rc != VERR_VD_ASYNC_IO_IN_PROGRESS)) … … 983 985 else if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 984 986 rc = VINF_SUCCESS; 987 else if (rc == VERR_VD_IOCTX_HALT) 988 { 989 uOffset += cbThisRead; 990 cbToRead -= cbThisRead; 991 pIoCtx->fBlocked = true; 992 } 985 993 986 994 if (RT_FAILURE(rc)) … … 991 999 } while (cbToRead != 0 && RT_SUCCESS(rc)); 992 1000 993 if (rc == VERR_VD_NOT_ENOUGH_METADATA) 1001 if ( rc == VERR_VD_NOT_ENOUGH_METADATA 1002 || rc == VERR_VD_IOCTX_HALT) 994 1003 { 995 1004 /* Save the current state. */ … … 1451 1460 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS) 1452 1461 rc = VINF_SUCCESS; 1462 else if (rc == VERR_VD_IOCTX_HALT) 1463 { 1464 pIoCtx->fBlocked = true; 1465 rc = VINF_SUCCESS; 1466 } 1453 1467 1454 1468 return rc; … … 1651 1665 } 1652 1666 1653 if (rc == VERR_VD_NOT_ENOUGH_METADATA) 1667 if (rc == VERR_VD_IOCTX_HALT) 1668 { 1669 cbWrite -= cbThisWrite; 1670 uOffset += cbThisWrite; 1671 pIoCtx->fBlocked = true; 1672 break; 1673 } 1674 else if (rc == VERR_VD_NOT_ENOUGH_METADATA) 1654 1675 break; 1655 1676 … … 1658 1679 } while (cbWrite != 0 && (RT_SUCCESS(rc) || rc == VERR_VD_ASYNC_IO_IN_PROGRESS)); 1659 1680 1660 if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS || rc == VERR_VD_NOT_ENOUGH_METADATA) 1681 if ( rc == VERR_VD_ASYNC_IO_IN_PROGRESS 1682 || rc == VERR_VD_NOT_ENOUGH_METADATA 1683 || rc == VERR_VD_IOCTX_HALT) 1661 1684 { 1662 1685 /* … … 2801 2824 } 2802 2825 2826 static size_t vdIOIoCtxSegArrayCreate(void *pvUser, PVDIOCTX pIoCtx, 2827 PRTSGSEG paSeg, unsigned *pcSeg, 2828 size_t cbData) 2829 { 2830 PVDIMAGE pImage = (PVDIMAGE)pvUser; 2831 PVBOXHDD pDisk = pImage->pDisk; 2832 size_t cbCreated = 0; 2833 2834 VD_THREAD_IS_CRITSECT_OWNER(pDisk); 2835 2836 cbCreated = RTSgBufSegArrayCreate(&pIoCtx->SgBuf, paSeg, pcSeg, cbData); 2837 Assert(!paSeg || cbData == cbCreated); 2838 2839 return cbCreated; 2840 } 2841 2842 static void vdIOIoCtxCompleted(void *pvUser, PVDIOCTX pIoCtx, int rcReq, 2843 size_t cbCompleted) 2844 { 2845 /* Continue */ 2846 pIoCtx->fBlocked = false; 2847 ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbCompleted); 2848 2849 /* Clear the pointer to next transfer function in case we have nothing to transfer anymore. 2850 * @todo: Find a better way to prevent vdIoCtxContinue from calling the read/write helper again. */ 2851 if (!pIoCtx->cbTransferLeft) 2852 pIoCtx->pfnIoCtxTransfer = NULL; 2853 2854 vdIoCtxContinue(pIoCtx, rcReq); 2855 } 2856 2803 2857 /** 2804 2858 * VD I/O interface callback for opening a file (limited version for VDGetFormat). … … 3124 3178 3125 3179 /* Create the I/O callback table. */ 3126 pDisk->VDIIOCallbacks.cbSize = sizeof(VDINTERFACEIO); 3127 pDisk->VDIIOCallbacks.enmInterface = VDINTERFACETYPE_IO; 3128 pDisk->VDIIOCallbacks.pfnOpen = vdIOOpen; 3129 pDisk->VDIIOCallbacks.pfnClose = vdIOClose; 3130 pDisk->VDIIOCallbacks.pfnGetSize = vdIOGetSize; 3131 pDisk->VDIIOCallbacks.pfnSetSize = vdIOSetSize; 3132 pDisk->VDIIOCallbacks.pfnReadSync = vdIOReadSync; 3133 pDisk->VDIIOCallbacks.pfnWriteSync = vdIOWriteSync; 3134 pDisk->VDIIOCallbacks.pfnFlushSync = vdIOFlushSync; 3135 pDisk->VDIIOCallbacks.pfnReadUserAsync = vdIOReadUserAsync; 3136 pDisk->VDIIOCallbacks.pfnWriteUserAsync = vdIOWriteUserAsync; 3137 pDisk->VDIIOCallbacks.pfnReadMetaAsync = vdIOReadMetaAsync; 3138 pDisk->VDIIOCallbacks.pfnWriteMetaAsync = vdIOWriteMetaAsync; 3139 pDisk->VDIIOCallbacks.pfnMetaXferRelease = vdIOMetaXferRelease; 3140 pDisk->VDIIOCallbacks.pfnFlushAsync = vdIOFlushAsync; 3141 pDisk->VDIIOCallbacks.pfnIoCtxCopyFrom = vdIOIoCtxCopyFrom; 3142 pDisk->VDIIOCallbacks.pfnIoCtxCopyTo = vdIOIoCtxCopyTo; 3143 pDisk->VDIIOCallbacks.pfnIoCtxSet = vdIOIoCtxSet; 3180 pDisk->VDIIOCallbacks.cbSize = sizeof(VDINTERFACEIO); 3181 pDisk->VDIIOCallbacks.enmInterface = VDINTERFACETYPE_IO; 3182 pDisk->VDIIOCallbacks.pfnOpen = vdIOOpen; 3183 pDisk->VDIIOCallbacks.pfnClose = vdIOClose; 3184 pDisk->VDIIOCallbacks.pfnGetSize = vdIOGetSize; 3185 pDisk->VDIIOCallbacks.pfnSetSize = vdIOSetSize; 3186 pDisk->VDIIOCallbacks.pfnReadSync = vdIOReadSync; 3187 pDisk->VDIIOCallbacks.pfnWriteSync = vdIOWriteSync; 3188 pDisk->VDIIOCallbacks.pfnFlushSync = vdIOFlushSync; 3189 pDisk->VDIIOCallbacks.pfnReadUserAsync = vdIOReadUserAsync; 3190 pDisk->VDIIOCallbacks.pfnWriteUserAsync = vdIOWriteUserAsync; 3191 pDisk->VDIIOCallbacks.pfnReadMetaAsync = vdIOReadMetaAsync; 3192 pDisk->VDIIOCallbacks.pfnWriteMetaAsync = vdIOWriteMetaAsync; 3193 pDisk->VDIIOCallbacks.pfnMetaXferRelease = vdIOMetaXferRelease; 3194 pDisk->VDIIOCallbacks.pfnFlushAsync = vdIOFlushAsync; 3195 pDisk->VDIIOCallbacks.pfnIoCtxCopyFrom = vdIOIoCtxCopyFrom; 3196 pDisk->VDIIOCallbacks.pfnIoCtxCopyTo = vdIOIoCtxCopyTo; 3197 pDisk->VDIIOCallbacks.pfnIoCtxSet = vdIOIoCtxSet; 3198 pDisk->VDIIOCallbacks.pfnIoCtxSegArrayCreate = vdIOIoCtxSegArrayCreate; 3199 pDisk->VDIIOCallbacks.pfnIoCtxCompleted = vdIOIoCtxCompleted; 3144 3200 3145 3201 *ppDisk = pDisk;
Note:
See TracChangeset
for help on using the changeset viewer.