dvd-sector-copy.c (find_good_sector): Use plain `read_sectors' for retries.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 8 Apr 2022 16:13:54 +0000 (17:13 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Apr 2022 16:15:17 +0000 (17:15 +0100)
This saves engaging the recovery buffering machinery until it's actually
going to be useful.  If the retry read actually reads anything at all
then we've succeeded and don't need the recovery machinery; if it
doesn't, then there's nothing left in the buffer anyway.

dvd-sector-copy.c

index 1aa65e5..8c4ba1f 100644 (file)
@@ -629,13 +629,10 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
   badblock_progress.render = render_badblock_progress;
   progress_additem(&progress, &badblock_progress);
 
-  r.buf = buf; r.sz = sz; r.pos = r.start = r.end = 0;
-  r.good_lo = r.good_hi = 0;
-
   want = sz; if (want > end - pos) want = end - pos;
   for (retry = 0; retry < max_retries; retry++) {
     report_bad_blocks_progress(pos, errno);
-    n = recovery_read(&r, pos, want);
+    n = read_sectors(pos, buf, want);
 #ifdef DEBUG
     progress_clear(&progress);
     printf(";; [retry] try reading %"PRIuSEC" .. %"PRIuSEC" -> %zd\n",
@@ -650,6 +647,9 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
     }
   }
 
+  r.buf = buf; r.sz = sz; r.pos = r.start = r.end = 0;
+  r.good_lo = r.good_hi = 0;
+
   bad_lo = pos; bad_hi = pos + 1;
   for (;;) {
     report_bad_blocks_progress(bad_hi, errno);