VirtualBox

Changeset 28884 in vbox


Ignore:
Timestamp:
Apr 29, 2010 9:16:26 AM (15 years ago)
Author:
vboxsync
Message:

AsyncCompletion: Restart incomplete transfers to get the exact error code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMAsyncCompletionFileNormal.cpp

    r28800 r28884  
    12901290    else
    12911291    {
    1292         AssertMsg(   RT_FAILURE(rcReq)
    1293                   || (   (cbTransfered == pTask->DataSeg.cbSeg)
    1294                       || (pTask->cbBounceBuffer && cbTransfered >= pTask->DataSeg.cbSeg)),
    1295                   ("Task didn't completed successfully (rc=%Rrc) or was incomplete (cbTransfered=%u)\n", rcReq, cbTransfered));
    1296 
    1297         if (pTask->fPrefetch)
     1292        /*
     1293         * Restart an incomplete transfer.
     1294         * This usually means that the request will return an error now
     1295         * but to get the cause of the error (disk full, file too big, I/O error, ...)
     1296         * the transfer needs to be continued.
     1297         */
     1298        if (RT_UNLIKELY(   cbTransfered < pTask->DataSeg.cbSeg
     1299                        || (   pTask->cbBounceBuffer
     1300                            && cbTransfered < pTask->cbBounceBuffer)))
     1301        {
     1302            RTFOFF offStart;
     1303            size_t cbToTransfer;
     1304            uint8_t *pbBuf = NULL;
     1305
     1306            LogFlow(("Restarting incomplete transfer %#p (%zu bytes transfered)\n",
     1307                     pTask, cbTransfered));
     1308            Assert(cbTransfered % 512 == 0);
     1309
     1310            if (pTask->cbBounceBuffer)
     1311            {
     1312                AssertPtr(pTask->pvBounceBuffer);
     1313                offStart     = (pTask->Off & ~((RTFOFF)512-1)) + cbTransfered;
     1314                cbToTransfer = pTask->cbBounceBuffer - cbTransfered;
     1315                pbBuf        = (uint8_t *)pTask->pvBounceBuffer + cbTransfered;
     1316            }
     1317            else
     1318            {
     1319                Assert(!pTask->pvBounceBuffer);
     1320                offStart     = pTask->Off + cbTransfered;
     1321                cbToTransfer = pTask->DataSeg.cbSeg - cbTransfered;
     1322                pbBuf        = (uint8_t *)pTask->DataSeg.pvSeg + cbTransfered;
     1323            }
     1324
     1325            if (pTask->fPrefetch || pTask->enmTransferType == PDMACTASKFILETRANSFER_READ)
     1326            {
     1327                rc = RTFileAioReqPrepareRead(hReq, pEndpoint->File, offStart,
     1328                                             pbBuf, cbToTransfer, pTask);
     1329            }
     1330            else
     1331            {
     1332                AssertMsg(pTask->enmTransferType == PDMACTASKFILETRANSFER_WRITE,
     1333                          ("Invalid transfer type\n"));
     1334                rc = RTFileAioReqPrepareWrite(hReq, pEndpoint->File, offStart,
     1335                                              pbBuf, cbToTransfer, pTask);
     1336            }
     1337
     1338            AssertRC(rc);
     1339            rc = RTFileAioCtxSubmit(pAioMgr->hAioCtx, &hReq, 1);
     1340            AssertRC(rc);
     1341        }
     1342        else if (pTask->fPrefetch)
    12981343        {
    12991344            Assert(pTask->enmTransferType == PDMACTASKFILETRANSFER_WRITE);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette