VirtualBox

Changeset 28118 in vbox for trunk


Ignore:
Timestamp:
Apr 8, 2010 9:39:01 PM (15 years ago)
Author:
vboxsync
Message:

DrvDiskIntegrity: Use the advanced S/G buffer compare method to get the exact offset

File:
1 edited

Legend:

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

    r28115 r28118  
    326326            RTSGSEG Seg;
    327327            RTSGBUF SgBufCmp;
     328            size_t cbOff = 0;
    328329
    329330            Seg.cbSeg = cbRange;
     
    331332
    332333            RTSgBufInit(&SgBufCmp, &Seg, 1);
    333             if (RTSgBufCmp(&SgBuf, &SgBufCmp, cbRange))
     334            if (RTSgBufCmpEx(&SgBuf, &SgBufCmp, cbRange, &cbOff, true))
    334335            {
    335                 unsigned offWrong = 0;
    336 #if 0
    337                 for (offWrong = 0; offWrong < cbRange; offWrong++)
    338                     if (pbBuf[offWrong] != pSeg->pbSeg[offSeg + offWrong])
    339 #endif
    340                     {
    341                         /* Corrupted disk, print I/O log entry of the last write which accessed this range. */
    342                         uint32_t cSector = (offSeg + offWrong) / 512;
    343                         AssertMsg(cSector < pSeg->cIoLogEntries, ("Internal bug!\n"));
    344 
    345                         RTMsgError("Corrupted disk at offset %llu (%u bytes in the current read buffer)!\n",
    346                                    offCurr + offWrong, offWrong);
    347                         RTMsgError("Last write to this sector started at offset %llu with %u bytes (%u references to this log entry)\n",
    348                                    pSeg->apIoLog[cSector]->off,
    349                                    pSeg->apIoLog[cSector]->cbWrite,
    350                                    pSeg->apIoLog[cSector]->cRefs);
    351                         RTAssertDebugBreak();
    352                     }
     336                /* Corrupted disk, print I/O log entry of the last write which accessed this range. */
     337                uint32_t cSector = (offSeg + cbOff) / 512;
     338                AssertMsg(cSector < pSeg->cIoLogEntries, ("Internal bug!\n"));
     339
     340                RTMsgError("Corrupted disk at offset %llu (%u bytes in the current read buffer)!\n",
     341                           offCurr + cbOff, cbOff);
     342                RTMsgError("Last write to this sector started at offset %llu with %u bytes (%u references to this log entry)\n",
     343                           pSeg->apIoLog[cSector]->off,
     344                           pSeg->apIoLog[cSector]->cbWrite,
     345                           pSeg->apIoLog[cSector]->cRefs);
     346                RTAssertDebugBreak();
    353347            }
    354348        }
     
    356350        offCurr += cbRange;
    357351        cbLeft  -= cbRange;
    358         RTSgBufAdvance(&SgBuf, cbRange);
    359352    }
    360353
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