Move lead-out retrial.

This commit is contained in:
2019-12-31 21:39:18 +00:00
parent aa6b6ac8f7
commit 89b0f7af2e
2 changed files with 159 additions and 105 deletions

View File

@@ -1425,9 +1425,11 @@ namespace DiscImageChef.Core.Devices.Dumping
EndProgress?.Invoke();
// TODO: Enable when underlying images support lead-outs
/*
DumpCdLeadOuts(blocks, blockSize, ref currentSpeed, currentTry, extents, ibgLog, ref imageWriteDuration,
leadOutExtents, ref maxSpeed, mhddLog, ref minSpeed, read6, read10, read12, read16, readcd,
supportedSubchannel, subSize, ref totalDuration);
*/
end = DateTime.UtcNow;
mhddLog.Close();
@@ -1848,6 +1850,13 @@ namespace DiscImageChef.Core.Devices.Dumping
EndProgress?.Invoke();
// TODO: Enable when underlying images support lead-outs
/*
RetryCdLeadOuts(blocks, blockSize, ref currentSpeed, currentTry, extents, ibgLog, ref imageWriteDuration,
leadOutExtents, ref maxSpeed, mhddLog, ref minSpeed, read6, read10, read12, read16, readcd,
supportedSubchannel, subSize, ref totalDuration);
*/
// Try to ignore read errors, on some drives this allows to recover partial even if damaged data
if(_persistent && sectorsNotEvenPartial.Count > 0)
{
@@ -1930,110 +1939,6 @@ namespace DiscImageChef.Core.Devices.Dumping
if(runningPersistent && currentModePage.HasValue)
{
// TODO: Enable when underlying images support lead-outs
/*
dumpLog.WriteLine("Retrying lead-outs");
InitProgress?.Invoke();
foreach(Tuple<ulong, ulong> leadout in leadOutExtents.ToArray())
for(ulong i = leadout.Item1; i <= leadout.Item2; i++)
{
if(aborted)
{
currentTry.Extents = ExtentsConverter.ToMetadata(extents);
dumpLog.WriteLine("Aborted!");
break;
}
double cmdDuration = 0;
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed;
if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
PulseProgress?.Invoke(string.Format("Reading sector {0} at lead-out ({1:F3} MiB/sec.)", i,
blocks, currentSpeed));
if(readcd)
{
sense = dev.ReadCd(out cmdBuf, out senseBuf, (uint)i, blockSize, 1,
MmcSectorTypes.AllTypes, false, false, true,
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
supportedSubchannel, dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
}
else if(read16)
sense = dev.Read16(out cmdBuf, out senseBuf, 0, false, true, false, i, blockSize, 0,
1, false, dev.Timeout, out cmdDuration);
else if(read12)
sense = dev.Read12(out cmdBuf, out senseBuf, 0, false, true, false, false, (uint)i,
blockSize, 0, 1, false, dev.Timeout, out cmdDuration);
else if(read10)
sense = dev.Read10(out cmdBuf, out senseBuf, 0, false, true, false, false, (uint)i,
blockSize, 0, 1, dev.Timeout, out cmdDuration);
else if(read6)
sense = dev.Read6(out cmdBuf, out senseBuf, (uint)i, blockSize, 1, dev.Timeout,
out cmdDuration);
if(!sense && !dev.Error)
{
mhddLog.Write(i, cmdDuration);
ibgLog.Write(i, currentSpeed * 1024);
extents.Add(i, blocksToRead, true);
leadOutExtents.Remove(i);
DateTime writeStart = DateTime.Now;
if(supportedSubchannel != MmcSubchannel.None)
{
byte[] data = new byte[SECTOR_SIZE * blocksToRead];
byte[] sub = new byte[subSize * blocksToRead];
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(0 + b * blockSize), data, SECTOR_SIZE * b,
SECTOR_SIZE);
Array.Copy(cmdBuf, (int)(SECTOR_SIZE + b * blockSize), sub, subSize * b,
subSize);
}
outputPlugin.WriteSectorsLong(data, i, blocksToRead);
outputPlugin.WriteSectorsTag(sub, i, blocksToRead,
SectorTagType.CdSectorSubchannel);
}
else outputPlugin.WriteSectors(cmdBuf, i, blocksToRead);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
}
else
{
// TODO: Reset device after X errors
if(stopOnError) return; // TODO: Return more cleanly
// Write empty data
DateTime writeStart = DateTime.Now;
if(supportedSubchannel != MmcSubchannel.None)
{
outputPlugin.WriteSectorsLong(new byte[SECTOR_SIZE * skip], i, 1);
outputPlugin.WriteSectorsTag(new byte[subSize * skip], i, 1,
SectorTagType.CdSectorSubchannel);
}
else outputPlugin.WriteSectors(new byte[blockSize * skip], i, 1);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration);
ibgLog.Write(i, 0);
}
double newSpeed =
(double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
}
EndProgress?.Invoke();
*/
var md = new Modes.DecodedMode
{
Header = new Modes.ModeHeader(), Pages = new[]