FreeBSD ZFS
The Zettabyte File System

sys/metaslab_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 2009 Sun Microsystems, Inc.  All rights reserved.
00023  * Use is subject to license terms.
00024  * Copyright (c) 2011 by Delphix. All rights reserved.
00025  */
00026 
00027 #ifndef _SYS_METASLAB_IMPL_H
00028 #define _SYS_METASLAB_IMPL_H
00029 
00030 #include <sys/metaslab.h>
00031 #include <sys/space_map.h>
00032 #include <sys/vdev.h>
00033 #include <sys/txg.h>
00034 #include <sys/avl.h>
00035 
00036 #ifdef  __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 struct metaslab_class {
00041         spa_t                   *mc_spa;
00042         metaslab_group_t        *mc_rotor;
00043         space_map_ops_t         *mc_ops;
00044         uint64_t                mc_aliquot;
00045         uint64_t                mc_alloc;       
00046         uint64_t                mc_deferred;    
00047         uint64_t                mc_space;       
00048         uint64_t                mc_dspace;      
00049 };
00050 
00051 struct metaslab_group {
00052         kmutex_t                mg_lock;
00053         avl_tree_t              mg_metaslab_tree;
00054         uint64_t                mg_aliquot;
00055         uint64_t                mg_bonus_area;
00056         uint64_t                mg_alloc_failures;
00057         int64_t                 mg_bias;
00058         int64_t                 mg_activation_count;
00059         metaslab_class_t        *mg_class;
00060         vdev_t                  *mg_vd;
00061         metaslab_group_t        *mg_prev;
00062         metaslab_group_t        *mg_next;
00063 };
00064 
00072 struct metaslab {
00073         kmutex_t        ms_lock;        
00074         space_map_obj_t ms_smo;         
00075         space_map_obj_t ms_smo_syncing; 
00076         space_map_t     ms_allocmap[TXG_SIZE];  
00077         space_map_t     ms_freemap[TXG_SIZE];   
00078         space_map_t     ms_defermap[TXG_DEFER_SIZE]; 
00079         space_map_t     ms_map;         
00080         int64_t         ms_deferspace;  
00081         uint64_t        ms_weight;      
00082         metaslab_group_t *ms_group;     
00083         avl_node_t      ms_group_node;  
00084         txg_node_t      ms_txg_node;    
00085 };
00086 
00087 #ifdef  __cplusplus
00088 }
00089 #endif
00090 
00091 #endif  /* _SYS_METASLAB_IMPL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines