summaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_config.c
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2016-03-02 12:57:06 -0800
committerBrian Behlendorf <[email protected]>2016-03-08 17:43:33 -0800
commit272be6834c3989f13c51f65eba6ec1d776a0ad43 (patch)
tree20bd8c40b09f9f818106f1f1acf1ae5eed5ce433 /lib/libzfs/libzfs_config.c
parentc53fb0113cc372ed8df3c08f59f83cb3ceee849b (diff)
Fix zpool iostat bandwidth/ops calculation
print_vdev_stats() subtracts the old bandwidth/ops stats from the new stats to calculate the bandwidth/ops numbers in "zpool iostat". However when the TXG numbers change between stats, zpool_refresh_stats() will incorrectly assign a NULL to the old stats. This causes print_vdev_stats() to use zeroes for the old bandwidth/ops numbers, resulting in an inaccurate calculation. This fix allows the calculation to happen even when TXGs change. Signed-off-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #4387
Diffstat (limited to 'lib/libzfs/libzfs_config.c')
-rw-r--r--lib/libzfs/libzfs_config.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/libzfs/libzfs_config.c b/lib/libzfs/libzfs_config.c
index 9857ed985..849a13051 100644
--- a/lib/libzfs/libzfs_config.c
+++ b/lib/libzfs/libzfs_config.c
@@ -311,22 +311,10 @@ zpool_refresh_stats(zpool_handle_t *zhp, boolean_t *missing)
zhp->zpool_config_size = zc.zc_nvlist_dst_size;
if (zhp->zpool_config != NULL) {
- uint64_t oldtxg, newtxg;
-
- verify(nvlist_lookup_uint64(zhp->zpool_config,
- ZPOOL_CONFIG_POOL_TXG, &oldtxg) == 0);
- verify(nvlist_lookup_uint64(config,
- ZPOOL_CONFIG_POOL_TXG, &newtxg) == 0);
-
if (zhp->zpool_old_config != NULL)
nvlist_free(zhp->zpool_old_config);
- if (oldtxg != newtxg) {
- nvlist_free(zhp->zpool_config);
- zhp->zpool_old_config = NULL;
- } else {
- zhp->zpool_old_config = zhp->zpool_config;
- }
+ zhp->zpool_old_config = zhp->zpool_config;
}
zhp->zpool_config = config;