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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dmu_tx.c
          +++ new/usr/src/uts/common/fs/zfs/dmu_tx.c
↓ open down ↓ 1006 lines elided ↑ open up ↑
1007 1007  static void
1008 1008  dmu_tx_unassign(dmu_tx_t *tx)
1009 1009  {
1010 1010          dmu_tx_hold_t *txh;
1011 1011  
1012 1012          if (tx->tx_txg == 0)
1013 1013                  return;
1014 1014  
1015 1015          txg_rele_to_quiesce(&tx->tx_txgh);
1016 1016  
     1017 +        /*
     1018 +         * Walk the transaction's hold list, removing the hold on the
     1019 +         * associated dnode, and notifying waiters if the refcount drops to 0.
     1020 +         */
1017 1021          for (txh = list_head(&tx->tx_holds); txh != tx->tx_needassign_txh;
1018 1022              txh = list_next(&tx->tx_holds, txh)) {
1019 1023                  dnode_t *dn = txh->txh_dnode;
1020 1024  
1021 1025                  if (dn == NULL)
1022 1026                          continue;
1023 1027                  mutex_enter(&dn->dn_mtx);
1024 1028                  ASSERT3U(dn->dn_assigned_txg, ==, tx->tx_txg);
1025 1029  
1026 1030                  if (refcount_remove(&dn->dn_tx_holds, tx) == 0) {
↓ open down ↓ 92 lines elided ↑ open up ↑
1119 1123  #endif
1120 1124  }
1121 1125  
1122 1126  void
1123 1127  dmu_tx_commit(dmu_tx_t *tx)
1124 1128  {
1125 1129          dmu_tx_hold_t *txh;
1126 1130  
1127 1131          ASSERT(tx->tx_txg != 0);
1128 1132  
     1133 +        /*
     1134 +         * Go through the transaction's hold list and remove holds on
     1135 +         * associated dnodes, notifying waiters if no holds remain.
     1136 +         */
1129 1137          while (txh = list_head(&tx->tx_holds)) {
1130 1138                  dnode_t *dn = txh->txh_dnode;
1131 1139  
1132 1140                  list_remove(&tx->tx_holds, txh);
1133 1141                  kmem_free(txh, sizeof (dmu_tx_hold_t));
1134 1142                  if (dn == NULL)
1135 1143                          continue;
1136 1144                  mutex_enter(&dn->dn_mtx);
1137 1145                  ASSERT3U(dn->dn_assigned_txg, ==, tx->tx_txg);
1138 1146  
↓ open down ↓ 254 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX