Print this page
3747 txg commit callbacks don't work
Submitted by:   Will Andrews <willa@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>


 400                 /* No need to lock tx_cpu_t at this point */
 401 
 402                 int g = txg & TXG_MASK;
 403 
 404                 if (list_is_empty(&tc->tc_callbacks[g]))
 405                         continue;
 406 
 407                 if (tx->tx_commit_cb_taskq == NULL) {
 408                         /*
 409                          * Commit callback taskq hasn't been created yet.
 410                          */
 411                         tx->tx_commit_cb_taskq = taskq_create("tx_commit_cb",
 412                             max_ncpus, minclsyspri, max_ncpus, max_ncpus * 2,
 413                             TASKQ_PREPOPULATE);
 414                 }
 415 
 416                 cb_list = kmem_alloc(sizeof (list_t), KM_SLEEP);
 417                 list_create(cb_list, sizeof (dmu_tx_callback_t),
 418                     offsetof(dmu_tx_callback_t, dcb_node));
 419 
 420                 list_move_tail(&tc->tc_callbacks[g], cb_list);
 421 
 422                 (void) taskq_dispatch(tx->tx_commit_cb_taskq, (task_func_t *)
 423                     txg_do_callbacks, cb_list, TQ_SLEEP);
 424         }
 425 }
 426 
 427 static void
 428 txg_sync_thread(dsl_pool_t *dp)
 429 {
 430         spa_t *spa = dp->dp_spa;
 431         tx_state_t *tx = &dp->dp_tx;
 432         callb_cpr_t cpr;
 433         uint64_t start, delta;
 434 
 435         txg_thread_enter(tx, &cpr);
 436 
 437         start = delta = 0;
 438         for (;;) {
 439                 uint64_t timer, timeout = zfs_txg_timeout * hz;
 440                 uint64_t txg;




 400                 /* No need to lock tx_cpu_t at this point */
 401 
 402                 int g = txg & TXG_MASK;
 403 
 404                 if (list_is_empty(&tc->tc_callbacks[g]))
 405                         continue;
 406 
 407                 if (tx->tx_commit_cb_taskq == NULL) {
 408                         /*
 409                          * Commit callback taskq hasn't been created yet.
 410                          */
 411                         tx->tx_commit_cb_taskq = taskq_create("tx_commit_cb",
 412                             max_ncpus, minclsyspri, max_ncpus, max_ncpus * 2,
 413                             TASKQ_PREPOPULATE);
 414                 }
 415 
 416                 cb_list = kmem_alloc(sizeof (list_t), KM_SLEEP);
 417                 list_create(cb_list, sizeof (dmu_tx_callback_t),
 418                     offsetof(dmu_tx_callback_t, dcb_node));
 419 
 420                 list_move_tail(cb_list, &tc->tc_callbacks[g]);
 421 
 422                 (void) taskq_dispatch(tx->tx_commit_cb_taskq, (task_func_t *)
 423                     txg_do_callbacks, cb_list, TQ_SLEEP);
 424         }
 425 }
 426 
 427 static void
 428 txg_sync_thread(dsl_pool_t *dp)
 429 {
 430         spa_t *spa = dp->dp_spa;
 431         tx_state_t *tx = &dp->dp_tx;
 432         callb_cpr_t cpr;
 433         uint64_t start, delta;
 434 
 435         txg_thread_enter(tx, &cpr);
 436 
 437         start = delta = 0;
 438         for (;;) {
 439                 uint64_t timer, timeout = zfs_txg_timeout * hz;
 440                 uint64_t txg;