Skip to content

Commit

Permalink
Fixed missing cv_init() / cv_destroy() calls in space_map_load(), txg…
Browse files Browse the repository at this point in the history
…_init() and txg_fini().
  • Loading branch information
BjoKaSH committed Sep 1, 2012
1 parent 6b826d6 commit d3df144
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions usr/src/uts/common/fs/zfs/space_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
28 changes: 26 additions & 2 deletions usr/src/uts/common/fs/zfs/txg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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));

Expand Down

0 comments on commit d3df144

Please sign in to comment.