[CompactDisc] Log the timing of trimming and retrying in the MHDD log.

This commit is contained in:
2026-11-01 10:51:37 +00:00
parent 0de23e654f
commit 06387bcfbb
3 changed files with 34 additions and 12 deletions

View File

@@ -1141,7 +1141,7 @@ sealed partial class Dump
sectorsForOffset);
}
mhddLog.Close();
mhddLog.Flush();
ibgLog.Close(_dev,
blocks,
@@ -1183,7 +1183,8 @@ sealed partial class Dump
isrcs,
ref mcn,
subchannelExtents,
smallestPregapLbaPerTrack);
smallestPregapLbaPerTrack,
mhddLog);
if(dskType is MediaType.CDR or MediaType.CDRW && _resume.BadBlocks.Count > 0 && _ignoreCdrRunOuts > 0)
{
@@ -1214,7 +1215,10 @@ sealed partial class Dump
ref mcn,
subchannelExtents,
smallestPregapLbaPerTrack,
supportsLongSectors);
supportsLongSectors,
mhddLog);
mhddLog.Close();
// Re-read the audio sectors the drive concealed until they converge on stable, C2-clean data, rewriting the
// ones that do. Runs after the normal retries so hard errors are dealt with first.

View File

@@ -75,18 +75,19 @@ partial class Dump
/// <param name="mcn">Disc media catalogue number</param>
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
/// <param name="mhddLog">MHDD log</param>
void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
int offsetBytes, bool readcd, int sectorsForOffset, uint subSize,
MmcSubchannel supportedSubchannel, ref double totalDuration, SubchannelLog subLog,
MmcSubchannel desiredSubchannel, Track[] tracks, Dictionary<byte, string> isrcs,
ref string mcn, HashSet<int> subchannelExtents,
Dictionary<byte, int> smallestPregapLbaPerTrack, bool supportsLongSectors)
Dictionary<byte, int> smallestPregapLbaPerTrack, bool supportsLongSectors, MhddLog mhddLog)
{
var sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration; // Command execution time
const uint sectorSize = 2352; // Full sector size
ReadOnlySpan<byte> senseBuf = null; // Sense buffer
var sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
ReadOnlySpan<byte> senseBuf = null; // Sense buffer
PlextorSubchannel supportedPlextorSubchannel;
var outputOptical = _outputPlugin as IWritableOpticalImage;
@@ -356,8 +357,10 @@ partial class Dump
badSectorToReRead,
sectorsToReRead,
_dev.Timeout,
out cmdDuration,
out double plainDuration,
true);
cmdDuration += plainDuration;
}
}
else if(_supportsPlextorD8 && audioExtents.Contains(badSector))
@@ -549,7 +552,12 @@ partial class Dump
{
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf.ToArray());
if(!runningPersistent) continue;
if(!runningPersistent)
{
mhddLog.WriteRetry(badSector, cmdDuration, true);
continue;
}
DecodedSense? decSense = Sense.Decode(senseBuf);
@@ -641,6 +649,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -771,6 +780,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -789,6 +799,8 @@ partial class Dump
else
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf.ToArray());
mhddLog.WriteRetry(badSector, cmdDuration, sectorStatus == SectorStatus.Errored);
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];
@@ -932,6 +944,7 @@ partial class Dump
out cmdDuration);
totalDuration += cmdDuration;
mhddLog.WriteRetry(badSector, cmdDuration, sense || _dev.Error);
}
if(sense || _dev.Error)

View File

@@ -78,12 +78,13 @@ partial class Dump
/// <param name="mcn">Disc media catalogue number</param>
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
/// <param name="mhddLog">MHDD log</param>
void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents,
bool newTrim, int offsetBytes, bool read6, bool read10, bool read12, bool read16, bool readcd,
int sectorsForOffset, uint subSize, MmcSubchannel supportedSubchannel, bool supportsLongSectors,
ref double totalDuration, SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks,
Dictionary<byte, string> isrcs, ref string mcn, HashSet<int> subchannelExtents,
Dictionary<byte, int> smallestPregapLbaPerTrack)
Dictionary<byte, int> smallestPregapLbaPerTrack, MhddLog mhddLog)
{
var sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
@@ -399,6 +400,7 @@ partial class Dump
if(sense || _dev.Error)
{
_errorLog?.WriteLine(badSectorToRead, _dev.Error, _dev.LastError, senseBuf.ToArray());
mhddLog.WriteRetry(badSector, cmdDuration, true);
continue;
}
@@ -474,6 +476,7 @@ partial class Dump
out double readCdDuration);
totalDuration += readCdDuration;
cmdDuration += readCdDuration;
if(!readCdSense && !_dev.Error && CdChecksums.CheckCdSector(readCdBuf) == true)
{
@@ -541,6 +544,8 @@ partial class Dump
}
}
mhddLog.WriteRetry(badSector, cmdDuration, sectorStatus == SectorStatus.Errored);
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];