Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dbuf.c
          +++ new/usr/src/uts/common/fs/zfs/dbuf.c
↓ open down ↓ 167 lines elided ↑ open up ↑
 168  168                                  return (dbf);
 169  169                          }
 170  170                          mutex_exit(&dbf->db_mtx);
 171  171                  }
 172  172          }
 173  173  
 174  174          mutex_enter(&db->db_mtx);
 175  175          db->db_hash_next = h->hash_table[idx];
 176  176          h->hash_table[idx] = db;
 177  177          mutex_exit(DBUF_HASH_MUTEX(h, idx));
 178      -        atomic_add_64(&dbuf_hash_count, 1);
      178 +        atomic_inc_64(&dbuf_hash_count);
 179  179  
 180  180          return (NULL);
 181  181  }
 182  182  
 183  183  /*
 184  184   * Remove an entry from the hash table.  This operation will
 185  185   * fail if there are any existing holds on the db.
 186  186   */
 187  187  static void
 188  188  dbuf_hash_remove(dmu_buf_impl_t *db)
↓ open down ↓ 14 lines elided ↑ open up ↑
 203  203  
 204  204          mutex_enter(DBUF_HASH_MUTEX(h, idx));
 205  205          dbp = &h->hash_table[idx];
 206  206          while ((dbf = *dbp) != db) {
 207  207                  dbp = &dbf->db_hash_next;
 208  208                  ASSERT(dbf != NULL);
 209  209          }
 210  210          *dbp = db->db_hash_next;
 211  211          db->db_hash_next = NULL;
 212  212          mutex_exit(DBUF_HASH_MUTEX(h, idx));
 213      -        atomic_add_64(&dbuf_hash_count, -1);
      213 +        atomic_dec_64(&dbuf_hash_count);
 214  214  }
 215  215  
 216  216  static arc_evict_func_t dbuf_do_evict;
 217  217  
 218  218  static void
 219  219  dbuf_evict_user(dmu_buf_impl_t *db)
 220  220  {
 221  221          ASSERT(MUTEX_HELD(&db->db_mtx));
 222  222  
 223  223          if (db->db_level != 0 || db->db_evict_func == NULL)
↓ open down ↓ 2603 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX