VirtualBox

儲存庫 vbox 的更動 65346


忽略:
時間撮記:
2017-1-17 上午09:37:04 (8 年 以前)
作者:
vboxsync
訊息:

Devices/Storage/DrvVD: Log the request states when cancelling them

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r64838 r65346  
    33683368
    33693369/**
     3370 * Returns a string description of the given request state.
     3371 *
     3372 * @returns Pointer to the stringified state.
     3373 * @param   enmState  The state.
     3374 */
     3375DECLINLINE(const char *) drvvdMediaExIoReqStateStringify(VDIOREQSTATE enmState)
     3376{
     3377#define STATE2STR(a_State) case VDIOREQSTATE_##a_State: return #a_State
     3378    switch (enmState)
     3379    {
     3380        STATE2STR(INVALID);
     3381        STATE2STR(FREE);
     3382        STATE2STR(ALLOCATED);
     3383        STATE2STR(ACTIVE);
     3384        STATE2STR(SUSPENDED);
     3385        STATE2STR(COMPLETING);
     3386        STATE2STR(COMPLETED);
     3387        STATE2STR(CANCELED);
     3388        default:
     3389            AssertMsgFailed(("Unknown state %u\n", enmState));
     3390            return "UNKNOWN";
     3391    }
     3392#undef STATE2STR
     3393}
     3394
     3395
     3396/**
     3397 * Returns a string description of the given request type.
     3398 *
     3399 * @returns Pointer to the stringified type.
     3400 * @param   enmType  The request type.
     3401 */
     3402DECLINLINE(const char *) drvvdMediaExIoReqTypeStringify(PDMMEDIAEXIOREQTYPE enmType)
     3403{
     3404#define TYPE2STR(a_Type) case PDMMEDIAEXIOREQTYPE_##a_Type: return #a_Type
     3405    switch (enmType)
     3406    {
     3407        TYPE2STR(INVALID);
     3408        TYPE2STR(FLUSH);
     3409        TYPE2STR(WRITE);
     3410        TYPE2STR(READ);
     3411        TYPE2STR(DISCARD);
     3412        TYPE2STR(SCSI);
     3413        default:
     3414            AssertMsgFailed(("Unknown type %u\n", enmType));
     3415            return "UNKNOWN";
     3416    }
     3417#undef TYPE2STR
     3418}
     3419
     3420
     3421/**
     3422 * Dumps the interesting bits about the given I/O request to the release log.
     3423 *
     3424 * @returns nothing.
     3425 * @param   pThis     VBox disk container instance data.
     3426 * @param   pIoReq    The I/O request to dump.
     3427 */
     3428static void drvvdMediaExIoReqLogRel(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq)
     3429{
     3430    uint64_t offStart = 0;
     3431    size_t cbReq = 0;
     3432    size_t cbLeft = 0;
     3433    size_t cbBufSize = 0;
     3434    uint64_t tsActive = RTTimeMilliTS() - pIoReq->tsSubmit;
     3435
     3436    if (   pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ
     3437        || pIoReq->enmType == PDMMEDIAEXIOREQTYPE_WRITE)
     3438    {
     3439        offStart = pIoReq->ReadWrite.offStart;
     3440        cbReq = pIoReq->ReadWrite.cbReq;
     3441        cbLeft = pIoReq->ReadWrite.cbReqLeft;
     3442        cbBufSize = pIoReq->ReadWrite.cbIoBuf;
     3443    }
     3444
     3445    LogRel(("VD#%u: Request{%#p}:\n"
     3446            "    Type=%s State=%s Id=%#llx SubmitTs=%llu {%llu} Flags=%#x\n"
     3447            "    Offset=%llu Size=%zu Left=%zu BufSize=%zu\n",
     3448            pThis->pDrvIns->iInstance, pIoReq,
     3449            drvvdMediaExIoReqTypeStringify(pIoReq->enmType),
     3450            drvvdMediaExIoReqStateStringify(pIoReq->enmState),
     3451            pIoReq->uIoReqId, pIoReq->tsSubmit, tsActive, pIoReq->fFlags,
     3452            offStart, cbReq, cbLeft, cbBufSize));
     3453}
     3454
     3455
     3456/**
    33703457 * Returns whether the VM is in a running state.
    33713458 *
     
    34163503    VDIOREQSTATE enmStateOld = (VDIOREQSTATE)ASMAtomicReadU32((volatile uint32_t *)&pIoReq->enmState);
    34173504
     3505    drvvdMediaExIoReqLogRel(pThis, pIoReq);
     3506
    34183507    /*
    34193508     * We might have to try canceling the request multiple times if it transitioned from
     
    35893678    PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx);
    35903679
     3680    LogRel(("VD#%u: Cancelling all active requests\n", pThis->pDrvIns->iInstance));
     3681
    35913682    for (unsigned idxBin = 0; idxBin < RT_ELEMENTS(pThis->aIoReqAllocBins); idxBin++)
    35923683    {
     
    36153706    PVBOXDISK pThis = RT_FROM_MEMBER(pInterface, VBOXDISK, IMediaEx);
    36163707    unsigned idxBin = drvvdMediaExIoReqIdHash(uIoReqId);
     3708
     3709    LogRel(("VD#%u: Trying to cancel request %#llx\n", pThis->pDrvIns->iInstance, uIoReqId));
    36173710
    36183711    int rc = RTSemFastMutexRequest(pThis->aIoReqAllocBins[idxBin].hMtxLstIoReqAlloc);
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette