dsl_pool.h revision fa9e4066f08beec538e775443c5be79dd423fcab
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER START
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * The contents of this file are subject to the terms of the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Common Development and Distribution License, Version 1.0 only
fa9e4066f08beec538e775443c5be79dd423fcabahrens * (the "License"). You may not use this file except in compliance
fa9e4066f08beec538e775443c5be79dd423fcabahrens * with the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens * or http://www.opensolaris.org/os/licensing.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * See the License for the specific language governing permissions
fa9e4066f08beec538e775443c5be79dd423fcabahrens * and limitations under the License.
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * When distributing Covered Code, include this CDDL HEADER in each
fa9e4066f08beec538e775443c5be79dd423fcabahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * If applicable, add the following below this CDDL HEADER, with the
fa9e4066f08beec538e775443c5be79dd423fcabahrens * fields enclosed by brackets "[]" replaced with your own identifying
fa9e4066f08beec538e775443c5be79dd423fcabahrens * information: Portions Copyright [yyyy] [name of copyright owner]
fa9e4066f08beec538e775443c5be79dd423fcabahrens *
fa9e4066f08beec538e775443c5be79dd423fcabahrens * CDDL HEADER END
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens/*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Use is subject to license terms.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifndef _SYS_DSL_POOL_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens#define _SYS_DSL_POOL_H
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#pragma ident "%Z%%M% %I% %E% SMI"
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/spa.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/txg.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/txg_impl.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens#include <sys/zfs_context.h>
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern "C" {
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct objset;
fa9e4066f08beec538e775443c5be79dd423fcabahrensstruct dsl_dir;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrenstypedef struct dsl_pool {
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* Immutable */
fa9e4066f08beec538e775443c5be79dd423fcabahrens spa_t *dp_spa;
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct objset *dp_meta_objset;
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct dsl_dir *dp_root_dir;
fa9e4066f08beec538e775443c5be79dd423fcabahrens struct dsl_dir *dp_mos_dir;
fa9e4066f08beec538e775443c5be79dd423fcabahrens uint64_t dp_root_dir_obj;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* No lock needed - sync context only */
fa9e4066f08beec538e775443c5be79dd423fcabahrens blkptr_t dp_meta_rootbp;
fa9e4066f08beec538e775443c5be79dd423fcabahrens list_t dp_synced_objsets;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens /* Has its own locking */
fa9e4066f08beec538e775443c5be79dd423fcabahrens tx_state_t dp_tx;
fa9e4066f08beec538e775443c5be79dd423fcabahrens txg_list_t dp_dirty_datasets;
fa9e4066f08beec538e775443c5be79dd423fcabahrens txg_list_t dp_dirty_dirs;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens /*
fa9e4066f08beec538e775443c5be79dd423fcabahrens * Protects administrative changes (properties, namespace)
fa9e4066f08beec538e775443c5be79dd423fcabahrens * It is only held for write in syncing context. Therefore
fa9e4066f08beec538e775443c5be79dd423fcabahrens * syncing context does not need to ever have it for read, since
fa9e4066f08beec538e775443c5be79dd423fcabahrens * nobody else could possibly have it for write.
fa9e4066f08beec538e775443c5be79dd423fcabahrens */
fa9e4066f08beec538e775443c5be79dd423fcabahrens krwlock_t dp_config_rwlock;
fa9e4066f08beec538e775443c5be79dd423fcabahrens} dsl_pool_t;
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrensdsl_pool_t *dsl_pool_open(spa_t *spa, uint64_t txg);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid dsl_pool_close(dsl_pool_t *dp);
fa9e4066f08beec538e775443c5be79dd423fcabahrensdsl_pool_t *dsl_pool_create(spa_t *spa, uint64_t txg);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid dsl_pool_sync(dsl_pool_t *dp, uint64_t txg);
fa9e4066f08beec538e775443c5be79dd423fcabahrensvoid dsl_pool_zil_clean(dsl_pool_t *dp);
fa9e4066f08beec538e775443c5be79dd423fcabahrensint dsl_pool_sync_context(dsl_pool_t *dp);
fa9e4066f08beec538e775443c5be79dd423fcabahrensuint64_t dsl_pool_adjustedsize(dsl_pool_t *dp, boolean_t netfree);
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#ifdef __cplusplus
fa9e4066f08beec538e775443c5be79dd423fcabahrens}
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif
fa9e4066f08beec538e775443c5be79dd423fcabahrens
fa9e4066f08beec538e775443c5be79dd423fcabahrens#endif /* _SYS_DSL_POOL_H */