FreeBSD ZFS
The Zettabyte File System

sys/spa_impl.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
00023  * Copyright (c) 2012 by Delphix. All rights reserved.
00024  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
00025  */
00026 
00027 #ifndef _SYS_SPA_IMPL_H
00028 #define _SYS_SPA_IMPL_H
00029 
00030 #include <sys/spa.h>
00031 #include <sys/vdev.h>
00032 #include <sys/metaslab.h>
00033 #include <sys/dmu.h>
00034 #include <sys/dsl_pool.h>
00035 #include <sys/uberblock_impl.h>
00036 #include <sys/zfs_context.h>
00037 #include <sys/avl.h>
00038 #include <sys/refcount.h>
00039 #include <sys/bplist.h>
00040 #include <sys/bpobj.h>
00041 
00042 #ifdef  __cplusplus
00043 extern "C" {
00044 #endif
00045 
00046 typedef struct spa_error_entry {
00047         zbookmark_t     se_bookmark;
00048         char            *se_name;
00049         avl_node_t      se_avl;
00050 } spa_error_entry_t;
00051 
00052 typedef struct spa_history_phys {
00053         uint64_t sh_pool_create_len;    
00054         uint64_t sh_phys_max_off;       
00055         uint64_t sh_bof;                
00056         uint64_t sh_eof;                
00057         uint64_t sh_records_lost;       
00058 } spa_history_phys_t;
00059 
00060 struct spa_aux_vdev {
00061         uint64_t        sav_object;             
00062         nvlist_t        *sav_config;            
00063         vdev_t          **sav_vdevs;            
00064         int             sav_count;              
00065         boolean_t       sav_sync;               
00066         nvlist_t        **sav_pending;          
00067         uint_t          sav_npending;           
00068 };
00069 
00070 typedef struct spa_config_lock {
00071         kmutex_t        scl_lock;
00072         kthread_t       *scl_writer;
00073         int             scl_write_wanted;
00074         kcondvar_t      scl_cv;
00075         refcount_t      scl_count;
00076 } spa_config_lock_t;
00077 
00078 typedef struct spa_config_dirent {
00079         list_node_t     scd_link;
00080         char            *scd_path;
00081 } spa_config_dirent_t;
00082 
00083 enum zio_taskq_type {
00084         ZIO_TASKQ_ISSUE = 0,
00085         ZIO_TASKQ_ISSUE_HIGH,
00086         ZIO_TASKQ_INTERRUPT,
00087         ZIO_TASKQ_INTERRUPT_HIGH,
00088         ZIO_TASKQ_TYPES
00089 };
00090 
00104 typedef enum spa_proc_state {
00105         SPA_PROC_NONE,          
00106         SPA_PROC_CREATED,       
00107         SPA_PROC_ACTIVE,        
00108         SPA_PROC_DEACTIVATE,    
00109         SPA_PROC_GONE           
00110 } spa_proc_state_t;
00111 
00112 struct spa {
00117         char            spa_name[MAXNAMELEN];   
00118         char            *spa_comment;           
00119         avl_node_t      spa_avl;                
00120         nvlist_t        *spa_config;            
00121         nvlist_t        *spa_config_syncing;    
00122         nvlist_t        *spa_config_splitting;  
00123         nvlist_t        *spa_load_info;         
00124         uint64_t        spa_config_txg;         
00125         int             spa_sync_pass;          
00126         pool_state_t    spa_state;              
00127         int             spa_inject_ref;         
00128         uint8_t         spa_sync_on;            
00129         spa_load_state_t spa_load_state;        
00130         uint64_t        spa_import_flags;       
00131         taskq_t         *spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES];
00132         dsl_pool_t      *spa_dsl_pool;
00133         boolean_t       spa_is_initializing;    
00134         metaslab_class_t *spa_normal_class;     
00135         metaslab_class_t *spa_log_class;        
00136         uint64_t        spa_first_txg;          
00137         uint64_t        spa_final_txg;          
00138         uint64_t        spa_freeze_txg;         
00139         uint64_t        spa_load_max_txg;       
00140         uint64_t        spa_claim_max_txg;      
00141         timespec_t      spa_loaded_ts;          
00142         objset_t        *spa_meta_objset;       
00143         txg_list_t      spa_vdev_txg_list;      
00144         vdev_t          *spa_root_vdev;         
00145         uint64_t        spa_config_guid;        
00146         uint64_t        spa_load_guid;          
00147         uint64_t        spa_last_synced_guid;   
00148         list_t          spa_config_dirty_list;  
00149         list_t          spa_state_dirty_list;   
00150         spa_aux_vdev_t  spa_spares;             
00151         spa_aux_vdev_t  spa_l2cache;            
00152         nvlist_t        *spa_label_features;    
00153         uint64_t        spa_config_object;      
00154         uint64_t        spa_config_generation;  
00155         uint64_t        spa_syncing_txg;        
00156         bpobj_t         spa_deferred_bpobj;     
00157         bplist_t        spa_free_bplist[TXG_SIZE]; 
00158         uberblock_t     spa_ubsync;             
00159         uberblock_t     spa_uberblock;          
00160         boolean_t       spa_extreme_rewind;     
00161         uint64_t        spa_last_io;            
00162         kmutex_t        spa_scrub_lock;         
00163         uint64_t        spa_scrub_inflight;     
00164         kcondvar_t      spa_scrub_io_cv;        
00165         uint8_t         spa_scrub_active;       
00166         uint8_t         spa_scrub_type;         
00167         uint8_t         spa_scrub_finished;     
00168         uint8_t         spa_scrub_started;      
00169         uint8_t         spa_scrub_reopen;       
00170         uint64_t        spa_scan_pass_start;    
00171         uint64_t        spa_scan_pass_exam;     
00172         kmutex_t        spa_async_lock;         
00173         kthread_t       *spa_async_thread;      
00174         int             spa_async_suspended;    
00175         kcondvar_t      spa_async_cv;           
00176         uint16_t        spa_async_tasks;        
00177         char            *spa_root;              
00178         uint64_t        spa_ena;                
00179         int             spa_last_open_failed;   
00180         uint64_t        spa_last_ubsync_txg;    
00181         uint64_t        spa_last_ubsync_txg_ts; 
00182         uint64_t        spa_load_txg;           
00183         uint64_t        spa_load_txg_ts;        
00184         uint64_t        spa_load_meta_errors;   
00185         uint64_t        spa_load_data_errors;   
00186         uint64_t        spa_verify_min_txg;     
00187         kmutex_t        spa_errlog_lock;        
00188         uint64_t        spa_errlog_last;        
00189         uint64_t        spa_errlog_scrub;       
00190         kmutex_t        spa_errlist_lock;       
00191         avl_tree_t      spa_errlist_last;       
00192         avl_tree_t      spa_errlist_scrub;      
00193         uint64_t        spa_deflate;            
00194         uint64_t        spa_history;            
00195         kmutex_t        spa_history_lock;       
00196         vdev_t          *spa_pending_vdev;      
00197         kmutex_t        spa_props_lock;         
00198         uint64_t        spa_pool_props_object;  
00199         uint64_t        spa_bootfs;             
00200         uint64_t        spa_failmode;           
00201         uint64_t        spa_delegation;         
00202         list_t          spa_config_list;        
00203         zio_t           *spa_async_zio_root;    
00204         zio_t           *spa_suspend_zio_root;  
00205         kmutex_t        spa_suspend_lock;       
00206         kcondvar_t      spa_suspend_cv;         
00207         uint8_t         spa_suspended;          
00208         uint8_t         spa_claiming;           
00209         boolean_t       spa_debug;              
00210         boolean_t       spa_is_root;            
00211         int             spa_minref;             
00212         int             spa_mode;               
00213         spa_log_state_t spa_log_state;          
00214         uint64_t        spa_autoexpand;         
00215         ddt_t           *spa_ddt[ZIO_CHECKSUM_FUNCTIONS]; 
00216         uint64_t        spa_ddt_stat_object;    
00217         uint64_t        spa_dedup_ditto;        
00218         uint64_t        spa_dedup_checksum;     
00219         uint64_t        spa_dspace;             
00220         kmutex_t        spa_vdev_top_lock;      
00221         kmutex_t        spa_proc_lock;          
00222         kcondvar_t      spa_proc_cv;            
00223         spa_proc_state_t spa_proc_state;        
00224         struct proc     *spa_proc;              
00225         uint64_t        spa_did;                
00226         kthread_t       *spa_trim_thread;       
00227         kmutex_t        spa_trim_lock;          
00228         kcondvar_t      spa_trim_cv;            
00229         boolean_t       spa_autoreplace;        
00230         int             spa_vdev_locks;         
00231         uint64_t        spa_creation_version;   
00232         uint64_t        spa_prev_software_version; 
00233         uint64_t        spa_feat_for_write_obj; 
00234         uint64_t        spa_feat_for_read_obj;  
00235         uint64_t        spa_feat_desc_obj;      
00236         int64_t         spa_ccw_fail_time;      
00237         /*
00238          * spa_refcount & spa_config_lock must be the last elements
00239          * because refcount_t changes size based on compilation options.
00240          * In order for the MDB module to function correctly, the other
00241          * fields must remain in the same location.
00242          */
00243         spa_config_lock_t spa_config_lock[SCL_LOCKS]; 
00244         refcount_t      spa_refcount;           
00245 #ifndef sun
00246         boolean_t       spa_splitting_newspa;   
00247 #endif
00248 
00249 };
00250 
00251 extern const char *spa_config_path;
00252 
00253 #ifdef  __cplusplus
00254 }
00255 #endif
00256 
00257 #endif  /* _SYS_SPA_IMPL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines