Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrens committed Aug 24, 2020
1 parent 7893250 commit 70881af
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions module/zfs/vdev_raidz.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static void
vdev_raidz_cksum_finish(zio_cksum_report_t *zcr, const abd_t *good_data)
{
raidz_map_t *rm = zcr->zcr_cbdata;
zfs_dbgmsg("checksum error on rm=%p", rm);
zfs_dbgmsg("checksum error on rm=%llx", rm);

if (good_data == NULL) {
zfs_ereport_finish_checksum(zcr, NULL, NULL, B_FALSE);
Expand Down Expand Up @@ -583,7 +583,7 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset,
rm->rm_nskip = roundup(tot, nparity + 1) - tot;
asize = 0;

zfs_dbgmsg("rm=%p s=%d q=%d r=%d bc=%d nrows=%d cols=%d rfo=%llx",
zfs_dbgmsg("rm=%llx s=%d q=%d r=%d bc=%d nrows=%d cols=%d rfo=%llx",
rm, (int)s, (int)q, (int)r, (int)bc, (int)rows, (int)cols,
(long long)reflow_offset);

Expand Down Expand Up @@ -666,7 +666,7 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset,
off = r * rows +
(dc - r) * (rows - 1) + row;
}
zfs_dbgmsg("rm=%p row=%d c=%d dc=%d off=%u "
zfs_dbgmsg("rm=%llx row=%d c=%d dc=%d off=%u "
"devidx=%u rpc=%u",
rm, (int)row, (int)c, (int)dc, (int)off,
(int)child_id, (int)row_phys_cols);
Expand Down Expand Up @@ -1060,7 +1060,7 @@ vdev_raidz_reconstruct_p(raidz_row_t *rr, int *tgts, int ntgts)
int x = tgts[0];
abd_t *dst, *src;

zfs_dbgmsg("reconstruct_p(rm=%p x=%u)",
zfs_dbgmsg("reconstruct_p(rm=%llx x=%u)",
rr, x);

ASSERT3U(ntgts, ==, 1);
Expand Down Expand Up @@ -1098,7 +1098,7 @@ vdev_raidz_reconstruct_q(raidz_row_t *rr, int *tgts, int ntgts)
int c, exp;
abd_t *dst, *src;

zfs_dbgmsg("reconstruct_q(rm=%p x=%u)",
zfs_dbgmsg("reconstruct_q(rm=%llx x=%u)",
rr, x);

ASSERT(ntgts == 1);
Expand Down Expand Up @@ -1149,7 +1149,7 @@ vdev_raidz_reconstruct_pq(raidz_row_t *rr, int *tgts, int ntgts)
int y = tgts[1];
abd_t *xd, *yd;

zfs_dbgmsg("reconstruct_pq(rm=%p x=%u y=%u)",
zfs_dbgmsg("reconstruct_pq(rm=%llx x=%u y=%u)",
rr, x, y);

ASSERT(ntgts == 2);
Expand Down Expand Up @@ -1596,7 +1596,7 @@ vdev_raidz_reconstruct_general(raidz_row_t *rr, int *tgts, int ntgts)
int missing_rows[VDEV_RAIDZ_MAXPARITY];
int parity_map[VDEV_RAIDZ_MAXPARITY];

zfs_dbgmsg("reconstruct_general(rm=%p ntgts=%u)",
zfs_dbgmsg("reconstruct_general(rm=%llx ntgts=%u)",
rr, ntgts);
uint8_t *p, *pp;
size_t psize;
Expand Down Expand Up @@ -1743,16 +1743,16 @@ vdev_raidz_reconstruct_row(raidz_map_t *rm, raidz_row_t *rr,
int nbadparity, nbaddata;
int parity_valid[VDEV_RAIDZ_MAXPARITY];

zfs_dbgmsg("reconstruct(rm=%p nt=%u cols=%u md=%u mp=%u)",
zfs_dbgmsg("reconstruct(rm=%llx nt=%u cols=%u md=%u mp=%u)",
rr, nt, (int)rr->rr_cols, (int)rr->rr_missingdata,
(int)rr->rr_missingparity);

/*
* The tgts list must already be sorted.
*/
zfs_dbgmsg("reconstruct(rm=%p t[%u]=%u)", rr, 0, t[0]);
zfs_dbgmsg("reconstruct(rm=%llx t[%u]=%u)", rr, 0, t[0]);
for (i = 1; i < nt; i++) {
zfs_dbgmsg("reconstruct(rm=%p t[%u]=%u)",
zfs_dbgmsg("reconstruct(rm=%llx t[%u]=%u)",
rr, i, t[i]);
ASSERT(t[i] > t[i - 1]);
}
Expand All @@ -1761,7 +1761,7 @@ vdev_raidz_reconstruct_row(raidz_map_t *rm, raidz_row_t *rr,
nbaddata = rr->rr_cols - nbadparity;
ntgts = 0;
for (i = 0, c = 0; c < rr->rr_cols; c++) {
zfs_dbgmsg("reconstruct(rm=%p col=%u devid=%u "
zfs_dbgmsg("reconstruct(rm=%llx col=%u devid=%u "
"offset=%llx error=%u)",
rr, c,
(int)rr->rr_col[c].rc_devidx,
Expand Down Expand Up @@ -1888,13 +1888,20 @@ vdev_raidz_asize(vdev_t *vd, uint64_t psize)
vdev_raidz_t *vdrz = vd->vdev_tsd;
uint64_t asize;
uint64_t ashift = vd->vdev_top->vdev_ashift;
/* XXX if this is a new write, need to use new logical width */
uint64_t cols = vdrz->vd_original_width;
uint64_t nparity = vdrz->vd_nparity;

asize = ((psize - 1) >> ashift) + 1;
asize += nparity * ((asize + cols - nparity - 1) / (cols - nparity));
asize = roundup(asize, nparity + 1) << ashift;

uint64_t asize_new = ((psize - 1) >> ashift) + 1;
uint64_t ncols_new = vdrz->vd_physical_width;
asize_new += nparity * ((asize_new + cols - nparity - 1) / (cols - nparity));
asize_new = roundup(asize_new, nparity + 1) << ashift;
VERIFY3U(asize_new, <=, asize);

return (asize);
}

Expand Down Expand Up @@ -2080,7 +2087,12 @@ vdev_raidz_io_start(zio_t *zio)
raidz_map_t *rm;

uint64_t logical_width = vdev_raidz_get_logical_width(vdrz, zio);
zfs_dbgmsg("phys_birth=%llu logical_width=%llu",
zfs_dbgmsg("zio=%llx bm=%llu/%llu/%llu/%llu phys_birth=%llu logical_width=%llu",
zio,
zio->io_bookmark.zb_objset,
zio->io_bookmark.zb_object,
zio->io_bookmark.zb_level,
zio->io_bookmark.zb_blkid,
BP_PHYSICAL_BIRTH(zio->io_bp),
logical_width);
if (logical_width != vdrz->vd_physical_width) {
Expand Down Expand Up @@ -2415,7 +2427,7 @@ raidz_reconstruct(zio_t *zio, int *ltgts, int ntgts)
raidz_map_t *rm = zio->io_vsd;
vdev_raidz_t *vdrz = zio->io_vd->vdev_tsd;

zfs_dbgmsg("raidz_reconstruct_expanded(zio=%p ltgts=%u,%u,%u ntgts=%u",
zfs_dbgmsg("raidz_reconstruct_expanded(zio=%llx ltgts=%u,%u,%u ntgts=%u",
zio, ltgts[0], ltgts[1], ltgts[2], ntgts);

/* Reconstruct each row */
Expand Down Expand Up @@ -2520,7 +2532,7 @@ raidz_reconstruct(zio_t *zio, int *ltgts, int ntgts)

/* Reconstruction failed - restore original data */
raidz_restore_orig_data(rm);
zfs_dbgmsg("raidz_reconstruct_expanded(zio=%p) checksum failed",
zfs_dbgmsg("raidz_reconstruct_expanded(zio=%llx) checksum failed",
zio);
return (ECKSUM);
}
Expand Down

0 comments on commit 70881af

Please sign in to comment.