FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
/*
 * Remove an entry from the hash table.  It must be in the EVICTING state.
 */
Remove an entry from the hash table.  It must be in the EVICTING state.
Remove an entry from the hash table . It must be in the EVICTING state .
static void
dbuf_hash_remove(dmu_buf_impl_t *db)
{
	dbuf_hash_table_t *h = &dbuf_hash_table;
	uint64_t hv = DBUF_HASH(db->db_objset, db->db.db_object,
	    db->db_level, db->db_blkid);
	uint64_t idx = hv & h->hash_table_mask;
	dmu_buf_impl_t *dbf, **dbp;
	ASSERT(refcount_is_zero(&db->db_holds));
	ASSERT(db->db_state == DB_EVICTING);
	ASSERT(!MUTEX_HELD(&db->db_mtx));
	mutex_enter(DBUF_HASH_MUTEX(h, idx));
	dbp = &h->hash_table[idx];
	while ((dbf = *dbp) != db) {
		dbp = &dbf->db_hash_next;
		ASSERT(dbf != NULL);
	}
	*dbp = db->db_hash_next;
	db->db_hash_next = NULL;
	mutex_exit(DBUF_HASH_MUTEX(h, idx));
	atomic_dec_64(&dbuf_hash_count);
}
static void dbuf_hash_remove ( dmu_buf_impl_t * db ) { dbuf_hash_table_t * h = & dbuf_hash_table ; uint64_t hv = DBUF_HASH ( db -> db_objset , db -> db . db_object , db -> db_level , db -> db_blkid ) ; uint64_t idx = hv & h -> hash_table_mask ; dmu_buf_impl_t * dbf , * * dbp ; ASSERT ( refcount_is_zero ( & db -> db_holds ) ) ; ASSERT ( db -> db_state == DB_EVICTING ) ; ASSERT ( ! MUTEX_HELD ( & db -> db_mtx ) ) ; mutex_enter ( DBUF_HASH_MUTEX ( h , idx ) ) ; dbp = & h -> hash_table [ idx ] ; while ( ( dbf = * dbp ) != db ) { dbp = & dbf -> db_hash_next ; ASSERT ( dbf != NULL ) ; } * dbp = db -> db_hash_next ; db -> db_hash_next = NULL ; mutex_exit ( DBUF_HASH_MUTEX ( h , idx ) ) ; atomic_dec_64 ( & dbuf_hash_count ) ; }
Remove an entry from the hash table.
Remove an entry from the hash table .
/*
	 * We musn't hold db_mtx to maintain lock ordering:
	 * DBUF_HASH_MUTEX > db_mtx.
	 */