FreeBSD ZFS
The Zettabyte File System

sys/metaslab.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) 2011 by Delphix. All rights reserved.
00024  */
00025 
00026 #ifndef _SYS_METASLAB_H
00027 #define _SYS_METASLAB_H
00028 
00029 #include <sys/spa.h>
00030 #include <sys/space_map.h>
00031 #include <sys/txg.h>
00032 #include <sys/zio.h>
00033 #include <sys/avl.h>
00034 
00035 #ifdef  __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 extern space_map_ops_t *zfs_metaslab_ops;
00040 
00041 extern metaslab_t *metaslab_init(metaslab_group_t *mg, space_map_obj_t *smo,
00042     uint64_t start, uint64_t size, uint64_t txg);
00043 extern void metaslab_fini(metaslab_t *msp);
00044 extern void metaslab_sync(metaslab_t *msp, uint64_t txg);
00045 extern void metaslab_sync_done(metaslab_t *msp, uint64_t txg);
00046 extern void metaslab_sync_reassess(metaslab_group_t *mg);
00047 
00048 #define METASLAB_HINTBP_FAVOR   0x0
00049 #define METASLAB_HINTBP_AVOID   0x1
00050 #define METASLAB_GANG_HEADER    0x2
00051 #define METASLAB_GANG_CHILD     0x4
00052 #define METASLAB_GANG_AVOID     0x8
00053 
00054 extern int metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize,
00055     blkptr_t *bp, int ncopies, uint64_t txg, blkptr_t *hintbp, int flags);
00056 extern void metaslab_free(spa_t *spa, const blkptr_t *bp, uint64_t txg,
00057     boolean_t now);
00058 extern int metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg);
00059 
00060 extern metaslab_class_t *metaslab_class_create(spa_t *spa,
00061     space_map_ops_t *ops);
00062 extern void metaslab_class_destroy(metaslab_class_t *mc);
00063 extern int metaslab_class_validate(metaslab_class_t *mc);
00064 
00065 extern void metaslab_class_space_update(metaslab_class_t *mc,
00066     int64_t alloc_delta, int64_t defer_delta,
00067     int64_t space_delta, int64_t dspace_delta);
00068 extern uint64_t metaslab_class_get_alloc(metaslab_class_t *mc);
00069 extern uint64_t metaslab_class_get_space(metaslab_class_t *mc);
00070 extern uint64_t metaslab_class_get_dspace(metaslab_class_t *mc);
00071 extern uint64_t metaslab_class_get_deferred(metaslab_class_t *mc);
00072 
00073 extern metaslab_group_t *metaslab_group_create(metaslab_class_t *mc,
00074     vdev_t *vd);
00075 extern void metaslab_group_destroy(metaslab_group_t *mg);
00076 extern void metaslab_group_activate(metaslab_group_t *mg);
00077 extern void metaslab_group_passivate(metaslab_group_t *mg);
00078 
00079 #ifdef  __cplusplus
00080 }
00081 #endif
00082 
00083 #endif  /* _SYS_METASLAB_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines