VirtualBox

Changeset 29035 in vbox for trunk


Ignore:
Timestamp:
May 4, 2010 2:52:07 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61076
Message:

VMDK: Implement async flush

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r28820 r29035  
    62106210static int vmdkAsyncFlush(void *pvBackendData, PVDIOCTX pIoCtx)
    62116211{
    6212     int rc = VERR_NOT_IMPLEMENTED;
    6213     LogFlowFunc(("returns %Rrc\n", rc));
     6212    PVMDKIMAGE pImage = (PVMDKIMAGE)pvBackendData;
     6213    PVMDKEXTENT pExtent;
     6214    int rc = VINF_SUCCESS;
     6215
     6216    for (unsigned i = 0; i < pImage->cExtents; i++)
     6217    {
     6218        pExtent = &pImage->pExtents[i];
     6219        if (pExtent->pFile != NULL && pExtent->fMetaDirty)
     6220        {
     6221            switch (pExtent->enmType)
     6222            {
     6223                case VMDKETYPE_HOSTED_SPARSE:
     6224#ifdef VBOX_WITH_VMDK_ESX
     6225                case VMDKETYPE_ESX_SPARSE:
     6226#endif /* VBOX_WITH_VMDK_ESX */
     6227                    /** Not supported atm. */
     6228                    AssertMsgFailed(("Async I/O not supported for sparse images\n"));
     6229                    break;
     6230                case VMDKETYPE_VMFS:
     6231                case VMDKETYPE_FLAT:
     6232                    /* Nothing to do. */
     6233                    break;
     6234                case VMDKETYPE_ZERO:
     6235                default:
     6236                    AssertMsgFailed(("extent with type %d marked as dirty\n",
     6237                                     pExtent->enmType));
     6238                    break;
     6239            }
     6240        }
     6241        switch (pExtent->enmType)
     6242        {
     6243            case VMDKETYPE_HOSTED_SPARSE:
     6244#ifdef VBOX_WITH_VMDK_ESX
     6245            case VMDKETYPE_ESX_SPARSE:
     6246#endif /* VBOX_WITH_VMDK_ESX */
     6247            case VMDKETYPE_VMFS:
     6248            case VMDKETYPE_FLAT:
     6249                /** @todo implement proper path absolute check. */
     6250                if (   pExtent->pFile != NULL
     6251                    && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
     6252                    && !(pExtent->pszBasename[0] == RTPATH_SLASH))
     6253                    rc = vmdkFileFlushAsync(pExtent->pFile, pIoCtx);
     6254                break;
     6255            case VMDKETYPE_ZERO:
     6256                /* No need to do anything for this extent. */
     6257                break;
     6258            default:
     6259                AssertMsgFailed(("unknown extent type %d\n", pExtent->enmType));
     6260                break;
     6261        }
     6262    }
     6263
     6264out:
    62146265    return rc;
    62156266}
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