usr/src/uts/common/fs/zfs/dbuf.c
changeset 9396 f41cf682d0d3
parent 9299 8809e849f63e
child 9412 4aefd8704ce0
equal deleted inserted replaced
9395:2db090840cf7 9396:f41cf682d0d3
   327 	/* verify db->db_blkptr */
   327 	/* verify db->db_blkptr */
   328 	if (db->db_blkptr) {
   328 	if (db->db_blkptr) {
   329 		if (db->db_parent == dn->dn_dbuf) {
   329 		if (db->db_parent == dn->dn_dbuf) {
   330 			/* db is pointed to by the dnode */
   330 			/* db is pointed to by the dnode */
   331 			/* ASSERT3U(db->db_blkid, <, dn->dn_nblkptr); */
   331 			/* ASSERT3U(db->db_blkid, <, dn->dn_nblkptr); */
   332 			if (db->db.db_object == DMU_META_DNODE_OBJECT)
   332 			if (DMU_OBJECT_IS_SPECIAL(db->db.db_object))
   333 				ASSERT(db->db_parent == NULL);
   333 				ASSERT(db->db_parent == NULL);
   334 			else
   334 			else
   335 				ASSERT(db->db_parent != NULL);
   335 				ASSERT(db->db_parent != NULL);
   336 			ASSERT3P(db->db_blkptr, ==,
   336 			ASSERT3P(db->db_blkptr, ==,
   337 			    &dn->dn_phys->dn_blkptr[db->db_blkid]);
   337 			    &dn->dn_phys->dn_blkptr[db->db_blkid]);
   906 
   906 
   907 	/*
   907 	/*
   908 	 * Shouldn't dirty a regular buffer in syncing context.  Private
   908 	 * Shouldn't dirty a regular buffer in syncing context.  Private
   909 	 * objects may be dirtied in syncing context, but only if they
   909 	 * objects may be dirtied in syncing context, but only if they
   910 	 * were already pre-dirtied in open context.
   910 	 * were already pre-dirtied in open context.
   911 	 * XXX We may want to prohibit dirtying in syncing context even
       
   912 	 * if they did pre-dirty.
       
   913 	 */
   911 	 */
   914 	ASSERT(!dmu_tx_is_syncing(tx) ||
   912 	ASSERT(!dmu_tx_is_syncing(tx) ||
   915 	    BP_IS_HOLE(dn->dn_objset->os_rootbp) ||
   913 	    BP_IS_HOLE(dn->dn_objset->os_rootbp) ||
   916 	    dn->dn_object == DMU_META_DNODE_OBJECT ||
   914 	    DMU_OBJECT_IS_SPECIAL(dn->dn_object) ||
   917 	    dn->dn_objset->os_dsl_dataset == NULL ||
   915 	    dn->dn_objset->os_dsl_dataset == NULL);
   918 	    dsl_dir_is_private(dn->dn_objset->os_dsl_dataset->ds_dir));
       
   919 
       
   920 	/*
   916 	/*
   921 	 * We make this assert for private objects as well, but after we
   917 	 * We make this assert for private objects as well, but after we
   922 	 * check if we're already dirty.  They are allowed to re-dirty
   918 	 * check if we're already dirty.  They are allowed to re-dirty
   923 	 * in syncing context.
   919 	 * in syncing context.
   924 	 */
   920 	 */
   973 	}
   969 	}
   974 
   970 
   975 	/*
   971 	/*
   976 	 * Only valid if not already dirty.
   972 	 * Only valid if not already dirty.
   977 	 */
   973 	 */
   978 	ASSERT(dn->dn_dirtyctx == DN_UNDIRTIED || dn->dn_dirtyctx ==
   974 	ASSERT(dn->dn_object == 0 ||
       
   975 	    dn->dn_dirtyctx == DN_UNDIRTIED || dn->dn_dirtyctx ==
   979 	    (dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN));
   976 	    (dmu_tx_is_syncing(tx) ? DN_DIRTY_SYNC : DN_DIRTY_OPEN));
   980 
   977 
   981 	ASSERT3U(dn->dn_nlevels, >, db->db_level);
   978 	ASSERT3U(dn->dn_nlevels, >, db->db_level);
   982 	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
   979 	ASSERT((dn->dn_phys->dn_nlevels == 0 && db->db_level == 0) ||
   983 	    dn->dn_phys->dn_nlevels > db->db_level ||
   980 	    dn->dn_phys->dn_nlevels > db->db_level ||
   985 	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
   982 	    dn->dn_next_nlevels[(tx->tx_txg-1) & TXG_MASK] > db->db_level ||
   986 	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
   983 	    dn->dn_next_nlevels[(tx->tx_txg-2) & TXG_MASK] > db->db_level);
   987 
   984 
   988 	/*
   985 	/*
   989 	 * We should only be dirtying in syncing context if it's the
   986 	 * We should only be dirtying in syncing context if it's the
   990 	 * mos, a spa os, or we're initializing the os.  However, we are
   987 	 * mos or we're initializing the os or it's a special object.
   991 	 * allowed to dirty in syncing context provided we already
   988 	 * However, we are allowed to dirty in syncing context provided
   992 	 * dirtied it in open context.  Hence we must make this
   989 	 * we already dirtied it in open context.  Hence we must make
   993 	 * assertion only if we're not already dirty.
   990 	 * this assertion only if we're not already dirty.
   994 	 */
   991 	 */
   995 	ASSERT(!dmu_tx_is_syncing(tx) ||
   992 	ASSERT(!dmu_tx_is_syncing(tx) || DMU_OBJECT_IS_SPECIAL(dn->dn_object) ||
   996 	    os->os_dsl_dataset == NULL ||
   993 	    os->os_dsl_dataset == NULL || BP_IS_HOLE(os->os_rootbp));
   997 	    !dsl_dir_is_private(os->os_dsl_dataset->ds_dir) ||
       
   998 	    !BP_IS_HOLE(os->os_rootbp));
       
   999 	ASSERT(db->db.db_size != 0);
   994 	ASSERT(db->db.db_size != 0);
  1000 
   995 
  1001 	dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size);
   996 	dprintf_dbuf(db, "size=%llx\n", (u_longlong_t)db->db.db_size);
  1002 
   997 
  1003 	if (db->db_blkid != DB_BONUS_BLKID) {
   998 	if (db->db_blkid != DB_BONUS_BLKID) {