Print this page
3741 zfs needs better comments
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

@@ -335,10 +335,18 @@
         mutex_exit(&tc->tc_lock);
 
         th->th_cpu = NULL;      /* defensive */
 }
 
+/*
+ * Quiesce, v.: to render temporarily inactive or disabled
+ *
+ * Blocks until all transactions in the group are committed.
+ *
+ * On return, the transaction group has reached a stable state in which it can
+ * then be passed off to the syncing context.
+ */
 static void
 txg_quiesce(dsl_pool_t *dp, uint64_t txg)
 {
         tx_state_t *tx = &dp->dp_tx;
         int g = txg & TXG_MASK;

@@ -385,21 +393,27 @@
         kmem_free(cb_list, sizeof (list_t));
 }
 
 /*
  * Dispatch the commit callbacks registered on this txg to worker threads.
+ *
+ * If no callbacks are registered for a given TXG, nothing happens.
+ * This function creates a taskq for the associated pool, if needed.
  */
 static void
 txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg)
 {
         int c;
         tx_state_t *tx = &dp->dp_tx;
         list_t *cb_list;
 
         for (c = 0; c < max_ncpus; c++) {
                 tx_cpu_t *tc = &tx->tx_cpu[c];
-                /* No need to lock tx_cpu_t at this point */
+                /*
+                 * No need to lock tx_cpu_t at this point, since this can
+                 * only be called once a txg has been synced.
+                 */
 
                 int g = txg & TXG_MASK;
 
                 if (list_is_empty(&tc->tc_callbacks[g]))
                         continue;