Print this page
*** NO COMMENTS ***


 462 
 463                 /*
 464                  * Hand this txg off to the sync thread.
 465                  */
 466                 dprintf("quiesce done, handing off txg %llu\n", txg);
 467                 tx->tx_quiesced_txg = txg;
 468                 cv_broadcast(&tx->tx_sync_more_cv);
 469                 cv_broadcast(&tx->tx_quiesce_done_cv);
 470         }
 471 }
 472 
 473 /*
 474  * Delay this thread by 'ticks' if we are still in the open transaction
 475  * group and there is already a waiting txg quiesing or quiesced.  Abort
 476  * the delay if this txg stalls or enters the quiesing state.
 477  */
 478 void
 479 txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks)
 480 {
 481         tx_state_t *tx = &dp->dp_tx;
 482         int timeout = ddi_get_lbolt() + ticks;
 483 
 484         /* don't delay if this txg could transition to quiesing immediately */
 485         if (tx->tx_open_txg > txg ||
 486             tx->tx_syncing_txg == txg-1 || tx->tx_synced_txg == txg-1)
 487                 return;
 488 
 489         mutex_enter(&tx->tx_sync_lock);
 490         if (tx->tx_open_txg > txg || tx->tx_synced_txg == txg-1) {
 491                 mutex_exit(&tx->tx_sync_lock);
 492                 return;
 493         }
 494 
 495         while (ddi_get_lbolt() < timeout &&
 496             tx->tx_syncing_txg < txg-1 && !txg_stalled(dp))
 497                 (void) cv_timedwait(&tx->tx_quiesce_more_cv, &tx->tx_sync_lock,
 498                     timeout);
 499 
 500         mutex_exit(&tx->tx_sync_lock);
 501 }
 502 




 462 
 463                 /*
 464                  * Hand this txg off to the sync thread.
 465                  */
 466                 dprintf("quiesce done, handing off txg %llu\n", txg);
 467                 tx->tx_quiesced_txg = txg;
 468                 cv_broadcast(&tx->tx_sync_more_cv);
 469                 cv_broadcast(&tx->tx_quiesce_done_cv);
 470         }
 471 }
 472 
 473 /*
 474  * Delay this thread by 'ticks' if we are still in the open transaction
 475  * group and there is already a waiting txg quiesing or quiesced.  Abort
 476  * the delay if this txg stalls or enters the quiesing state.
 477  */
 478 void
 479 txg_delay(dsl_pool_t *dp, uint64_t txg, int ticks)
 480 {
 481         tx_state_t *tx = &dp->dp_tx;
 482         clock_t timeout = ddi_get_lbolt() + ticks;
 483 
 484         /* don't delay if this txg could transition to quiesing immediately */
 485         if (tx->tx_open_txg > txg ||
 486             tx->tx_syncing_txg == txg-1 || tx->tx_synced_txg == txg-1)
 487                 return;
 488 
 489         mutex_enter(&tx->tx_sync_lock);
 490         if (tx->tx_open_txg > txg || tx->tx_synced_txg == txg-1) {
 491                 mutex_exit(&tx->tx_sync_lock);
 492                 return;
 493         }
 494 
 495         while (ddi_get_lbolt() < timeout &&
 496             tx->tx_syncing_txg < txg-1 && !txg_stalled(dp))
 497                 (void) cv_timedwait(&tx->tx_quiesce_more_cv, &tx->tx_sync_lock,
 498                     timeout);
 499 
 500         mutex_exit(&tx->tx_sync_lock);
 501 }
 502