Changeset 12474 in vbox for trunk/src/VBox/Devices/Storage/DrvVD.cpp
- Timestamp:
- Sep 15, 2008 7:02:54 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r12467 r12474 564 564 pThis->fTempReadOnly = false; 565 565 pThis->pDisk = NULL; 566 pThis->fAsyncIOSupported = false; 566 567 567 568 /* IMedia */ … … 642 643 { 643 644 /* 644 * Though the device supports async I/O the backend seems to not support it. 645 * Though the device supports async I/O there is no transport driver 646 * which processes async requests. 645 647 * Revert to non async I/O. 646 648 */ 649 rc = VINF_SUCCESS; 647 650 pThis->pDrvMediaAsyncPort = NULL; 651 pThis->fAsyncIOSupported = false; 648 652 } 649 653 else if (RT_FAILURE(rc)) … … 653 657 else 654 658 { 659 /* 660 * The device supports async I/O and we successfully attached the transport driver. 661 * Indicate that async I/O is supported for now as we check if the image backend supports 662 * it later. 663 */ 664 pThis->fAsyncIOSupported = true; 665 655 666 /* Success query the async transport interface. */ 656 667 pThis->pDrvTransportAsync = (PPDMITRANSPORTASYNC)pBase->pfnQueryInterface(pBase, PDMINTERFACE_TRANSPORT_ASYNC); 657 668 if (!pThis->pDrvTransportAsync) 658 669 { 659 /* Whoops. */670 /* An attached driver without an async transport interface - impossible. */ 660 671 AssertMsgFailed(("Configuration error: No async transport interface below!\n")); 661 672 return VERR_PDM_MISSING_INTERFACE_ABOVE; … … 670 681 unsigned iLevel = 0; 671 682 PCFGMNODE pCurNode = pCfgHandle; 672 rc = VINF_SUCCESS; 683 673 684 for (;;) 674 685 { … … 695 706 break; 696 707 } 697 698 708 699 709 PCFGMNODE pParent = CFGMR3GetChild(pCurNode, "Parent"); … … 833 843 return rc; 834 844 } 835 836 /* 837 * Check for async I/O support. Every opened image has to support 838 * it. 839 */ 840 pThis->fAsyncIOSupported = true; 841 for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++) 842 { 843 VDBACKENDINFO vdBackendInfo; 844 845 rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo); 846 AssertRC(rc); 847 848 if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC) 849 { 850 /* 851 * Backend indicates support for at least some files. 852 * Check if current file is supported with async I/O) 853 */ 854 rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported); 855 AssertRC(rc); 856 857 /* 858 * Check if current image is supported. 859 * If not we can stop checking because 860 * at least one does not support it. 861 */ 862 if (!pThis->fAsyncIOSupported) 863 break; 864 } 865 else 866 { 867 pThis->fAsyncIOSupported = false; 868 break; 869 } 870 } 871 872 /* Create cache if async I/O is supported. */ 873 if (pThis->fAsyncIOSupported) 874 { 875 rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT); 876 AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Rrc\n", rc)); 845 else 846 { 847 /* 848 * Check if every opened image supports async I/O. 849 * If not we revert to non async I/O. 850 */ 851 if (pThis->fAsyncIOSupported) 852 { 853 for (unsigned i = 0; i < VDGetCount(pThis->pDisk); i++) 854 { 855 VDBACKENDINFO vdBackendInfo; 856 857 rc = VDBackendInfoSingle(pThis->pDisk, i, &vdBackendInfo); 858 AssertRC(rc); 859 860 if (vdBackendInfo.uBackendCaps & VD_CAP_ASYNC) 861 { 862 /* 863 * Backend indicates support for at least some files. 864 * Check if current file is supported with async I/O) 865 */ 866 rc = VDImageIsAsyncIOSupported(pThis->pDisk, i, &pThis->fAsyncIOSupported); 867 AssertRC(rc); 868 869 /* 870 * Check if current image is supported. 871 * If not we can stop checking because 872 * at least one does not support it. 873 */ 874 if (!pThis->fAsyncIOSupported) 875 break; 876 } 877 else 878 { 879 pThis->fAsyncIOSupported = false; 880 break; 881 } 882 } 883 } 884 885 /* 886 * We know definitly if async I/O is supported now. 887 * Create cache if it is supported. 888 */ 889 if (pThis->fAsyncIOSupported) 890 { 891 rc = RTCacheCreate(&pThis->pCache, 0, sizeof(DRVVDASYNCTASK), RTOBJCACHE_PROTECT_INSERT); 892 AssertMsg(RT_SUCCESS(rc), ("Failed to create cache rc=%Rrc\n", rc)); 893 } 877 894 } 878 895
Note:
See TracChangeset
for help on using the changeset viewer.