FreeBSD ZFS
The Zettabyte File System

sys/zil_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  */
00025 
00026 /* Portions Copyright 2010 Robert Milkowski */
00027 
00028 #ifndef _SYS_ZIL_IMPL_H
00029 #define _SYS_ZIL_IMPL_H
00030 
00031 #include <sys/zil.h>
00032 #include <sys/dmu_objset.h>
00033 
00034 #ifdef  __cplusplus
00035 extern "C" {
00036 #endif
00037 
00041 typedef struct lwb {
00042         zilog_t         *lwb_zilog;     
00043         blkptr_t        lwb_blk;        
00044         int             lwb_nused;      
00045         int             lwb_sz;         
00046         char            *lwb_buf;       
00047         zio_t           *lwb_zio;       
00048         dmu_tx_t        *lwb_tx;        
00049         uint64_t        lwb_max_txg;    
00050         list_node_t     lwb_node;       
00051 } lwb_t;
00052 
00056 typedef struct itxs {
00057         list_t          i_sync_list;    
00058         avl_tree_t      i_async_tree;   
00059 } itxs_t;
00060 
00061 typedef struct itxg {
00062         kmutex_t        itxg_lock;      
00063         uint64_t        itxg_txg;       
00064         uint64_t        itxg_sod;       
00065         itxs_t          *itxg_itxs;     
00066 } itxg_t;
00067 
00069 typedef struct itx_async_node {
00070         uint64_t        ia_foid;        
00071         list_t          ia_list;        
00072         avl_node_t      ia_node;        
00073 } itx_async_node_t;
00074 
00079 typedef struct zil_vdev_node {
00080         uint64_t        zv_vdev;        
00081         avl_node_t      zv_node;        
00082 } zil_vdev_node_t;
00083 
00084 #define ZIL_PREV_BLKS 16
00085 
00089 struct zilog {
00090         kmutex_t        zl_lock;        
00091         struct dsl_pool *zl_dmu_pool;   
00092         spa_t           *zl_spa;        
00093         const zil_header_t *zl_header;  
00094         objset_t        *zl_os;         
00095         zil_get_data_t  *zl_get_data;   
00096         zio_t           *zl_root_zio;   
00097         uint64_t        zl_lr_seq;      
00098         uint64_t        zl_commit_lr_seq; 
00099         uint64_t        zl_destroy_txg; 
00100         uint64_t        zl_replayed_seq[TXG_SIZE]; 
00101         uint64_t        zl_replaying_seq; 
00102         uint32_t        zl_suspend;     
00103         kcondvar_t      zl_cv_writer;   
00104         kcondvar_t      zl_cv_suspend;  
00105         uint8_t         zl_suspending;  
00106         uint8_t         zl_keep_first;  
00107         uint8_t         zl_replay;      
00108         uint8_t         zl_stop_sync;   
00109         uint8_t         zl_writer;      
00110         uint8_t         zl_logbias;     
00111         uint8_t         zl_sync;        
00112         int             zl_parse_error; 
00113         uint64_t        zl_parse_blk_seq; 
00114         uint64_t        zl_parse_lr_seq; 
00115         uint64_t        zl_parse_blk_count; 
00116         uint64_t        zl_parse_lr_count; 
00117         uint64_t        zl_next_batch;  
00118         uint64_t        zl_com_batch;   
00119         kcondvar_t      zl_cv_batch[2]; 
00120         itxg_t          zl_itxg[TXG_SIZE]; 
00121         list_t          zl_itx_commit_list; 
00122         uint64_t        zl_itx_list_sz; 
00123         uint64_t        zl_cur_used;    
00124         list_t          zl_lwb_list;    
00125         kmutex_t        zl_vdev_lock;   
00126         avl_tree_t      zl_vdev_tree;   
00127         taskq_t         *zl_clean_taskq; 
00128         avl_tree_t      zl_bp_tree;     
00129         clock_t         zl_replay_time; 
00130         uint64_t        zl_replay_blks; 
00131         zil_header_t    zl_old_header;  
00132         uint_t          zl_prev_blks[ZIL_PREV_BLKS]; 
00133         uint_t          zl_prev_rotor;  
00134         txg_node_t      zl_dirty_link;  
00135 };
00136 
00137 typedef struct zil_bp_node {
00138         dva_t           zn_dva;
00139         avl_node_t      zn_node;
00140 } zil_bp_node_t;
00141 
00142 #define ZIL_MAX_LOG_DATA (SPA_MAXBLOCKSIZE - sizeof (zil_chain_t) - \
00143     sizeof (lr_write_t))
00144 
00145 #ifdef  __cplusplus
00146 }
00147 #endif
00148 
00149 #endif  /* _SYS_ZIL_IMPL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines