VirtualBox

Changeset 24104 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Oct 27, 2009 12:15:45 AM (15 years ago)
Author:
vboxsync
Message:

DrvSCSI: Need to synchronize all pending requests before any driver below us gets the PowerOff or Suspend notification. DrvVD will change the image to read-only mode.

File:
1 edited

Legend:

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

    r24101 r24104  
    803803
    804804/**
    805  * @copydoc FNPDMDRVRESET
    806  */
    807 static DECLCALLBACK(void) drvscsiReset(PPDMDRVINS pDrvIns)
    808 {
    809     PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
    810     int rc;
    811 
     805 * Worker for drvscsiReset, drvscsiSuspend and drvscsiPowerOff.
     806 *
     807 * @param   pThis               The instance data.
     808 * @param   pszEvent            The notification event (for logging).
     809 */
     810static void drvscsiWaitForPendingRequests(PDRVSCSI pThis, const char *pszEvent)
     811{
    812812    /*
    813813     * Try make sure any pending I/O has completed now.
     
    817817        if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 20000 /*ms*/))
    818818        {
    819             LogRel(("drvscsiReset#%u: previous dummy request is still pending\n", pDrvIns->iInstance));
     819            LogRel(("drvscsi%s#%u: previous dummy request is still pending\n", pszEvent, pThis->pDrvIns->iInstance));
    820820            return;
    821821        }
     
    824824        {
    825825            PRTREQ pReq;
    826             rc = RTReqCall(pThis->pQueueRequests, &pReq, 20000 /*ms*/, (PFNRT)drvscsiAsyncIOLoopSyncCallback, 0);
     826            int rc = RTReqCall(pThis->pQueueRequests, &pReq, 20000 /*ms*/, (PFNRT)drvscsiAsyncIOLoopSyncCallback, 0);
    827827            if (RT_SUCCESS(rc))
    828828                RTReqFree(pReq);
     
    830830            {
    831831                pThis->pPendingDummyReq = pReq;
    832                 LogRel(("drvscsiReset#%u: %Rrc pReq=%p\n", pDrvIns->iInstance, rc, pReq));
     832                LogRel(("drvscsi%s#%u: %Rrc pReq=%p\n", pszEvent, pThis->pDrvIns->iInstance, rc, pReq));
    833833            }
    834834        }
     
    847847 *        wee bit...
    848848 */
     849}
     850
     851/**
     852 * @copydoc FNPDMDRVPOWEROFF
     853 */
     854static DECLCALLBACK(void) drvscsiPowerOff(PPDMDRVINS pDrvIns)
     855{
     856    PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
     857    drvscsiWaitForPendingRequests(pThis, "PowerOff");
     858}
     859
     860/**
     861 * @copydoc FNPDMDRVSUSPEND
     862 */
     863static DECLCALLBACK(void) drvscsiSuspend(PPDMDRVINS pDrvIns)
     864{
     865    PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
     866    drvscsiWaitForPendingRequests(pThis, "Suspend");
     867}
     868
     869/**
     870 * @copydoc FNPDMDRVRESET
     871 */
     872static DECLCALLBACK(void) drvscsiReset(PPDMDRVINS pDrvIns)
     873{
     874    PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI);
     875    drvscsiWaitForPendingRequests(pThis, "Reset");
    849876}
    850877
     
    9901017    drvscsiReset,
    9911018    /* pfnSuspend */
    992     NULL,
     1019    drvscsiSuspend,
    9931020    /* pfnResume */
    9941021    NULL,
     
    9981025    NULL,
    9991026    /* pfnPowerOff */
    1000     NULL,
     1027    drvscsiPowerOff,
    10011028    /* pfnSoftReset */
    10021029    NULL,
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