VirtualBox

Changeset 31573 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 11, 2010 2:42:11 PM (14 years ago)
Author:
vboxsync
Message:

VBoxHDD: Update the transfer counter in the I/O interface at the correct position (Fix hangs after r64583)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r31504 r31573  
    973973        }
    974974
    975         if (RT_SUCCESS(rc))
    976         {
    977             ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbThisRead);
    978         }
    979         else if (rc == VERR_VD_BLOCK_FREE)
     975        /* The task state will be updated on success already, don't do it here!. */
     976        if (rc == VERR_VD_BLOCK_FREE)
    980977        {
    981978            /* No image in the chain contains the data for the block. */
     
    27582755    PVDIMAGE pImage = (PVDIMAGE)pvUser;
    27592756    PVBOXHDD pDisk  = pImage->pDisk;
     2757    size_t cbCopied = 0;
    27602758
    27612759    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    27622760
    2763     return vdIoCtxCopyTo(pIoCtx, (uint8_t *)pvBuf, cbBuf);
     2761    cbCopied = vdIoCtxCopyTo(pIoCtx, (uint8_t *)pvBuf, cbBuf);
     2762    Assert(cbCopied == cbBuf);
     2763
     2764    ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbCopied);
     2765
     2766    return cbCopied;
    27642767}
    27652768
     
    27692772    PVDIMAGE pImage = (PVDIMAGE)pvUser;
    27702773    PVBOXHDD pDisk  = pImage->pDisk;
     2774    size_t cbCopied = 0;
    27712775
    27722776    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    27732777
    2774     return vdIoCtxCopyFrom(pIoCtx, (uint8_t *)pvBuf, cbBuf);
     2778    cbCopied = vdIoCtxCopyFrom(pIoCtx, (uint8_t *)pvBuf, cbBuf);
     2779    Assert(cbCopied == cbBuf);
     2780
     2781    ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbCopied);
     2782
     2783    return cbCopied;
    27752784}
    27762785
     
    27802789    PVDIMAGE pImage = (PVDIMAGE)pvUser;
    27812790    PVBOXHDD pDisk  = pImage->pDisk;
     2791    size_t cbSet = 0;
    27822792
    27832793    VD_THREAD_IS_CRITSECT_OWNER(pDisk);
    27842794
    2785     return vdIoCtxSet(pIoCtx, ch, cb);
     2795    cbSet = vdIoCtxSet(pIoCtx, ch, cb);
     2796    Assert(cbSet == cb);
     2797
     2798    ASMAtomicSubU32(&pIoCtx->cbTransferLeft, cbSet);
     2799
     2800    return cbSet;
    27862801}
    27872802
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