chiark / gitweb /
dvd-sector-copy.c: Add more debugging about the recovery algorithm.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 11:53:06 +0000 (11:53 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 19 Feb 2022 11:55:20 +0000 (11:55 +0000)
dvd-sector-copy.c

index fd15138bc23b0e9efe034598fa5e73ec252f3e82..4d441225fbb3452078657227739e1fee4ce8fb51 100644 (file)
@@ -712,6 +712,12 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
   bad_lo = pos; bad_hi = pos + 1;
   for (;;) {
     report_bad_blocks_progress(bad_lo, bad_hi, errno);
+#ifdef DEBUG
+    debug_clear_progress();
+    printf(";; bounding bad-block region: "
+          "%"PRIuSEC" ..%"PRIuSEC".. %"PRIuSEC"\n",
+          bad_lo, bad_hi - bad_lo, bad_hi);
+#endif
     if (bad_hi >= end) {
       clear_progress();
       moan("giving up on this extent");
@@ -722,7 +728,6 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
     want = run_length_wanted(pos, step, sz, end);
     n = recovery_read(&r, pos, want);
 #ifdef DEBUG
-    debug_clear_progress();
     printf(";; [bound] try reading %"PRIuSEC" .. %"PRIuSEC" -> %zd\n",
           pos, pos + want, n);
 #endif
@@ -734,12 +739,17 @@ static ssize_t find_good_sector(secaddr *pos_inout, secaddr end,
   good = pos;
   while (good > bad_hi) {
     report_bad_blocks_progress(bad_lo, bad_hi, errno);
+#ifdef DEBUG
+    debug_clear_progress();
+    printf(";; limiting bad-block region: "
+          "%"PRIuSEC" ..%"PRIuSEC".. %"PRIuSEC" ..%"PRIuSEC".. %"PRIuSEC"\n",
+          bad_lo, bad_hi - bad_lo, bad_hi, good - bad_hi, good);
+#endif
     pos = bad_hi + (good - bad_hi)/2;
     step = pos - bad_lo;
     want = run_length_wanted(pos, step, sz, end);
     n = recovery_read(&r, pos, want);
 #ifdef DEBUG
-    debug_clear_progress();
     printf(";; [limit] try reading %"PRIuSEC" .. %"PRIuSEC" -> %zd\n",
           pos, pos + want, n);
 #endif