HomeFreeBSD

Call gethrtime() only once per new txg creation

Description

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 <cyril.plisko@mountall.com>
Issue #2075

Details

Provenance
Cyril Plisko <cyril.plisko@mountall.com>Authored on Jan 15 2014, 9:26 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jan 23 2014, 9:31 PM
Parents
rG478d64fdaeb8: Add additional state TXG_STATE_WAIT_FOR_SYNC for txg.
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG01b738f457f2: Call gethrtime() only once per new txg creation (authored by Cyril Plisko <cyril.plisko@mountall.com>).Jan 23 2014, 9:31 PM