Changeset 64029 in vbox
- Timestamp:
- Sep 26, 2016 9:22:02 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r64025 r64029 2708 2708 static void drvvdMediaExIoReqRetire(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq, int rcReq, bool fUpNotify) 2709 2709 { 2710 int rc; 2710 LogFlowFunc(("pThis=%#p pIoReq=%#p rcReq=%Rrc fUpNotify=%RTbool\n", 2711 pThis, pIoReq, rcReq, fUpNotify)); 2712 2711 2713 bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pIoReq->enmState, VDIOREQSTATE_COMPLETING, VDIOREQSTATE_ACTIVE); 2712 2714 if (fXchg) … … 2719 2721 2720 2722 ASMAtomicXchgU32((volatile uint32_t *)&pIoReq->enmState, VDIOREQSTATE_COMPLETED); 2721 drvvdMediaExIoReqBufFree(pThis, pIoReq);2723 //drvvdMediaExIoReqBufFree(pThis, pIoReq); 2722 2724 2723 2725 /* … … 2794 2796 if (fUpNotify) 2795 2797 { 2796 rc = pThis->pDrvMediaExPort->pfnIoReqCompleteNotify(pThis->pDrvMediaExPort,2797 pIoReq, &pIoReq->abAlloc[0], rcReq);2798 int rc = pThis->pDrvMediaExPort->pfnIoReqCompleteNotify(pThis->pDrvMediaExPort, 2799 pIoReq, &pIoReq->abAlloc[0], rcReq); 2798 2800 AssertRC(rc); 2799 2801 } 2802 2803 LogFlowFunc(("returns\n")); 2800 2804 } 2801 2805 … … 2811 2815 static int drvvdMediaExIoReqCompleteWorker(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq, int rcReq, bool fUpNotify) 2812 2816 { 2817 LogFlowFunc(("pThis=%#p pIoReq=%#p rcReq=%Rrc fUpNotify=%RTbool\n", 2818 pThis, pIoReq, rcReq, fUpNotify)); 2819 2813 2820 /* 2814 2821 * For a read we need to sync the memory before continuing to process … … 2865 2872 } 2866 2873 2874 LogFlowFunc(("returns %Rrc\n", rcReq)); 2867 2875 return rcReq; 2868 2876 } … … 2881 2889 DECLINLINE(int) drvvdMediaExIoReqBufAlloc(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq, size_t cb) 2882 2890 { 2891 LogFlowFunc(("pThis=%#p pIoReq=%#p cb=%zu\n", pThis, pIoReq, cb)); 2892 2883 2893 int rc = IOBUFMgrAllocBuf(pThis->hIoBufMgr, &pIoReq->ReadWrite.IoBuf, cb, &pIoReq->ReadWrite.cbIoBuf); 2884 2894 if (rc == VERR_NO_MEMORY) 2885 2895 { 2896 LogFlowFunc(("Could not allocate memory for request, deferring\n")); 2886 2897 RTCritSectEnter(&pThis->CritSectIoReqsIoBufWait); 2887 2898 RTListAppend(&pThis->LstIoReqIoBufWait, &pIoReq->NdLstWait); … … 2891 2902 } 2892 2903 else 2904 { 2905 LogFlowFunc(("Allocated %zu bytes of memory\n", pIoReq->ReadWrite.cbIoBuf)); 2893 2906 Assert(pIoReq->ReadWrite.cbIoBuf > 0); 2894 2907 } 2908 2909 LogFlowFunc(("returns %Rrc\n", rc)); 2895 2910 return rc; 2896 2911 } … … 2909 2924 int rc = VINF_SUCCESS; 2910 2925 2926 LogFlowFunc(("pThis=%#p pIoReq=%#p cbReqIo=%zu pcbReqIo=%#p\n", pThis, pIoReq, cbReqIo, pcbReqIo)); 2927 2911 2928 Assert(cbReqIo > 0); 2912 2929 … … 2939 2956 *pcbReqIo = cbReqIo; 2940 2957 2958 LogFlowFunc(("returns %Rrc *pcbReqIo=%zu\n", rc, *pcbReqIo)); 2941 2959 return rc; 2942 2960 } … … 2957 2975 Assert(cbReqIo > 0); 2958 2976 2977 LogFlowFunc(("pThis=%#p pIoReq=%#p cbReqIo=%zu pcbReqIo=%#p\n", pThis, pIoReq, cbReqIo, pcbReqIo)); 2978 2959 2979 if ( pThis->fAsyncIOSupported 2960 2980 && !(pIoReq->fFlags & PDMIMEDIAEX_F_SYNC)) … … 2985 3005 *pcbReqIo = cbReqIo; 2986 3006 3007 LogFlowFunc(("returns %Rrc *pcbReqIo=%zu\n", rc, *pcbReqIo)); 2987 3008 return rc; 2988 3009 } … … 2999 3020 int rc = VINF_SUCCESS; 3000 3021 3022 LogFlowFunc(("pThis=%#p pIoReq=%#p\n", pThis, pIoReq)); 3023 3001 3024 if ( pThis->fAsyncIOSupported 3002 3025 && !(pIoReq->fFlags & PDMIMEDIAEX_F_SYNC)) … … 3020 3043 } 3021 3044 3045 LogFlowFunc(("returns %Rrc\n", rc)); 3022 3046 return rc; 3023 3047 } … … 3034 3058 int rc = VINF_SUCCESS; 3035 3059 3060 LogFlowFunc(("pThis=%#p pIoReq=%#p\n", pThis, pIoReq)); 3061 3036 3062 if ( pThis->fAsyncIOSupported 3037 3063 && !(pIoReq->fFlags & PDMIMEDIAEX_F_SYNC)) … … 3056 3082 } 3057 3083 3084 LogFlowFunc(("returns %Rrc\n", rc)); 3058 3085 return rc; 3059 3086 } … … 3071 3098 int rc = VINF_SUCCESS; 3072 3099 3100 LogFlowFunc(("pThis=%#p pIoReq=%#p fUpNotify=%RTbool\n", pThis, pIoReq, fUpNotify)); 3101 3073 3102 Assert(pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ || pIoReq->enmType == PDMMEDIAEXIOREQTYPE_WRITE); 3074 3103 … … 3111 3140 } 3112 3141 3142 LogFlowFunc(("returns %Rrc\n", rc)); 3113 3143 return rc; 3114 3144 } … … 3124 3154 DECLINLINE(void) drvvdMediaExIoReqBufFree(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq) 3125 3155 { 3156 LogFlowFunc(("pThis=%#p pIoReq=%#p{.cbIoBuf=%zu}\n", pThis, pIoReq, pIoReq->ReadWrite.cbIoBuf)); 3157 3126 3158 if ( pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ 3127 3159 || pIoReq->enmType == PDMMEDIAEXIOREQTYPE_WRITE) … … 3129 3161 IOBUFMgrFreeBuf(&pIoReq->ReadWrite.IoBuf); 3130 3162 3131 if (ASMAtomicReadU32(&pThis->cIoReqsWaiting) > 0) 3163 uint32_t cIoReqsWaiting = ASMAtomicXchgU32(&pThis->cIoReqsWaiting, 0); 3164 if (cIoReqsWaiting > 0) 3132 3165 { 3133 3166 /* Try to process as many requests as possible. */ … … 3137 3170 RTListForEachSafe(&pThis->LstIoReqIoBufWait, pIoReqCur, pIoReqNext, PDMMEDIAEXIOREQINT, NdLstWait) 3138 3171 { 3172 LogFlowFunc(("Found I/O request %#p on waiting list, trying to allocate buffer of size %zu bytes\n", 3173 pIoReqCur, pIoReqCur->ReadWrite.cbReq)); 3174 3139 3175 /* Allocate a suitable I/O buffer for this request. */ 3140 3176 int rc = IOBUFMgrAllocBuf(pThis->hIoBufMgr, &pIoReqCur->ReadWrite.IoBuf, pIoReqCur->ReadWrite.cbReq, … … 3144 3180 Assert(pIoReq->ReadWrite.cbIoBuf > 0); 3145 3181 3146 ASMAtomicDecU32(&pThis->cIoReqsWaiting);3182 cIoReqsWaiting--; 3147 3183 RTListNodeRemove(&pIoReqCur->NdLstWait); 3148 3184 … … 3164 3200 } 3165 3201 RTCritSectLeave(&pThis->CritSectIoReqsIoBufWait); 3166 } 3167 } 3202 3203 ASMAtomicAddU32(&pThis->cIoReqsWaiting, cIoReqsWaiting); 3204 } 3205 } 3206 3207 LogFlowFunc(("returns\n")); 3168 3208 } 3169 3209
Note:
See TracChangeset
for help on using the changeset viewer.