dump_history(spa_t *spa)
{
nvlist_t **events = NULL;
- char buf[SPA_MAXBLOCKSIZE];
+ char *buf;
uint64_t resid, len, off = 0;
uint_t num = 0;
int error;
char internalstr[MAXPATHLEN];
int i;
+ if ((buf = malloc(SPA_OLD_MAXBLOCKSIZE)) == NULL) {
+ (void) fprintf(stderr, "%s: unable to allocate I/O buffer\n",
+ __func__);
+ return;
+ }
+
do {
- len = sizeof (buf);
+ len = SPA_OLD_MAXBLOCKSIZE;
if ((error = spa_history_get(spa, &off, &len, buf)) != 0) {
(void) fprintf(stderr, "Unable to read history: "
"error %d\n", error);
+ free(buf);
return;
}
dump_nvlist(events[i], 2);
}
}
+ free(buf);
}
/*ARGSUSED*/
char *data, *dlimit;
blkptr_t *bp = &lr->lr_blkptr;
zbookmark_phys_t zb;
- char buf[SPA_MAXBLOCKSIZE];
+ char *buf;
int verbose = MAX(dump_opt['d'], dump_opt['i']);
int error;
if (txtype == TX_WRITE2 || verbose < 5)
return;
+ if ((buf = malloc(SPA_MAXBLOCKSIZE)) == NULL)
+ return;
+
if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) {
(void) printf("%shas blkptr, %s\n", prefix,
!BP_IS_HOLE(bp) &&
if (BP_IS_HOLE(bp)) {
(void) printf("\t\t\tLSIZE 0x%llx\n",
(u_longlong_t)BP_GET_LSIZE(bp));
- bzero(buf, sizeof (buf));
+ bzero(buf, SPA_MAXBLOCKSIZE);
(void) printf("%s<hole>\n", prefix);
- return;
+ goto exit;
}
if (bp->blk_birth < zilog->zl_header->zh_claim_txg) {
(void) printf("%s<block already committed>\n", prefix);
- return;
+ goto exit;
}
SET_BOOKMARK(&zb, dmu_objset_id(zilog->zl_os),
bp, buf, BP_GET_LSIZE(bp), NULL, NULL,
ZIO_PRIORITY_SYNC_READ, ZIO_FLAG_CANFAIL, &zb));
if (error)
- return;
+ goto exit;
data = buf;
} else {
data = (char *)(lr + 1);
data++;
}
(void) printf("\n");
+exit:
+ free(buf);
}
/* ARGSUSED */