VirtualBox

Changeset 39798 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 18, 2012 4:55:06 PM (13 years ago)
Author:
vboxsync
Message:

VD: Add option to ignore flush requests

File:
1 edited

Legend:

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

    r39612 r39798  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8787    /** Disk this image is part of */
    8888    PVBOXHDD            pDisk;
     89    /** Flag whether to ignore flush requests. */
     90    bool                fIgnoreFlush;
    8991} VDIO, *PVDIO;
    9092
     
    39443946static int vdIOIntFlushSync(void *pvUser, PVDIOSTORAGE pIoStorage)
    39453947{
     3948    int rc = VINF_SUCCESS;
    39463949    PVDIO pVDIo = (PVDIO)pvUser;
    3947     return pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser,
    3948                                              pIoStorage->pStorage);
     3950
     3951    if (!pVDIo->fIgnoreFlush)
     3952        rc = pVDIo->pInterfaceIo->pfnFlushSync(pVDIo->pInterfaceIo->Core.pvUser,
     3953                                               pIoStorage->pStorage);
     3954
     3955    return rc;
    39493956}
    39503957
     
    43234330    LogFlowFunc(("pvUser=%#p pIoStorage=%#p pIoCtx=%#p\n",
    43244331                 pvUser, pIoStorage, pIoCtx));
     4332
     4333    if (pVDIo->fIgnoreFlush)
     4334        return VINF_SUCCESS;
    43254335
    43264336    /* Allocate a new meta transfer. */
     
    52215231        AssertRC(rc);
    52225232
    5223         pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD);
     5233        pImage->uOpenFlags = uOpenFlags & (VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_DISCARD | VD_OPEN_FLAGS_IGNORE_FLUSH);
    52245234        rc = pImage->Backend->pfnOpen(pImage->pszFilename,
    5225                                       uOpenFlags & ~VD_OPEN_FLAGS_HONOR_SAME,
     5235                                      uOpenFlags & ~(VD_OPEN_FLAGS_HONOR_SAME | VD_OPEN_FLAGS_IGNORE_FLUSH),
    52265236                                      pDisk->pVDIfsDisk,
    52275237                                      pImage->pVDIfsImage,
     
    52585268
    52595269        pImage->VDIo.pBackendData = pImage->pBackendData;
     5270        pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
    52605271
    52615272        /* Check image type. As the image itself has only partial knowledge
     
    57495760        {
    57505761            pImage->VDIo.pBackendData = pImage->pBackendData;
     5762            pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
    57515763            pImage->uImageFlags = uImageFlags;
    57525764
     
    60256037        {
    60266038            pImage->VDIo.pBackendData = pImage->pBackendData;
     6039            pImage->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
    60276040            pImage->uImageFlags = uImageFlags;
    60286041
     
    62766289
    62776290            pCache->VDIo.pBackendData = pCache->pBackendData;
     6291            pCache->VDIo.fIgnoreFlush = (uOpenFlags & VD_OPEN_FLAGS_IGNORE_FLUSH) != 0;
    62786292
    62796293            /* Re-check state, as the lock wasn't held and another image
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