aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/mmp.c
diff options
context:
space:
mode:
authorOlaf Faaland <[email protected]>2018-02-22 15:34:34 -0800
committerBrian Behlendorf <[email protected]>2018-02-22 15:34:34 -0800
commit7088545d0166aa05b2c783f18aa821d95a1f023d (patch)
tree18d65e20a458db4c8c67a2ddeb24ff12a83d4aef /module/zfs/mmp.c
parent0d398b25644ff1eb67141629bc6e5aead95edeba (diff)
Report duration and error in mmp_history entries
After an MMP write completes, update the relevant mmp_history entry with the time between submission and completion, and the error status of the write. [faaland1@toss3a zfs]$ cat /proc/spl/kstat/zfs/pool/multihost 39 0 0x01 100 8800 69147946270893 72723903122926 id txg timestamp error duration mmp_delay vdev_guid 10607 1166 1518985089 0 138301 637785455 4882... 10608 1166 1518985089 0 136154 635407747 1151... 10609 1166 1518985089 0 803618560 633048078 9740... 10610 1166 1518985090 0 144826 633048078 4882... 10611 1166 1518985090 0 164527 666187671 1151... Where duration = gethrtime_in_done_fn - gethrtime_at_submission, and error = zio->io_error. Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes #7190
Diffstat (limited to 'module/zfs/mmp.c')
-rw-r--r--module/zfs/mmp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
index cce6b77ce..2d740e025 100644
--- a/module/zfs/mmp.c
+++ b/module/zfs/mmp.c
@@ -135,6 +135,7 @@ mmp_init(spa_t *spa)
mutex_init(&mmp->mmp_thread_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&mmp->mmp_thread_cv, NULL, CV_DEFAULT, NULL);
mutex_init(&mmp->mmp_io_lock, NULL, MUTEX_DEFAULT, NULL);
+ mmp->mmp_kstat_id = 1;
}
void
@@ -244,7 +245,8 @@ mmp_write_done(zio_t *zio)
mmp_thread_t *mts = zio->io_private;
mutex_enter(&mts->mmp_io_lock);
- vd->vdev_mmp_pending = 0;
+ uint64_t mmp_kstat_id = vd->vdev_mmp_kstat_id;
+ hrtime_t mmp_write_duration = gethrtime() - vd->vdev_mmp_pending;
if (zio->io_error)
goto unlock;
@@ -278,9 +280,15 @@ mmp_write_done(zio_t *zio)
mts->mmp_last_write = gethrtime();
unlock:
+ vd->vdev_mmp_pending = 0;
+ vd->vdev_mmp_kstat_id = 0;
+
mutex_exit(&mts->mmp_io_lock);
spa_config_exit(spa, SCL_STATE, mmp_tag);
+ spa_mmp_history_set(spa, mmp_kstat_id, zio->io_error,
+ mmp_write_duration);
+
abd_free(zio->io_abd);
}
@@ -333,6 +341,7 @@ mmp_write_uberblock(spa_t *spa)
ub->ub_mmp_magic = MMP_MAGIC;
ub->ub_mmp_delay = mmp->mmp_delay;
vd->vdev_mmp_pending = gethrtime();
+ vd->vdev_mmp_kstat_id = mmp->mmp_kstat_id++;
zio_t *zio = zio_null(mmp->mmp_zio_root, spa, NULL, NULL, NULL, flags);
abd_t *ub_abd = abd_alloc_for_io(VDEV_UBERBLOCK_SIZE(vd), B_TRUE);
@@ -350,7 +359,7 @@ mmp_write_uberblock(spa_t *spa)
flags | ZIO_FLAG_DONT_PROPAGATE);
spa_mmp_history_add(ub->ub_txg, ub->ub_timestamp, ub->ub_mmp_delay, vd,
- label);
+ label, vd->vdev_mmp_kstat_id);
zio_nowait(zio);
}