VirtualBox

Changeset 63150 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 8, 2016 11:34:01 AM (8 years ago)
Author:
vboxsync
Message:

Storage/VMDK: Several fixes:

  1. Don't reject async I/O for VMDK images with more than one FLAT extent (ancient limitation not true anymore)
  2. Fix calculation of the progress for static images with certain sizes if split into several extents. This fixes an error when creating such images with the split 2G option for certain sizes (8GB for example).
  3. Don't flush the image in vmdkFreeImage if will be deleted later on anyway. Fixes debug assertion when creating an image fails
File:
1 edited

Legend:

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

    r62757 r63150  
    32243224            goto out;
    32253225
    3226         /*
    3227          * We have to check for the asynchronous open flag. The
    3228          * extents are parsed and the type of all are known now.
    3229          * Check if every extent is either FLAT or ZERO.
    3230          */
    3231         if (uOpenFlags & VD_OPEN_FLAGS_ASYNC_IO)
    3232         {
    3233             unsigned cFlatExtents = 0;
    3234 
    3235             for (unsigned i = 0; i < pImage->cExtents; i++)
    3236             {
    3237                 pExtent = &pImage->pExtents[i];
    3238 
    3239                 if ((    pExtent->enmType != VMDKETYPE_FLAT
    3240                      &&  pExtent->enmType != VMDKETYPE_ZERO
    3241                      &&  pExtent->enmType != VMDKETYPE_VMFS)
    3242                     || ((pImage->pExtents[i].enmType == VMDKETYPE_FLAT) && (cFlatExtents > 0)))
    3243                 {
    3244                     /*
    3245                      * Opened image contains at least one none flat or zero extent.
    3246                      * Return error but don't set error message as the caller
    3247                      * has the chance to open in non async I/O mode.
    3248                      */
    3249                     rc = VERR_NOT_SUPPORTED;
    3250                     goto out;
    3251                 }
    3252                 if (pExtent->enmType == VMDKETYPE_FLAT)
    3253                     cFlatExtents++;
    3254             }
    3255         }
    3256 
    32573226        for (unsigned i = 0; i < pImage->cExtents; i++)
    32583227        {
     
    37493718        if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
    37503719        {
     3720            unsigned uPercentEnd = uPercentStart + uPercentSpan;
    37513721            rc = vdIfIoIntFileSetAllocationSize(pImage->pIfIo, pExtent->pFile->pStorage, cbExtent,
    3752                                                 0 /* fFlags */, pfnProgress, pvUser, uPercentStart + cbOffset * uPercentSpan / cbSize, uPercentSpan / cExtents);
     3722                                                0 /* fFlags */, pfnProgress, pvUser, uPercentStart + cbOffset * uPercentSpan / cbSize,
     3723                                                cbExtent * uPercentSpan / cbSize);
    37533724            if (RT_FAILURE(rc))
    37543725                return vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VMDK: could not set size of new file '%s'"), pExtent->pszFullname);
     
    43584329            }
    43594330        }
    4360         else
     4331        else if (!fDelete)
    43614332            vmdkFlushImage(pImage, NULL);
    43624333
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