Changeset 29330 in vbox for trunk/src/VBox/Devices
- Timestamp:
- May 11, 2010 10:21:06 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvSCSI.cpp
r29250 r29330 335 335 PDRVSCSI pThis = (PDRVSCSI)pVScsiDeviceUser; 336 336 337 ASMAtomicDecU32(&pThis->StatIoDepth); 338 337 339 pThis->pDevScsiPort->pfnSCSIRequestCompleted(pThis->pDevScsiPort, (PPDMSCSIREQUEST)pVScsiReqUser, 338 340 rcReq); 341 342 if (RT_UNLIKELY(pThis->fDummySignal) && !pThis->StatIoDepth) 343 PDMDrvHlpAsyncNotificationCompleted(pThis->pDrvIns); 339 344 } 340 345 … … 492 497 PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); 493 498 494 if (!pThis->pQueueRequests) 499 if (!pThis->pDrvBlockAsync) 500 { 501 if (!pThis->pQueueRequests) 502 return; 503 504 ASMAtomicWriteBool(&pThis->fDummySignal, true); 505 if (drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 506 { 507 if (!RTReqIsBusy(pThis->pQueueRequests)) 508 { 509 ASMAtomicWriteBool(&pThis->fDummySignal, false); 510 return; 511 } 512 513 PRTREQ pReq; 514 int rc = RTReqCall(pThis->pQueueRequests, &pReq, 0 /*ms*/, (PFNRT)drvscsiAsyncIOLoopSyncCallback, 1, pThis); 515 if (RT_SUCCESS(rc)) 516 { 517 ASMAtomicWriteBool(&pThis->fDummySignal, false); 518 RTReqFree(pReq); 519 return; 520 } 521 522 pThis->pPendingDummyReq = pReq; 523 } 524 } 525 else 526 { 527 if (pThis->StatIoDepth > 0) 528 { 529 ASMAtomicWriteBool(&pThis->fDummySignal, true); 530 } 495 531 return; 496 497 ASMAtomicWriteBool(&pThis->fDummySignal, true); 498 if (drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 499 { 500 if (!RTReqIsBusy(pThis->pQueueRequests)) 501 { 502 ASMAtomicWriteBool(&pThis->fDummySignal, false); 503 return; 504 } 505 506 PRTREQ pReq; 507 int rc = RTReqCall(pThis->pQueueRequests, &pReq, 0 /*ms*/, (PFNRT)drvscsiAsyncIOLoopSyncCallback, 1, pThis); 508 if (RT_SUCCESS(rc)) 509 { 510 ASMAtomicWriteBool(&pThis->fDummySignal, false); 511 RTReqFree(pReq); 512 return; 513 } 514 515 pThis->pPendingDummyReq = pReq; 516 } 532 } 533 517 534 PDMDrvHlpSetAsyncNotification(pDrvIns, pfnAsyncNotify); 518 535 } … … 528 545 PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); 529 546 530 if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 531 return false; 532 ASMAtomicWriteBool(&pThis->fDummySignal, false); 533 PDMR3ThreadSuspend(pThis->pAsyncIOThread); 534 return true; 547 if (pThis->pDrvBlockAsync) 548 { 549 if (pThis->StatIoDepth > 0) 550 return false; 551 else 552 return true; 553 } 554 else 555 { 556 if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 557 return false; 558 ASMAtomicWriteBool(&pThis->fDummySignal, false); 559 PDMR3ThreadSuspend(pThis->pAsyncIOThread); 560 return true; 561 } 535 562 } 536 563 … … 561 588 PDRVSCSI pThis = PDMINS_2_DATA(pDrvIns, PDRVSCSI); 562 589 563 if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 564 return false; 565 ASMAtomicWriteBool(&pThis->fDummySignal, false); 566 return true; 590 if (pThis->pDrvBlockAsync) 591 { 592 if (pThis->StatIoDepth > 0) 593 return false; 594 else 595 return true; 596 } 597 else 598 { 599 if (!drvscsiAsyncIOLoopNoPendingDummy(pThis, 0 /*ms*/)) 600 return false; 601 ASMAtomicWriteBool(&pThis->fDummySignal, false); 602 return true; 603 } 567 604 } 568 605 … … 690 727 rc = VSCSIDeviceLunAttach(pThis->hVScsiDevice, pThis->hVScsiLun, 0); 691 728 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to attached the LUN to the SCSI device\n"), rc); 692 693 /* Create request queue. */694 rc = RTReqCreateQueue(&pThis->pQueueRequests);695 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc);696 729 697 730 /* Register statistics counter. */ … … 709 742 "Number of active tasks.", "/Devices/SCSI0/%d/IoDepth", pDrvIns->iInstance); 710 743 711 712 /* Create I/O thread. */ 713 rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pAsyncIOThread, pThis, drvscsiAsyncIOLoop, 714 drvscsiAsyncIOLoopWakeup, 0, RTTHREADTYPE_IO, "SCSI async IO"); 715 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create async I/O thread rc=%Rrc\n"), rc); 744 if (!pThis->pDrvBlockAsync) 745 { 746 /* Create request queue. */ 747 rc = RTReqCreateQueue(&pThis->pQueueRequests); 748 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create request queue rc=%Rrc\n"), rc); 749 /* Create I/O thread. */ 750 rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pAsyncIOThread, pThis, drvscsiAsyncIOLoop, 751 drvscsiAsyncIOLoopWakeup, 0, RTTHREADTYPE_IO, "SCSI async IO"); 752 AssertMsgReturn(RT_SUCCESS(rc), ("Failed to create async I/O thread rc=%Rrc\n"), rc); 753 } 716 754 717 755 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.