儲存庫 vbox 的更動 65888
- 時間撮記:
- 2017-2-27 下午02:58:49 (8 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r65849 r65888 3306 3306 if ( ( pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ 3307 3307 || pIoReq->enmType == PDMMEDIAEXIOREQTYPE_WRITE) 3308 && !pIoReq->ReadWrite.fDirectBuf) 3308 && !pIoReq->ReadWrite.fDirectBuf 3309 && pIoReq->ReadWrite.cbIoBuf > 0) 3309 3310 { 3310 3311 IOBUFMgrFreeBuf(&pIoReq->ReadWrite.IoBuf); … … 3314 3315 { 3315 3316 RTLISTANCHOR LstIoReqProcess; 3317 RTLISTANCHOR LstIoReqCanceled; 3316 3318 RTListInit(&LstIoReqProcess); 3319 RTListInit(&LstIoReqCanceled); 3317 3320 3318 3321 /* Try to process as many requests as possible. */ … … 3338 3341 pIoReqCur->ReadWrite.pSgBuf = &pIoReqCur->ReadWrite.IoBuf.SgBuf; 3339 3342 3340 RTListAppend(&LstIoReqProcess, &pIoReqCur->NdLstWait); 3343 bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pIoReqCur->enmState, 3344 VDIOREQSTATE_ACTIVE, VDIOREQSTATE_ALLOCATED); 3345 if (RT_UNLIKELY(!fXchg)) 3346 { 3347 /* Must have been canceled inbetween. */ 3348 Assert(pIoReqCur->enmState == VDIOREQSTATE_CANCELED); 3349 3350 /* Free the buffer here already again to let other requests get a chance to allocate the memory. */ 3351 IOBUFMgrFreeBuf(&pIoReq->ReadWrite.IoBuf); 3352 pIoReqCur->ReadWrite.cbIoBuf = 0; 3353 RTListAppend(&LstIoReqCanceled, &pIoReqCur->NdLstWait); 3354 } 3355 else 3356 { 3357 ASMAtomicIncU32(&pThis->cIoReqsActive); 3358 RTListAppend(&LstIoReqProcess, &pIoReqCur->NdLstWait); 3359 } 3341 3360 } 3342 3361 else … … 3350 3369 ASMAtomicAddU32(&pThis->cIoReqsWaiting, cIoReqsWaiting); 3351 3370 3352 /* Process the requests we could allocate memory for outside the lock now. */ 3371 /* Process the requests we could allocate memory for and the ones which got canceled outside the lock now. */ 3372 RTListForEachSafe(&LstIoReqCanceled, pIoReqCur, pIoReqNext, PDMMEDIAEXIOREQINT, NdLstWait) 3373 { 3374 RTListNodeRemove(&pIoReqCur->NdLstWait); 3375 drvvdMediaExIoReqCompleteWorker(pThis, pIoReqCur, VERR_PDM_MEDIAEX_IOREQ_CANCELED, true /* fUpNotify */); 3376 } 3377 3353 3378 RTListForEachSafe(&LstIoReqProcess, pIoReqCur, pIoReqNext, PDMMEDIAEXIOREQINT, NdLstWait) 3354 3379 { 3355 3380 RTListNodeRemove(&pIoReqCur->NdLstWait); 3356 3357 bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pIoReqCur->enmState, VDIOREQSTATE_ACTIVE, VDIOREQSTATE_ALLOCATED);3358 if (RT_UNLIKELY(!fXchg))3359 {3360 /* Must have been canceled inbetween. */3361 Assert(pIoReqCur->enmState == VDIOREQSTATE_CANCELED);3362 drvvdMediaExIoReqCompleteWorker(pThis, pIoReqCur, VERR_PDM_MEDIAEX_IOREQ_CANCELED, true /* fUpNotify */);3363 }3364 ASMAtomicIncU32(&pThis->cIoReqsActive);3365 3381 drvvdMediaExIoReqReadWriteProcess(pThis, pIoReqCur, true /* fUpNotify */); 3366 3382 }
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器