VirtualBox

Changeset 38449 in vbox


Ignore:
Timestamp:
Aug 14, 2011 10:53:13 AM (13 years ago)
Author:
vboxsync
Message:

VD: Fix copy optimization

File:
1 edited

Legend:

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

    r38409 r38449  
    60146014    PVDIMAGE pImageTo = NULL;
    60156015
    6016     LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu uImageFlags=%#x pDstUuid=%#p uOpenFlags=%#x pVDIfsOperation=%#p pDstVDIfsImage=%#p pDstVDIfsOperation=%#p\n",
    6017                  pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, uImageFlags, pDstUuid, uOpenFlags, pVDIfsOperation, pDstVDIfsImage, pDstVDIfsOperation));
     6016    LogFlowFunc(("pDiskFrom=%#p nImage=%u pDiskTo=%#p pszBackend=\"%s\" pszFilename=\"%s\" fMoveByRename=%d cbSize=%llu nImageFromSame=%u nImageToSame=%u uImageFlags=%#x pDstUuid=%#p uOpenFlags=%#x pVDIfsOperation=%#p pDstVDIfsImage=%#p pDstVDIfsOperation=%#p\n",
     6017                 pDiskFrom, nImage, pDiskTo, pszBackend, pszFilename, fMoveByRename, cbSize, nImageFromSame, nImageToSame, uImageFlags, pDstUuid, uOpenFlags, pVDIfsOperation, pDstVDIfsImage, pDstVDIfsOperation));
    60186018
    60196019    PVDINTERFACE pIfProgress = VDInterfaceGet(pVDIfsOperation,
     
    62136213         * Don't optimize if the image existed or if it is a child image. */
    62146214        bool fSuppressRedundantIo = (   !(pszFilename == NULL || cImagesTo > 0)
    6215                                      || (nImageToSame != UINT32_MAX));
     6215                                     || (nImageToSame != VD_IMAGE_CONTENT_UNKNOWN));
     6216        unsigned cImagesFromReadBack, cImagesToReadBack;
     6217
     6218        if (nImageFromSame == VD_IMAGE_CONTENT_UNKNOWN)
     6219            cImagesFromReadBack = 0;
     6220        else
     6221        {
     6222            if (nImage == VD_LAST_IMAGE)
     6223                cImagesFromReadBack = pDiskFrom->cImages - nImageFromSame - 1;
     6224            else
     6225                cImagesFromReadBack = nImage - nImageFromSame;
     6226        }
     6227
     6228        if (nImageToSame == VD_IMAGE_CONTENT_UNKNOWN)
     6229            cImagesToReadBack = 0;
     6230        else
     6231            cImagesToReadBack = pDiskTo->cImages - nImageToSame - 1;
    62166232
    62176233        /* Copy the data. */
    62186234        rc = vdCopyHelper(pDiskFrom, pImageFrom, pDiskTo, cbSize,
    6219                           nImageFromSame == VD_IMAGE_CONTENT_UNKNOWN ? 0 : nImage - nImageFromSame,
    6220                           nImageToSame == VD_IMAGE_CONTENT_UNKNOWN ? 0 : pDiskTo->cImages - nImageToSame + 1,
     6235                          cImagesFromReadBack, cImagesToReadBack,
    62216236                          fSuppressRedundantIo, pIfProgress, pCbProgress,
    62226237                          pDstIfProgress, pDstCbProgress);
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