FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
/*
 * Return an empty bpobj, preferably the empty dummy one (dp_empty_bpobj).
 */
Return an empty bpobj, preferably the empty dummy one (dp_empty_bpobj).
Return an empty bpobj preferably the empty dummy one ( dp_empty_bpobj ) .
uint64_t
bpobj_alloc_empty(objset_t *os, int blocksize, dmu_tx_t *tx)
{
	spa_t *spa = dmu_objset_spa(os);
	dsl_pool_t *dp = dmu_objset_pool(os);
	if (spa_feature_is_enabled(spa, SPA_FEATURE_EMPTY_BPOBJ)) {
		if (!spa_feature_is_active(spa, SPA_FEATURE_EMPTY_BPOBJ)) {
			ASSERT0(dp->dp_empty_bpobj);
			dp->dp_empty_bpobj =
			    bpobj_alloc(os, SPA_OLD_MAXBLOCKSIZE, tx);
			VERIFY(zap_add(os,
			    DMU_POOL_DIRECTORY_OBJECT,
			    DMU_POOL_EMPTY_BPOBJ, sizeof (uint64_t), 1,
			    &dp->dp_empty_bpobj, tx) == 0);
		}
		spa_feature_incr(spa, SPA_FEATURE_EMPTY_BPOBJ, tx);
		ASSERT(dp->dp_empty_bpobj != 0);
		return (dp->dp_empty_bpobj);
	} else {
		return (bpobj_alloc(os, blocksize, tx));
	}
}
uint64_t bpobj_alloc_empty ( objset_t * os , int blocksize , dmu_tx_t * tx ) { spa_t * spa = dmu_objset_spa ( os ) ; dsl_pool_t * dp = dmu_objset_pool ( os ) ; if ( spa_feature_is_enabled ( spa , SPA_FEATURE_EMPTY_BPOBJ ) ) { if ( ! spa_feature_is_active ( spa , SPA_FEATURE_EMPTY_BPOBJ ) ) { ASSERT0 ( dp -> dp_empty_bpobj ) ; dp -> dp_empty_bpobj = bpobj_alloc ( os , SPA_OLD_MAXBLOCKSIZE , tx ) ; VERIFY ( zap_add ( os , DMU_POOL_DIRECTORY_OBJECT , DMU_POOL_EMPTY_BPOBJ , sizeof ( uint64_t ) , 1 , & dp -> dp_empty_bpobj , tx ) == 0 ) ; } spa_feature_incr ( spa , SPA_FEATURE_EMPTY_BPOBJ , tx ) ; ASSERT ( dp -> dp_empty_bpobj != 0 ) ; return ( dp -> dp_empty_bpobj ) ; } else { return ( bpobj_alloc ( os , blocksize , tx ) ) ; } }
Return an empty bpobj, preferably the empty dummy one (dp_empty_bpobj).
Return an empty bpobj preferably the empty dummy one ( dp_empty_bpobj ) .