aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--deadshred.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/TODO b/TODO
index 7edc9d8..6d59925 100644
--- a/TODO
+++ b/TODO
@@ -1,2 +1,3 @@
Add shred map operand
Test direction alternation
+Verify that aborting does not cause sections to be lost in the shred map
diff --git a/deadshred.c b/deadshred.c
index 6557a02..c471982 100644
--- a/deadshred.c
+++ b/deadshred.c
@@ -252,7 +252,7 @@ shredspan(int fd, struct span *span, const char *fname)
goto pwrite_again;
}
if (errno != EIO)
- weprintf("pwrite %s <buffer> %zu %ji:", fname, (size_t)n, (intmax_t)off);
+ eprintf("pwrite %s <buffer> %zu %ji:", fname, (size_t)n, (intmax_t)off);
add_span(off, n, span->blocksize == 1U ? 1U : span->blocksize >> 1, !first_fail);
first_fail = 0;
if (status.direction == FORWARDS)
@@ -443,7 +443,7 @@ main(int argc, char *argv[])
if (errno)
eprintf("pthread_create NULL:");
- while (nspans) {
+ for (;;) {
size_t old_nspans = nspans;
for (i = 0; i < old_nspans && !exiting; i++)
shredspan(fd, &spans[i], argv[0]);
@@ -453,6 +453,8 @@ main(int argc, char *argv[])
}
for (i = 0, j = nspans, nspans -= old_nspans; i < nspans;)
spans[i++] = spans[--j];
+ if (!nspans)
+ break;
status.direction ^= 1;
status.pass_nr += 1U;
}