VirtualBox

Changeset 36018 in vbox


Ignore:
Timestamp:
Feb 17, 2011 7:58:10 PM (14 years ago)
Author:
vboxsync
Message:

VMDK: Remove unused code and merge missing part into vmdkAsyncFlush

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VMDK.cpp

    r35987 r36018  
    46714671                    && !(pExtent->pszBasename[0] == RTPATH_SLASH))
    46724672                    rc = vmdkFileFlush(pImage, pExtent->pFile);
    4673                 break;
    4674             case VMDKETYPE_ZERO:
    4675                 /* No need to do anything for this extent. */
    4676                 break;
    4677             default:
    4678                 AssertMsgFailed(("unknown extent type %d\n", pExtent->enmType));
    4679                 break;
    4680         }
    4681     }
    4682 
    4683 out:
    4684     return rc;
    4685 }
    4686 
    4687 /**
    4688  * Internal. Flush image data (and metadata) to disk - async version.
    4689  */
    4690 static int vmdkFlushImageAsync(PVMDKIMAGE pImage, PVDIOCTX pIoCtx)
    4691 {
    4692     PVMDKEXTENT pExtent;
    4693     int rc = VINF_SUCCESS;
    4694 
    4695     /* Update descriptor if changed. */
    4696     if (pImage->Descriptor.fDirty)
    4697     {
    4698         rc = vmdkWriteDescriptorAsync(pImage, pIoCtx);
    4699         if (   RT_FAILURE(rc)
    4700             && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
    4701             goto out;
    4702     }
    4703 
    4704     for (unsigned i = 0; i < pImage->cExtents; i++)
    4705     {
    4706         pExtent = &pImage->pExtents[i];
    4707         if (pExtent->pFile != NULL && pExtent->fMetaDirty)
    4708         {
    4709             switch (pExtent->enmType)
    4710             {
    4711                 case VMDKETYPE_HOSTED_SPARSE:
    4712                     AssertMsgFailed(("Async I/O not supported for sparse images\n"));
    4713                     break;
    4714 #ifdef VBOX_WITH_VMDK_ESX
    4715                 case VMDKETYPE_ESX_SPARSE:
    4716                     /** @todo update the header. */
    4717                     break;
    4718 #endif /* VBOX_WITH_VMDK_ESX */
    4719                 case VMDKETYPE_VMFS:
    4720                 case VMDKETYPE_FLAT:
    4721                     /* Nothing to do. */
    4722                     break;
    4723                 case VMDKETYPE_ZERO:
    4724                 default:
    4725                     AssertMsgFailed(("extent with type %d marked as dirty\n",
    4726                                      pExtent->enmType));
    4727                     break;
    4728             }
    4729         }
    4730         switch (pExtent->enmType)
    4731         {
    4732             case VMDKETYPE_HOSTED_SPARSE:
    4733 #ifdef VBOX_WITH_VMDK_ESX
    4734             case VMDKETYPE_ESX_SPARSE:
    4735 #endif /* VBOX_WITH_VMDK_ESX */
    4736             case VMDKETYPE_VMFS:
    4737             case VMDKETYPE_FLAT:
    4738                 /** @todo implement proper path absolute check. */
    4739                 if (   pExtent->pFile != NULL
    4740                     && !(pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY)
    4741                     && !(pExtent->pszBasename[0] == RTPATH_SLASH))
    4742                     rc = vmdkFileFlushAsync(pImage, pExtent->pFile, pIoCtx);
    47434673                break;
    47444674            case VMDKETYPE_ZERO:
     
    72597189    PVMDKEXTENT pExtent;
    72607190    int rc = VINF_SUCCESS;
     7191
     7192    /* Update descriptor if changed. */
     7193    /** @todo: The descriptor is never updated because
     7194     * it remains unchanged during normal operation (only vmdkRename updates it).
     7195     * So this part is actually not tested so far and requires testing as soon
     7196     * as the descriptor might change during async I/O.
     7197     */
     7198    if (pImage->Descriptor.fDirty)
     7199    {
     7200        rc = vmdkWriteDescriptorAsync(pImage, pIoCtx);
     7201        if (   RT_FAILURE(rc)
     7202            && rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
     7203            goto out;
     7204    }
    72617205
    72627206    for (unsigned i = 0; i < pImage->cExtents; i++)
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