VirtualBox

Changeset 31243 in vbox for trunk


Ignore:
Timestamp:
Jul 30, 2010 1:10:33 PM (14 years ago)
Author:
vboxsync
Message:

Storage/iSCSI: optimize changing the open flags from read/write to readonly

File:
1 edited

Legend:

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

    r31098 r31243  
    37853785    }
    37863786
    3787     /* Implement this operation via reopening the image. */
    3788     iscsiFreeImage(pImage, false);
    3789     rc = iscsiOpenImage(pImage, uOpenFlags);
    3790 
     3787    /* Implement this operation via reopening the image if we actually need
     3788     * to do something. A read/write -> readonly transition doesn't need a
     3789     * reopen. In the other direction we don't have the necessary information
     3790     * as the "disk is readonly" flag is thrown away. Can be optimized too,
     3791     * but it's not worth the effort at the moment. */
     3792    if (   !(uOpenFlags & VD_OPEN_FLAGS_READONLY)
     3793        && (pImage->uOpenFlags & VD_OPEN_FLAGS_READONLY))
     3794    {
     3795        iscsiFreeImage(pImage, false);
     3796        rc = iscsiOpenImage(pImage, uOpenFlags);
     3797    }
     3798    else
     3799    {
     3800        pImage->uOpenFlags = uOpenFlags;
     3801        rc = VINF_SUCCESS;
     3802    }
    37913803out:
    37923804    LogFlowFunc(("returns %Rrc\n", rc));
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