VirtualBox

Changeset 59305 in vbox


Ignore:
Timestamp:
Jan 10, 2016 8:38:50 PM (9 years ago)
Author:
vboxsync
Message:

Storage/NVMe: Convert emulation to use PDMIMEDIAEX instead of PDMIMEDIAASYNC

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r59299 r59305  
    14671467#define VERR_PDM_MEDIAEX_IOBUF_OVERFLOW             (-2894)
    14681468/** There is not enough data to satisfy the request. */
    1469 #define VERR_PDM_MEDIAEX_IOBUF_UNDERFLOW            (-2895)
     1469#define VERR_PDM_MEDIAEX_IOBUF_UNDERRUN             (-2895)
    14701470/** The I/O request ID is already existing. */
    14711471#define VERR_PDM_MEDIAEX_IOREQID_CONFLICT           (-2896)
  • trunk/include/VBox/vmm/pdmstorageifs.h

    r59291 r59305  
    571571typedef uint64_t PDMMEDIAEXIOREQID;
    572572
     573/**
     574 * I/O Request Type.
     575 */
     576typedef enum PDMMEDIAEXIOREQTYPE
     577{
     578    /** Invalid tpe. */
     579    PDMMEDIAEXIOREQTYPE_INVALID = 0,
     580    /** Flush request. */
     581    PDMMEDIAEXIOREQTYPE_FLUSH,
     582    /** Write request. */
     583    PDMMEDIAEXIOREQTYPE_WRITE,
     584    /** Read request. */
     585    PDMMEDIAEXIOREQTYPE_READ,
     586    /** Discard request. */
     587    PDMMEDIAEXIOREQTYPE_DISCARD
     588} PDMMEDIAEXIOREQTYPE;
     589
    573590/** @name I/O request specific flags
    574591 * @{ */
     
    623640     *
    624641     * @returns VBox status code.
    625      * @retval  VERR_PDM_MEDIAEX_IOBUF_UNDERFLOW if there is not enough data to copy from the buffer.
     642     * @retval  VERR_PDM_MEDIAEX_IOBUF_UNDERRUN if there is not enough data to copy from the buffer.
    626643     * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    627644     * @param   hIoReq          The I/O request handle.
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r59290 r59305  
    140140
    141141/**
    142  * VD I/O Request Type.
    143  */
    144 typedef enum VDIOREQTYPE
    145 {
    146     /** Invalid tpe. */
    147     VDIOREQTYPE_INVALID = 0,
    148     /** Flush request. */
    149     VDIOREQTYPE_FLUSH,
    150     /** Write request. */
    151     VDIOREQTYPE_WRITE,
    152     /** Read request. */
    153     VDIOREQTYPE_READ,
    154     /** Discard request. */
    155     VDIOREQTYPE_DISCARD
    156 } VDIOREQTYPE;
    157 
    158 /**
    159142 * VD I/O request state.
    160143 */
     
    188171    RTLISTNODE                    NdAllocatedList;
    189172    /** I/O request type. */
    190     VDIOREQTYPE                   enmType;
     173    PDMMEDIAEXIOREQTYPE           enmType;
    191174    /** Request state. */
    192175    volatile VDIOREQSTATE         enmState;
     
    28042787static void drvvdMediaExIoReqBufFree(PVBOXDISK pThis, PPDMMEDIAEXIOREQINT pIoReq)
    28052788{
    2806     if (pThis->pCfgCrypto)
    2807         RTMemSaferFree(pIoReq->DataSeg.pvSeg, pIoReq->DataSeg.cbSeg);
    2808     else
    2809     {
    2810         size_t cb = RT_ALIGN_Z(pIoReq->DataSeg.cbSeg, _4K);
    2811         RTMemPageFree(pIoReq->DataSeg.pvSeg, cb);
     2789    if (pIoReq->DataSeg.pvSeg)
     2790    {
     2791        if (pThis->pCfgCrypto)
     2792            RTMemSaferFree(pIoReq->DataSeg.pvSeg, pIoReq->DataSeg.cbSeg);
     2793        else
     2794        {
     2795            size_t cb = RT_ALIGN_Z(pIoReq->DataSeg.cbSeg, _4K);
     2796            RTMemPageFree(pIoReq->DataSeg.pvSeg, cb);
     2797        }
    28122798    }
    28132799}
     
    28312817
    28322818        if (   RT_SUCCESS(rcReq)
    2833             && pIoReq->enmType == VDIOREQTYPE_READ)
     2819            && pIoReq->enmType == PDMMEDIAEXIOREQTYPE_READ)
    28342820        {
    28352821            /* Sync memory buffer with caller. */
     
    28952881        return VERR_NO_MEMORY;
    28962882
    2897     pIoReq->uIoReqId = uIoReqId;
    2898     pIoReq->fFlags   = fFlags;
    2899     pIoReq->pDisk    = pThis;
    2900     pIoReq->enmState = VDIOREQSTATE_ALLOCATED;
    2901     pIoReq->enmType  = VDIOREQTYPE_INVALID;
     2883    pIoReq->uIoReqId      = uIoReqId;
     2884    pIoReq->fFlags        = fFlags;
     2885    pIoReq->pDisk         = pThis;
     2886    pIoReq->enmState      = VDIOREQSTATE_ALLOCATED;
     2887    pIoReq->enmType       = PDMMEDIAEXIOREQTYPE_INVALID;
     2888    pIoReq->DataSeg.pvSeg = NULL;
     2889    pIoReq->DataSeg.cbSeg = 0;
    29022890
    29032891    int rc = drvvdMediaExIoReqInsert(pThis, pIoReq);
     
    29962984    VDIOREQSTATE enmState = (VDIOREQSTATE)ASMAtomicReadU32((volatile uint32_t *)&pIoReq->enmState);
    29972985
    2998     if (RT_UNLIKELY(enmState != VDIOREQSTATE_CANCELED))
     2986    if (RT_UNLIKELY(enmState == VDIOREQSTATE_CANCELED))
    29992987        return VERR_PDM_MEDIAEX_IOREQ_CANCELED;
    30002988
     
    30022990        return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE;
    30032991
    3004     pIoReq->enmType = VDIOREQTYPE_READ;
     2992    pIoReq->enmType = PDMMEDIAEXIOREQTYPE_READ;
    30052993    /* Allocate a suitable I/O buffer for this request. */
    30062994    int rc = drvvdMediaExIoReqBufAlloc(pThis, pIoReq, cbRead);
     
    30383026    VDIOREQSTATE enmState = (VDIOREQSTATE)ASMAtomicReadU32((volatile uint32_t *)&pIoReq->enmState);
    30393027
    3040     if (RT_UNLIKELY(enmState != VDIOREQSTATE_CANCELED))
     3028    if (RT_UNLIKELY(enmState == VDIOREQSTATE_CANCELED))
    30413029        return VERR_PDM_MEDIAEX_IOREQ_CANCELED;
    30423030
     
    30443032        return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE;
    30453033
    3046     pIoReq->enmType = VDIOREQTYPE_WRITE;
     3034    pIoReq->enmType = PDMMEDIAEXIOREQTYPE_WRITE;
    30473035    /* Allocate a suitable I/O buffer for this request. */
    30483036    int rc = drvvdMediaExIoReqBufAlloc(pThis, pIoReq, cbWrite);
     
    30623050
    30633051            ASMAtomicIncU32(&pThis->cIoReqsActive);
    3064             rc = VDAsyncRead(pThis->pDisk, off, cbWrite, &pIoReq->SgBuf,
    3065                              drvvdMediaExIoReqComplete, pThis, pIoReq);
     3052            rc = VDAsyncWrite(pThis->pDisk, off, cbWrite, &pIoReq->SgBuf,
     3053                              drvvdMediaExIoReqComplete, pThis, pIoReq);
    30663054            if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
    30673055                rc = VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS;
     
    30863074    VDIOREQSTATE enmState = (VDIOREQSTATE)ASMAtomicReadU32((volatile uint32_t *)&pIoReq->enmState);
    30873075
    3088     if (RT_UNLIKELY(enmState != VDIOREQSTATE_CANCELED))
     3076    if (RT_UNLIKELY(enmState == VDIOREQSTATE_CANCELED))
    30893077        return VERR_PDM_MEDIAEX_IOREQ_CANCELED;
    30903078
     
    30923080        return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE;
    30933081
    3094     pIoReq->enmType = VDIOREQTYPE_FLUSH;
     3082    pIoReq->enmType = PDMMEDIAEXIOREQTYPE_FLUSH;
    30953083
    30963084    bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pIoReq->enmState, VDIOREQSTATE_ACTIVE, VDIOREQSTATE_ALLOCATED);
     
    31243112    VDIOREQSTATE enmState = (VDIOREQSTATE)ASMAtomicReadU32((volatile uint32_t *)&pIoReq->enmState);
    31253113
    3126     if (RT_UNLIKELY(enmState != VDIOREQSTATE_CANCELED))
     3114    if (RT_UNLIKELY(enmState == VDIOREQSTATE_CANCELED))
    31273115        return VERR_PDM_MEDIAEX_IOREQ_CANCELED;
    31283116
     
    31303118        return VERR_PDM_MEDIAEX_IOREQ_INVALID_STATE;
    31313119
    3132     pIoReq->enmType = VDIOREQTYPE_DISCARD;
     3120    pIoReq->enmType = PDMMEDIAEXIOREQTYPE_DISCARD;
    31333121
    31343122    bool fXchg = ASMAtomicCmpXchgU32((volatile uint32_t *)&pIoReq->enmState, VDIOREQSTATE_ACTIVE, VDIOREQSTATE_ALLOCATED);
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r59248 r59305  
    19581958    GEN_CHECK_OFF(NVMEQUEUESUBM, hEvtProcess);
    19591959    GEN_CHECK_OFF(NVMEQUEUESUBM, pWrkThrdR3);
    1960     GEN_CHECK_OFF(NVMEQUEUESUBM, CritSectIoReqsActive);
    19611960    GEN_CHECK_OFF(NVMEQUEUESUBM, NdLstWrkThrdAssgnd);
    19621961    GEN_CHECK_OFF(NVMEQUEUESUBM, cReqsActive);
    1963     GEN_CHECK_OFF(NVMEQUEUESUBM, LstIoReqsActive);
    19641962
    19651963    GEN_CHECK_SIZE(NVMEQUEUECOMP);
Note: See TracChangeset for help on using the changeset viewer.

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