diff --git a/usr/src/uts/common/fs/zfs/space_map.c b/usr/src/uts/common/fs/zfs/space_map.c index a15e5ff8..754535de 100644 --- a/usr/src/uts/common/fs/zfs/space_map.c +++ b/usr/src/uts/common/fs/zfs/space_map.c @@ -67,6 +67,8 @@ space_map_create(space_map_t *sm, uint64_t start, uint64_t size, uint8_t shift, sm->sm_size = size; sm->sm_shift = shift; sm->sm_lock = lp; + + cv_init(&sm->sm_load_cv, NULL, CV_DEFAULT, NULL); } void @@ -75,6 +77,8 @@ space_map_destroy(space_map_t *sm) ASSERT(!sm->sm_loaded && !sm->sm_loading); VERIFY3U(sm->sm_space, ==, 0); avl_destroy(&sm->sm_root); + + cv_destroy(&sm->sm_load_cv); } void diff --git a/usr/src/uts/common/fs/zfs/txg.c b/usr/src/uts/common/fs/zfs/txg.c index 70f24c90..f6c5e192 100644 --- a/usr/src/uts/common/fs/zfs/txg.c +++ b/usr/src/uts/common/fs/zfs/txg.c @@ -53,12 +53,24 @@ txg_init(dsl_pool_t *dp, uint64_t txg) tx->tx_cpu = kmem_zalloc(max_ncpus * sizeof (tx_cpu_t), KM_SLEEP); - for (c = 0; c < max_ncpus; c++) + for (c = 0; c < max_ncpus; c++) { mutex_init(&tx->tx_cpu[c].tc_lock, NULL, MUTEX_DEFAULT, NULL); + int cv; + for (cv=0; cv < TXG_SIZE; cv++) { + cv_init(&tx->tx_cpu[c].tc_cv[cv], NULL, CV_DEFAULT, NULL); + } + } rw_init(&tx->tx_suspend, NULL, RW_DEFAULT, NULL); mutex_init(&tx->tx_sync_lock, NULL, MUTEX_DEFAULT, NULL); + cv_init(&tx->tx_sync_more_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_sync_done_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_quiesce_more_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_quiesce_done_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_timeout_exit_cv, NULL, CV_DEFAULT, NULL); + cv_init(&tx->tx_exit_cv, NULL, CV_DEFAULT, NULL); + tx->tx_open_txg = txg; } @@ -76,8 +88,20 @@ txg_fini(dsl_pool_t *dp) rw_destroy(&tx->tx_suspend); mutex_destroy(&tx->tx_sync_lock); - for (c = 0; c < max_ncpus; c++) + cv_destroy(&tx->tx_sync_more_cv); + cv_destroy(&tx->tx_sync_done_cv); + cv_destroy(&tx->tx_quiesce_more_cv); + cv_destroy(&tx->tx_quiesce_done_cv); + cv_destroy(&tx->tx_timeout_exit_cv); + cv_destroy(&tx->tx_exit_cv); + + for (c = 0; c < max_ncpus; c++) { mutex_destroy(&tx->tx_cpu[c].tc_lock); + int cv; + for (cv=0; cv < TXG_SIZE; cv++) { + cv_destroy(&tx->tx_cpu[c].tc_cv[cv]); + } + } kmem_free(tx->tx_cpu, max_ncpus * sizeof (tx_cpu_t));