Fix infinite loop when zdb -R with d flag

Also print decompress progress to stderr so it wouldn't pollute raw output
with r flag.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4956
This commit is contained in:
Chunwei Chen 2016-08-10 16:28:58 -07:00 committed by Brian Behlendorf
parent d9c97ec08b
commit b320dd91a9
1 changed files with 2 additions and 2 deletions

View File

@ -3500,7 +3500,8 @@ zdb_read_block(char *thing, spa_t *spa)
for (lsize = psize + SPA_MINBLOCKSIZE;
lsize <= SPA_MAXBLOCKSIZE; lsize += SPA_MINBLOCKSIZE) {
for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) {
(void) printf("Trying %05llx -> %05llx (%s)\n",
(void) fprintf(stderr,
"Trying %05llx -> %05llx (%s)\n",
(u_longlong_t)psize, (u_longlong_t)lsize,
zio_compress_table[c].ci_name);
if (zio_decompress_data(c, pbuf, lbuf,
@ -3512,7 +3513,6 @@ zdb_read_block(char *thing, spa_t *spa)
}
if (c != ZIO_COMPRESS_FUNCTIONS)
break;
lsize -= SPA_MINBLOCKSIZE;
}
umem_free(pbuf2, SPA_MAXBLOCKSIZE);