diff options
author | George Wilson <[email protected]> | 2013-04-23 09:31:42 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2013-11-01 08:55:12 -0700 |
commit | 2696dfafd9ebce5e3aa227c630b13f2c5b26bce9 (patch) | |
tree | 9c1bd42bcdb8da5e7c20759e9f518092ff50330d /module/zfs/txg.c | |
parent | 7ec09286b761ee1fb85178ff55daaf8f74d935be (diff) |
Illumos #3642, #3643
3642 dsl_scan_active() should not issue I/O to determine if async
destroying is active
3643 txg_delay should not hold the tc_lock
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Adam Leventhal <[email protected]>
Approved by: Gordon Ross <[email protected]>
References:
https://www.illumos.org/issues/3642
https://www.illumos.org/issues/3643
illumos/illumos-gate@4a92375985c37d61406d66cd2b10ee642eb1f5e7
Ported-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #1775
Porting Notes:
1. The alignment assumptions for the tx_cpu structure assume that
a kmutex_t is 8 bytes. This isn't true under Linux but tc_pad[]
was adjusted anyway for consistency since this structure was
never carefully aligned in ZoL. If careful alignment does impact
performance significantly this should be reworked to be portable.
Diffstat (limited to 'module/zfs/txg.c')
-rw-r--r-- | module/zfs/txg.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 7a3da8647..c0c0b295a 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -127,6 +127,8 @@ txg_init(dsl_pool_t *dp, uint64_t txg) int i; mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL); + mutex_init(&tx->tx_cpu[c].tc_open_lock, NULL, MUTEX_DEFAULT, + NULL); for (i = 0; i < TXG_SIZE; i++) { cv_init(&tx->tx_cpu[c].tc_cv[i], NULL, CV_DEFAULT, NULL); @@ -169,6 +171,7 @@ txg_fini(dsl_pool_t *dp) for (c = 0; c < max_ncpus; c++) { int i; + mutex_destroy(&tx->tx_cpu[c].tc_open_lock); mutex_destroy(&tx->tx_cpu[c].tc_lock); for (i = 0; i < TXG_SIZE; i++) { cv_destroy(&tx->tx_cpu[c].tc_cv[i]); @@ -303,10 +306,12 @@ txg_hold_open(dsl_pool_t *dp, txg_handle_t *th) tc = &tx->tx_cpu[CPU_SEQID]; kpreempt_enable(); - mutex_enter(&tc->tc_lock); - + mutex_enter(&tc->tc_open_lock); txg = tx->tx_open_txg; + + mutex_enter(&tc->tc_lock); tc->tc_count[txg & TXG_MASK]++; + mutex_exit(&tc->tc_lock); th->th_cpu = tc; th->th_txg = txg; @@ -319,7 +324,8 @@ txg_rele_to_quiesce(txg_handle_t *th) { tx_cpu_t *tc = th->th_cpu; - mutex_exit(&tc->tc_lock); + ASSERT(!MUTEX_HELD(&tc->tc_lock)); + mutex_exit(&tc->tc_open_lock); } void @@ -356,10 +362,10 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg) int c; /* - * Grab all tx_cpu locks so nobody else can get into this txg. + * Grab all tc_open_locks so nobody else can get into this txg. */ for (c = 0; c < max_ncpus; c++) - mutex_enter(&tx->tx_cpu[c].tc_lock); + mutex_enter(&tx->tx_cpu[c].tc_open_lock); ASSERT(txg == tx->tx_open_txg); tx->tx_open_txg++; @@ -372,7 +378,7 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg) * enter the next transaction group. */ for (c = 0; c < max_ncpus; c++) - mutex_exit(&tx->tx_cpu[c].tc_lock); + mutex_exit(&tx->tx_cpu[c].tc_open_lock); /* * Quiesce the transaction group by waiting for everyone to txg_exit(). |