VirtualBox

Changeset 59758 in vbox


Ignore:
Timestamp:
Feb 20, 2016 3:02:15 AM (9 years ago)
Author:
vboxsync
Message:

ApplianceImplImport.cpp: Inserted read ahead threads into the source I/O streams for all image operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r59691 r59758  
    10011001{
    10021002    /*
    1003      * Just open the file (throws error) and write the destination (nothrow).
     1003     * Open the file (throws error) and add a read ahead thread so we can do
     1004     * concurrent reads (+digest) and writes.
    10041005     */
    10051006    RTVFSIOSTREAM hVfsIosSrc = i_importOpenSourceFile(stack, rstrSrcPath, pszManifestEntry);
    1006     HRESULT hrc = i_importCreateAndWriteDestinationFile(rstrDstPath, hVfsIosSrc, rstrSrcPath);
     1007    RTVFSIOSTREAM hVfsIosReadAhead;
     1008    int vrc = RTVfsCreateReadAheadForIoStream(hVfsIosSrc, 0 /*fFlags*/, 0 /*cBuffers=default*/, 0 /*cbBuffers=default*/,
     1009                                              &hVfsIosReadAhead);
     1010    if (RT_FAILURE(vrc))
     1011    {
     1012        RTVfsIoStrmRelease(hVfsIosSrc);
     1013        throw setErrorVrc(vrc, tr("Error initializing read ahead thread for '%s' (%Rrc)"), rstrSrcPath.c_str(), vrc);
     1014    }
     1015
     1016    /*
     1017     * Write the destination file (nothrow).
     1018     */
     1019    HRESULT hrc = i_importCreateAndWriteDestinationFile(rstrDstPath, hVfsIosReadAhead, rstrSrcPath);
     1020    RTVfsIoStrmRelease(hVfsIosReadAhead);
    10071021
    10081022    /*
     
    10401054     * is done on one thread, while unpacking and writing is one on this thread.
    10411055     */
    1042     /** @todo read thread */
     1056    RTVFSIOSTREAM hVfsIosReadAhead;
     1057    int vrc = RTVfsCreateReadAheadForIoStream(hVfsIosSrcCompressed, 0 /*fFlags*/, 0 /*cBuffers=default*/,
     1058                                              0 /*cbBuffers=default*/, &hVfsIosReadAhead);
     1059    if (RT_FAILURE(vrc))
     1060    {
     1061        RTVfsIoStrmRelease(hVfsIosSrcCompressed);
     1062        throw setErrorVrc(vrc, tr("Error initializing read ahead thread for '%s' (%Rrc)"), rstrSrcPath.c_str(), vrc);
     1063    }
    10431064
    10441065    /*
     
    10461067     */
    10471068    RTVFSIOSTREAM hVfsIosSrc;
    1048     int vrc = RTZipGzipDecompressIoStream(hVfsIosSrcCompressed, 0, &hVfsIosSrc);
     1069    vrc = RTZipGzipDecompressIoStream(hVfsIosReadAhead, 0, &hVfsIosSrc);
     1070    RTVfsIoStrmRelease(hVfsIosReadAhead);
    10491071    if (RT_FAILURE(vrc))
    10501072    {
     
    25812603                        hVfsIosSrc = i_importOpenSourceFile(stack, strSrcFilePath, strSourceOVF.c_str());
    25822604
     2605                    /* Add a read ahead thread to try speed things up with concurrent reads and
     2606                       writes going on in different threads. */
     2607                    RTVFSIOSTREAM hVfsIosReadAhead;
     2608                    vrc = RTVfsCreateReadAheadForIoStream(hVfsIosSrc, 0 /*fFlags*/, 0 /*cBuffers=default*/,
     2609                                                          0 /*cbBuffers=default*/, &hVfsIosReadAhead);
     2610                    RTVfsIoStrmRelease(hVfsIosSrc);
     2611                    if (RT_FAILURE(vrc))
     2612                        throw setErrorVrc(vrc, tr("Error initializing read ahead thread for '%s' (%Rrc)"),
     2613                                          strSrcFilePath.c_str(), vrc);
     2614
    25832615                    /* Start the source image cloning operation. */
    25842616                    ComObjPtr<Medium> nullParent;
     
    25862618                                                 srcFormat,
    25872619                                                 MediumVariant_Standard,
    2588                                                  hVfsIosSrc,
     2620                                                 hVfsIosReadAhead,
    25892621                                                 nullParent,
    25902622                                                 pProgress);
    2591                     RTVfsIoStrmRelease(hVfsIosSrc);
     2623                    RTVfsIoStrmRelease(hVfsIosReadAhead);
    25922624                    hVfsIosSrc = NIL_RTVFSIOSTREAM;
    25932625                    if (FAILED(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