VirtualBox

Ignore:
Timestamp:
Feb 25, 2016 9:04:12 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105720
Message:

vfsreadahead.cpp: Fixed two bugs in the read code and increased the buffer size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp

    r59757 r59827  
    2929*   Header Files                                                                                                                 *
    3030*********************************************************************************************************************************/
     31#define LOG_GROUP RTLOGGROUP_VFS
    3132#include "internal/iprt.h"
    3233#include <iprt/vfs.h>
     
    3738#include <iprt/file.h>
    3839#include <iprt/list.h>
     40#include <iprt/log.h>
    3941#include <iprt/poll.h>
    4042#include <iprt/string.h>
     
    277279        {
    278280            rc = pcbRead ? VINF_EOF : VERR_EOF;
     281            Log(("rtVfsReadAhead_Read: ret %Rrc; offCur=%#llx offEof=%#llx\n", rc, offCur, pThis->offEof));
    279282            break;
    280283        }
     
    308311        RTSgBufInit(&TmpSgBuf, &TmpSeg, 1);
    309312        size_t cbThisRead = cbDst;
    310         rc = RTVfsIoStrmSgRead(pThis->hIos, off, pSgBuf, fBlocking, pcbRead ? &cbThisRead : NULL);
     313        rc = RTVfsIoStrmSgRead(pThis->hIos, off, &TmpSgBuf, fBlocking, pcbRead ? &cbThisRead : NULL);
    311314        if (RT_SUCCESS(rc))
    312315        {
    313             cbTotalRead = cbThisRead;
    314             offCur     += cbThisRead;
     316            cbTotalRead += cbThisRead;
     317            offCur      += cbThisRead;
    315318            pThis->offConsumer = offCur;
    316319            if (rc != VINF_EOF)
    317320                fPokeReader = true;
    318321            else
     322            {
    319323                pThis->offEof = offCur;
     324                Log(("rtVfsReadAhead_Read: EOF %llu (%#llx)\n", pThis->offEof, pThis->offEof));
     325            }
    320326        }
    321327        /* else if (rc == VERR_EOF): hard to say where exactly the current position
     
    331337    if (pcbRead)
    332338        *pcbRead = cbTotalRead;
     339    Assert(cbTotalRead <= pSgBuf->paSegs[0].cbSeg);
    333340
    334341    return rc;
     
    583590                {
    584591                    if (rc == VINF_EOF)
     592                    {
    585593                        pThis->offEof = pBufDesc->off + cbRead;
     594                        Log(("rtVfsReadAheadThreadProc: EOF %llu (%#llx)\n", pThis->offEof, pThis->offEof));
     595                    }
    586596                    pBufDesc->cbFilled = (uint32_t)cbRead;
    587597
     
    669679    if (cBuffers == 0)
    670680        cBuffers = 4;
    671     AssertStmt(cbBuffer <= _512K, rc = VERR_OUT_OF_RANGE);
     681    AssertStmt(cbBuffer <= _4M, rc = VERR_OUT_OF_RANGE);
    672682    if (cbBuffer == 0)
    673683        cbBuffer = _256K / cBuffers;
     684    AssertStmt(cbBuffer * cBuffers < (ARCH_BITS < 64 ? _64M : _256M), rc = VERR_OUT_OF_RANGE);
    674685    AssertStmt(!fFlags, rc = VERR_INVALID_FLAGS);
    675686
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