Index: /trunk/include/iprt/log.h
===================================================================
--- /trunk/include/iprt/log.h	(revision 59826)
+++ /trunk/include/iprt/log.h	(revision 59827)
@@ -68,4 +68,5 @@
     RTLOGGROUP_TIMER,
     RTLOGGROUP_LOCALIPC,
+    RTLOGGROUP_VFS,
     RTLOGGROUP_ZIP = 31,
     RTLOGGROUP_FIRST_USER = 32
@@ -102,5 +103,5 @@
     "RT_TIMER",     \
     "RT_LOCALIPC", \
-    "RT_16", \
+    "RT_VFS", \
     "RT_17", \
     "RT_18", \
Index: /trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp	(revision 59826)
+++ /trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp	(revision 59827)
@@ -29,4 +29,5 @@
 *   Header Files                                                                                                                 *
 *********************************************************************************************************************************/
+#define LOG_GROUP RTLOGGROUP_VFS
 #include "internal/iprt.h"
 #include <iprt/vfs.h>
@@ -37,4 +38,5 @@
 #include <iprt/file.h>
 #include <iprt/list.h>
+#include <iprt/log.h>
 #include <iprt/poll.h>
 #include <iprt/string.h>
@@ -277,4 +279,5 @@
         {
             rc = pcbRead ? VINF_EOF : VERR_EOF;
+            Log(("rtVfsReadAhead_Read: ret %Rrc; offCur=%#llx offEof=%#llx\n", rc, offCur, pThis->offEof));
             break;
         }
@@ -308,14 +311,17 @@
         RTSgBufInit(&TmpSgBuf, &TmpSeg, 1);
         size_t cbThisRead = cbDst;
-        rc = RTVfsIoStrmSgRead(pThis->hIos, off, pSgBuf, fBlocking, pcbRead ? &cbThisRead : NULL);
+        rc = RTVfsIoStrmSgRead(pThis->hIos, off, &TmpSgBuf, fBlocking, pcbRead ? &cbThisRead : NULL);
         if (RT_SUCCESS(rc))
         {
-            cbTotalRead = cbThisRead;
-            offCur     += cbThisRead;
+            cbTotalRead += cbThisRead;
+            offCur      += cbThisRead;
             pThis->offConsumer = offCur;
             if (rc != VINF_EOF)
                 fPokeReader = true;
             else
+            {
                 pThis->offEof = offCur;
+                Log(("rtVfsReadAhead_Read: EOF %llu (%#llx)\n", pThis->offEof, pThis->offEof));
+            }
         }
         /* else if (rc == VERR_EOF): hard to say where exactly the current position
@@ -331,4 +337,5 @@
     if (pcbRead)
         *pcbRead = cbTotalRead;
+    Assert(cbTotalRead <= pSgBuf->paSegs[0].cbSeg);
 
     return rc;
@@ -583,5 +590,8 @@
                 {
                     if (rc == VINF_EOF)
+                    {
                         pThis->offEof = pBufDesc->off + cbRead;
+                        Log(("rtVfsReadAheadThreadProc: EOF %llu (%#llx)\n", pThis->offEof, pThis->offEof));
+                    }
                     pBufDesc->cbFilled = (uint32_t)cbRead;
 
@@ -669,7 +679,8 @@
     if (cBuffers == 0)
         cBuffers = 4;
-    AssertStmt(cbBuffer <= _512K, rc = VERR_OUT_OF_RANGE);
+    AssertStmt(cbBuffer <= _4M, rc = VERR_OUT_OF_RANGE);
     if (cbBuffer == 0)
         cbBuffer = _256K / cBuffers;
+    AssertStmt(cbBuffer * cBuffers < (ARCH_BITS < 64 ? _64M : _256M), rc = VERR_OUT_OF_RANGE);
     AssertStmt(!fFlags, rc = VERR_INVALID_FLAGS);
 
