Changeset 48848 in vbox
- Timestamp:
- Oct 3, 2013 7:51:14 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/VBox/Storage/VD.cpp (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VD.cpp
r48743 r48848 827 827 pIoCtx->pDisk = pDisk; 828 828 pIoCtx->enmTxDir = enmTxDir; 829 pIoCtx->Req.Io.cbTransferLeft = cbTransfer;829 pIoCtx->Req.Io.cbTransferLeft = (uint32_t)cbTransfer; Assert((uint32_t)cbTransfer == cbTransfer); 830 830 pIoCtx->Req.Io.uOffset = uOffset; 831 831 pIoCtx->Req.Io.cbTransfer = cbTransfer; … … 984 984 size_t cbLeft = pBlock->cbDiscard; 985 985 bool fAllocated = ASMBitTest(pBlock->pbmAllocated, idxStart); 986 uint32_t cSectors = pBlock->cbDiscard / 512;986 uint32_t cSectors = (uint32_t)(pBlock->cbDiscard / 512); 987 987 988 988 while (cbLeft > 0) … … 1099 1099 1100 1100 idxStart = (uOffset - pBlock->Core.Key) / 512; 1101 idxEnd = idxStart + ( cbThisRange / 512);1101 idxEnd = idxStart + (int32_t)(cbThisRange / 512); 1102 1102 ASMBitSetRange(pBlock->pbmAllocated, idxStart, idxEnd); 1103 1103 } … … 1292 1292 RTSgBufReset(&pIoCtx->Req.Io.SgBuf); 1293 1293 pIoCtx->Req.Io.uOffset = pIoCtx->Type.Child.uOffsetSaved; 1294 pIoCtx->Req.Io.cbTransferLeft = pIoCtx->Type.Child.cbTransferLeftSaved; 1294 pIoCtx->Req.Io.cbTransferLeft = (uint32_t)pIoCtx->Type.Child.cbTransferLeftSaved; 1295 Assert((uint32_t)pIoCtx->Type.Child.cbTransferLeftSaved == pIoCtx->Type.Child.cbTransferLeftSaved); 1295 1296 } 1296 1297 … … 1829 1830 { 1830 1831 /* No image in the chain contains the data for the block. */ 1831 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbThisRead);1832 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbThisRead); Assert(cbThisRead == (uint32_t)cbThisRead); 1832 1833 1833 1834 /* Fill the free space with 0 if we are told to do so … … 2464 2465 /* Read the entire data of the block so that we can compare whether it will 2465 2466 * be modified by the write or not. */ 2466 pIoCtx->Req.Io.cbTransferLeft = cbPreRead + cbThisWrite + cbPostRead - cbFill; 2467 size_t cbTmp = cbPreRead + cbThisWrite + cbPostRead - cbFill; Assert(cbTmp == (uint32_t)cbTmp); 2468 pIoCtx->Req.Io.cbTransferLeft = (uint32_t)cbTmp; 2467 2469 pIoCtx->Req.Io.cbTransfer = pIoCtx->Req.Io.cbTransferLeft; 2468 2470 pIoCtx->Req.Io.uOffset -= cbPreRead; … … 2598 2600 2599 2601 /* Read the data that goes before the write to fill the block. */ 2600 pIoCtx->Req.Io.cbTransferLeft = cbPreRead;2602 pIoCtx->Req.Io.cbTransferLeft = (uint32_t)cbPreRead; Assert(cbPreRead == (uint32_t)cbPreRead); 2601 2603 pIoCtx->Req.Io.cbTransfer = pIoCtx->Req.Io.cbTransferLeft; 2602 2604 pIoCtx->Req.Io.uOffset -= cbPreRead; … … 2704 2706 LogFlow(("Child write request completed\n")); 2705 2707 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbThisWrite); 2706 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbThisWrite); 2708 Assert(cbThisWrite == (uint32_t)cbThisWrite); 2709 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbThisWrite); 2707 2710 vdIoCtxUnlockDisk(pDisk, pIoCtx, false /* fProcessDeferredReqs*/ ); 2708 2711 vdIoCtxFree(pDisk, pIoCtxWrite); … … 2874 2877 size_t cbLeft = pBlock->cbDiscard; 2875 2878 bool fAllocated = ASMBitTest(pBlock->pbmAllocated, idxStart); 2876 uint32_t cSectors = pBlock->cbDiscard / 512;2879 uint32_t cSectors = (uint32_t)(pBlock->cbDiscard / 512); 2877 2880 2878 2881 while (cbLeft > 0) … … 3090 3093 3091 3094 idxStart = (offStart - pBlock->Core.Key) / 512; 3092 idxEnd = idxStart + ( cbThisDiscard / 512);3095 idxEnd = idxStart + (int32_t)(cbThisDiscard / 512); 3093 3096 3094 3097 ASMBitClearRange(pBlock->pbmAllocated, idxStart, idxEnd); … … 3098 3101 3099 3102 /* Call the backend to discard the block if it is completely unallocated now. */ 3100 if (ASMBitFirstSet((volatile void *)pBlock->pbmAllocated, pBlock->cbDiscard / 512) == -1)3103 if (ASMBitFirstSet((volatile void *)pBlock->pbmAllocated, (uint32_t)(pBlock->cbDiscard / 512)) == -1) 3101 3104 { 3102 3105 pIoCtx->Req.Discard.pBlock = pBlock; … … 3556 3559 /* Update the parent state. */ 3557 3560 Assert(pIoCtxParent->Req.Io.cbTransferLeft >= pIoCtx->Type.Child.cbTransferParent); 3558 ASMAtomicSubU32(&pIoCtxParent->Req.Io.cbTransferLeft, pIoCtx->Type.Child.cbTransferParent);3561 ASMAtomicSubU32(&pIoCtxParent->Req.Io.cbTransferLeft, (uint32_t)pIoCtx->Type.Child.cbTransferParent); 3559 3562 } 3560 3563 else … … 3635 3638 3636 3639 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbTransfer); 3637 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbTransfer);3640 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbTransfer); Assert(cbTransfer == (uint32_t)cbTransfer); 3638 3641 ASMAtomicDecU32(&pIoCtx->cDataTransfersPending); 3639 3642 … … 4047 4050 Seg.pvSeg, cbRead, NULL); 4048 4051 if (RT_SUCCESS(rc)) 4049 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbRead); 4052 { 4053 Assert(cbRead == (uint32_t)cbRead); 4054 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbRead); 4055 } 4050 4056 } 4051 4057 else … … 4056 4062 RTSGSEG aSeg[VD_IO_TASK_SEGMENTS_MAX]; 4057 4063 unsigned cSegments = VD_IO_TASK_SEGMENTS_MAX; 4058 size_t cbTaskRead = 0; 4059 4060 cbTaskRead = RTSgBufSegArrayCreate(&pIoCtx->Req.Io.SgBuf, aSeg, &cSegments, cbRead); 4064 size_t cbTaskRead = RTSgBufSegArrayCreate(&pIoCtx->Req.Io.SgBuf, aSeg, &cSegments, cbRead); 4061 4065 4062 4066 Assert(cSegments > 0); … … 4072 4076 #endif 4073 4077 4074 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pIoStorage, NULL, NULL, pIoCtx, cbTaskRead); 4078 Assert(cbTaskRead == (uint32_t)cbTaskRead); 4079 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pIoStorage, NULL, NULL, pIoCtx, (uint32_t)cbTaskRead); 4075 4080 4076 4081 if (!pIoTask) … … 4088 4093 { 4089 4094 AssertMsg(cbTaskRead <= pIoCtx->Req.Io.cbTransferLeft, ("Impossible!\n")); 4090 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbTaskRead);4095 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbTaskRead); 4091 4096 ASMAtomicDecU32(&pIoCtx->cDataTransfersPending); 4092 4097 vdIoTaskFree(pDisk, pIoTask); … … 4143 4148 Seg.pvSeg, cbWrite, NULL); 4144 4149 if (RT_SUCCESS(rc)) 4145 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbWrite); 4150 { 4151 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbWrite); 4152 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbWrite); 4153 } 4146 4154 } 4147 4155 else … … 4168 4176 #endif 4169 4177 4170 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pIoStorage, pfnComplete, pvCompleteUser, pIoCtx, cbTaskWrite); 4178 Assert(cbTaskWrite == (uint32_t)cbTaskWrite); 4179 PVDIOTASK pIoTask = vdIoTaskUserAlloc(pIoStorage, pfnComplete, pvCompleteUser, pIoCtx, (uint32_t)cbTaskWrite); 4171 4180 4172 4181 if (!pIoTask) … … 4184 4193 { 4185 4194 AssertMsg(cbTaskWrite <= pIoCtx->Req.Io.cbTransferLeft, ("Impossible!\n")); 4186 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbTaskWrite);4195 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbTaskWrite); 4187 4196 ASMAtomicDecU32(&pIoCtx->cDataTransfersPending); 4188 4197 vdIoTaskFree(pDisk, pIoTask); … … 4562 4571 Assert(cbCopied == cbBuf); 4563 4572 4564 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbCopied); 4573 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbCopied); 4574 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbCopied); 4565 4575 4566 4576 return cbCopied; … … 4581 4591 Assert(cbCopied == cbBuf); 4582 4592 4583 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbCopied); 4593 Assert(pIoCtx->Req.Io.cbTransferLeft > cbCopied); 4594 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbCopied); 4584 4595 4585 4596 return cbCopied; … … 4599 4610 Assert(cbSet == cb); 4600 4611 4601 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbSet); 4612 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbSet); 4613 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbSet); 4602 4614 4603 4615 return cbSet; … … 4641 4653 */ 4642 4654 ASMAtomicCmpXchgS32(&pIoCtx->rcReq, rcReq, VINF_SUCCESS); 4643 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, cbCompleted); 4655 Assert(pIoCtx->Req.Io.cbTransferLeft >= cbCompleted); 4656 ASMAtomicSubU32(&pIoCtx->Req.Io.cbTransferLeft, (uint32_t)cbCompleted); 4644 4657 4645 4658 /* Set next transfer function if the current one finished.
Note:
See TracChangeset
for help on using the changeset viewer.

