3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2011 by Delphix. All rights reserved.
24 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 #ifndef _SYS_SPA_IMPL_H
28 #define _SYS_SPA_IMPL_H
29
30 #include <sys/spa.h>
31 #include <sys/vdev.h>
32 #include <sys/metaslab.h>
33 #include <sys/dmu.h>
34 #include <sys/dsl_pool.h>
35 #include <sys/uberblock_impl.h>
36 #include <sys/zfs_context.h>
37 #include <sys/avl.h>
38 #include <sys/refcount.h>
39 #include <sys/bplist.h>
40 #include <sys/bpobj.h>
41
42 #ifdef __cplusplus
95 * From To Routine
96 * PROC_NONE -> PROC_CREATED spa_activate()
97 * PROC_CREATED -> PROC_ACTIVE spa_thread()
98 * PROC_ACTIVE -> PROC_DEACTIVATE spa_deactivate()
99 * PROC_DEACTIVATE -> PROC_GONE spa_thread()
100 * PROC_GONE -> PROC_NONE spa_deactivate()
101 */
102 typedef enum spa_proc_state {
103 SPA_PROC_NONE, /* spa_proc = &p0, no process created */
104 SPA_PROC_CREATED, /* spa_activate() has proc, is waiting */
105 SPA_PROC_ACTIVE, /* taskqs created, spa_proc set */
106 SPA_PROC_DEACTIVATE, /* spa_deactivate() requests process exit */
107 SPA_PROC_GONE /* spa_thread() is exiting, spa_proc = &p0 */
108 } spa_proc_state_t;
109
110 struct spa {
111 /*
112 * Fields protected by spa_namespace_lock.
113 */
114 char spa_name[MAXNAMELEN]; /* pool name */
115 avl_node_t spa_avl; /* node in spa_namespace_avl */
116 nvlist_t *spa_config; /* last synced config */
117 nvlist_t *spa_config_syncing; /* currently syncing config */
118 nvlist_t *spa_config_splitting; /* config for splitting */
119 nvlist_t *spa_load_info; /* info and errors from load */
120 uint64_t spa_config_txg; /* txg of last config change */
121 int spa_sync_pass; /* iterate-to-convergence */
122 pool_state_t spa_state; /* pool state */
123 int spa_inject_ref; /* injection references */
124 uint8_t spa_sync_on; /* sync threads are running */
125 spa_load_state_t spa_load_state; /* current load operation */
126 uint64_t spa_import_flags; /* import specific flags */
127 taskq_t *spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
128 dsl_pool_t *spa_dsl_pool;
129 metaslab_class_t *spa_normal_class; /* normal data class */
130 metaslab_class_t *spa_log_class; /* intent log data class */
131 uint64_t spa_first_txg; /* first txg after spa_open() */
132 uint64_t spa_final_txg; /* txg of export/destroy */
133 uint64_t spa_freeze_txg; /* freeze pool at this txg */
134 uint64_t spa_load_max_txg; /* best initial ub_txg */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2011 by Delphix. All rights reserved.
25 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SYS_SPA_IMPL_H
29 #define _SYS_SPA_IMPL_H
30
31 #include <sys/spa.h>
32 #include <sys/vdev.h>
33 #include <sys/metaslab.h>
34 #include <sys/dmu.h>
35 #include <sys/dsl_pool.h>
36 #include <sys/uberblock_impl.h>
37 #include <sys/zfs_context.h>
38 #include <sys/avl.h>
39 #include <sys/refcount.h>
40 #include <sys/bplist.h>
41 #include <sys/bpobj.h>
42
43 #ifdef __cplusplus
96 * From To Routine
97 * PROC_NONE -> PROC_CREATED spa_activate()
98 * PROC_CREATED -> PROC_ACTIVE spa_thread()
99 * PROC_ACTIVE -> PROC_DEACTIVATE spa_deactivate()
100 * PROC_DEACTIVATE -> PROC_GONE spa_thread()
101 * PROC_GONE -> PROC_NONE spa_deactivate()
102 */
103 typedef enum spa_proc_state {
104 SPA_PROC_NONE, /* spa_proc = &p0, no process created */
105 SPA_PROC_CREATED, /* spa_activate() has proc, is waiting */
106 SPA_PROC_ACTIVE, /* taskqs created, spa_proc set */
107 SPA_PROC_DEACTIVATE, /* spa_deactivate() requests process exit */
108 SPA_PROC_GONE /* spa_thread() is exiting, spa_proc = &p0 */
109 } spa_proc_state_t;
110
111 struct spa {
112 /*
113 * Fields protected by spa_namespace_lock.
114 */
115 char spa_name[MAXNAMELEN]; /* pool name */
116 char *spa_comment; /* comment */
117 avl_node_t spa_avl; /* node in spa_namespace_avl */
118 nvlist_t *spa_config; /* last synced config */
119 nvlist_t *spa_config_syncing; /* currently syncing config */
120 nvlist_t *spa_config_splitting; /* config for splitting */
121 nvlist_t *spa_load_info; /* info and errors from load */
122 uint64_t spa_config_txg; /* txg of last config change */
123 int spa_sync_pass; /* iterate-to-convergence */
124 pool_state_t spa_state; /* pool state */
125 int spa_inject_ref; /* injection references */
126 uint8_t spa_sync_on; /* sync threads are running */
127 spa_load_state_t spa_load_state; /* current load operation */
128 uint64_t spa_import_flags; /* import specific flags */
129 taskq_t *spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
130 dsl_pool_t *spa_dsl_pool;
131 metaslab_class_t *spa_normal_class; /* normal data class */
132 metaslab_class_t *spa_log_class; /* intent log data class */
133 uint64_t spa_first_txg; /* first txg after spa_open() */
134 uint64_t spa_final_txg; /* txg of export/destroy */
135 uint64_t spa_freeze_txg; /* freeze pool at this txg */
136 uint64_t spa_load_max_txg; /* best initial ub_txg */
|