aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/spa_stats.c
diff options
context:
space:
mode:
authorCyril Plisko <[email protected]>2014-01-15 11:26:12 +0200
committerBrian Behlendorf <[email protected]>2014-01-23 13:31:51 -0800
commit01b738f457f2a406fb6b4b264fb7a947b9b9989b (patch)
tree6b31f68856959d4d499f365114ffdad79c172aeb /module/zfs/spa_stats.c
parent478d64fdaeb89c8f029f3dd1969447317eedaa6e (diff)
Call gethrtime() only once per new txg creation
When transitioning current open TXG into QUIESCE state and opening a new one txg_quiesce() calls gethrtime(): - to mark the birth time of the new TXG - to record the SPA txg history kstat - implicitely inside spa_txg_history_add() These timestamps are practically the same, so that the first one can be used instead of the other two. The only visible difference is that inside spa_txg_history_add() the time spent in kmem_zalloc() will be counted towards the opened TXG. Since at this point the new TXG already exists (tx->tx_open_txg has been already incremented) it is actually a correct accounting. In any case this extra work is only happening when spa_txg_history kstat is activated (i.e. zfs_txg_history > 0) and doesn't affect the normal processing in any way. Signed-off-by: Cyril Plisko <[email protected]> Issue #2075
Diffstat (limited to 'module/zfs/spa_stats.c')
-rw-r--r--module/zfs/spa_stats.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/module/zfs/spa_stats.c b/module/zfs/spa_stats.c
index 2576d867f..a94fecfe8 100644
--- a/module/zfs/spa_stats.c
+++ b/module/zfs/spa_stats.c
@@ -422,7 +422,7 @@ spa_txg_history_destroy(spa_t *spa)
* Add a new txg to historical record.
*/
void
-spa_txg_history_add(spa_t *spa, uint64_t txg)
+spa_txg_history_add(spa_t *spa, uint64_t txg, hrtime_t birth_time)
{
spa_stats_history_t *ssh = &spa->spa_stats.txg_history;
spa_txg_history_t *sth, *rm;
@@ -433,7 +433,7 @@ spa_txg_history_add(spa_t *spa, uint64_t txg)
sth = kmem_zalloc(sizeof (spa_txg_history_t), KM_PUSHPAGE);
sth->txg = txg;
sth->state = TXG_STATE_OPEN;
- sth->times[TXG_STATE_BIRTH] = gethrtime();
+ sth->times[TXG_STATE_BIRTH] = birth_time;
mutex_enter(&ssh->lock);