usr/src/uts/common/fs/zfs/sys/space_map.h
author George Wilson <George.Wilson@Sun.COM>
Mon, 27 Apr 2009 21:16:23 -0700
changeset 9480 fcff33da767f
parent 8241 5a60f16123ba
child 11146 7e58f40bcb1c
permissions -rw-r--r--
6596237 Stop looking and start ganging
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
     5
 * Common Development and Distribution License (the "License").
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
9480
fcff33da767f 6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents: 8241
diff changeset
    22
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#ifndef _SYS_SPACE_MAP_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#define	_SYS_SPACE_MAP_H
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#include <sys/avl.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
#include <sys/dmu.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
extern "C" {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    36
typedef struct space_map_ops space_map_ops_t;
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    37
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
typedef struct space_map {
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    39
	avl_tree_t	sm_root;	/* AVL tree of map segments */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    40
	uint64_t	sm_space;	/* sum of all segments in the map */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    41
	uint64_t	sm_start;	/* start of map */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    42
	uint64_t	sm_size;	/* size of map */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    43
	uint8_t		sm_shift;	/* unit shift */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    44
	uint8_t		sm_pad[3];	/* unused */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    45
	uint8_t		sm_loaded;	/* map loaded? */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    46
	uint8_t		sm_loading;	/* map loading? */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    47
	kcondvar_t	sm_load_cv;	/* map load completion */
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    48
	space_map_ops_t	*sm_ops;	/* space map block picker ops vector */
9480
fcff33da767f 6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents: 8241
diff changeset
    49
	avl_tree_t	*sm_pp_root;	/* picker-private AVL tree */
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    50
	void		*sm_ppd;	/* picker-private data */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
	kmutex_t	*sm_lock;	/* pointer to lock that protects map */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
} space_map_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
typedef struct space_seg {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
	avl_node_t	ss_node;	/* AVL node */
9480
fcff33da767f 6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents: 8241
diff changeset
    56
	avl_node_t	ss_pp_node;	/* AVL picker-private node */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
	uint64_t	ss_start;	/* starting offset of this segment */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
	uint64_t	ss_end;		/* ending offset (non-inclusive) */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
} space_seg_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
8241
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    61
typedef struct space_ref {
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    62
	avl_node_t	sr_node;	/* AVL node */
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    63
	uint64_t	sr_offset;	/* offset (start or end) */
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    64
	int64_t		sr_refcnt;	/* associated reference count */
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    65
} space_ref_t;
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
    66
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
typedef struct space_map_obj {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
	uint64_t	smo_object;	/* on-disk space map object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
	uint64_t	smo_objsize;	/* size of the object */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
	uint64_t	smo_alloc;	/* space allocated from the map */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
} space_map_obj_t;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    73
struct space_map_ops {
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    74
	void	(*smop_load)(space_map_t *sm);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    75
	void	(*smop_unload)(space_map_t *sm);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    76
	uint64_t (*smop_alloc)(space_map_t *sm, uint64_t size);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    77
	void	(*smop_claim)(space_map_t *sm, uint64_t start, uint64_t size);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    78
	void	(*smop_free)(space_map_t *sm, uint64_t start, uint64_t size);
9480
fcff33da767f 6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents: 8241
diff changeset
    79
	uint64_t (*smop_max)(space_map_t *sm);
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    80
};
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
    81
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    82
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    83
 * debug entry
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    84
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    85
 *    1      3         10                     50
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    86
 *  ,---+--------+------------+---------------------------------.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    87
 *  | 1 | action |  syncpass  |        txg (lower bits)         |
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    88
 *  `---+--------+------------+---------------------------------'
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    89
 *   63  62    60 59        50 49                               0
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    90
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    91
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    92
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    93
 * non-debug entry
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    94
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    95
 *    1               47                   1           15
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    96
 *  ,-----------------------------------------------------------.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    97
 *  | 0 |   offset (sm_shift units)    | type |       run       |
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    98
 *  `-----------------------------------------------------------'
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    99
 *   63  62                          17   16   15               0
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   100
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   101
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   102
/* All this stuff takes and returns bytes */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   103
#define	SM_RUN_DECODE(x)	(BF64_DECODE(x, 0, 15) + 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   104
#define	SM_RUN_ENCODE(x)	BF64_ENCODE((x) - 1, 0, 15)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   105
#define	SM_TYPE_DECODE(x)	BF64_DECODE(x, 15, 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   106
#define	SM_TYPE_ENCODE(x)	BF64_ENCODE(x, 15, 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   107
#define	SM_OFFSET_DECODE(x)	BF64_DECODE(x, 16, 47)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   108
#define	SM_OFFSET_ENCODE(x)	BF64_ENCODE(x, 16, 47)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   109
#define	SM_DEBUG_DECODE(x)	BF64_DECODE(x, 63, 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   110
#define	SM_DEBUG_ENCODE(x)	BF64_ENCODE(x, 63, 1)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   111
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   112
#define	SM_DEBUG_ACTION_DECODE(x)	BF64_DECODE(x, 60, 3)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   113
#define	SM_DEBUG_ACTION_ENCODE(x)	BF64_ENCODE(x, 60, 3)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   114
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   115
#define	SM_DEBUG_SYNCPASS_DECODE(x)	BF64_DECODE(x, 50, 10)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   116
#define	SM_DEBUG_SYNCPASS_ENCODE(x)	BF64_ENCODE(x, 50, 10)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   117
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   118
#define	SM_DEBUG_TXG_DECODE(x)		BF64_DECODE(x, 0, 50)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   119
#define	SM_DEBUG_TXG_ENCODE(x)		BF64_ENCODE(x, 0, 50)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   120
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   121
#define	SM_RUN_MAX			SM_RUN_DECODE(~0ULL)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   122
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   123
#define	SM_ALLOC	0x0
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   124
#define	SM_FREE		0x1
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   125
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   126
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   127
 * The data for a given space map can be kept on blocks of any size.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   128
 * Larger blocks entail fewer i/o operations, but they also cause the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   129
 * DMU to keep more data in-core, and also to waste more i/o bandwidth
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   130
 * when only a few blocks have changed since the last transaction group.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   131
 * This could use a lot more research, but for now, set the freelist
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   132
 * block size to 4k (2^12).
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   133
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   134
#define	SPACE_MAP_BLOCKSHIFT	12
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   135
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   136
typedef void space_map_func_t(space_map_t *sm, uint64_t start, uint64_t size);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   137
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   138
extern void space_map_create(space_map_t *sm, uint64_t start, uint64_t size,
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   139
    uint8_t shift, kmutex_t *lp);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   140
extern void space_map_destroy(space_map_t *sm);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   141
extern void space_map_add(space_map_t *sm, uint64_t start, uint64_t size);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   142
extern void space_map_remove(space_map_t *sm, uint64_t start, uint64_t size);
8241
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   143
extern boolean_t space_map_contains(space_map_t *sm,
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   144
    uint64_t start, uint64_t size);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   145
extern void space_map_vacate(space_map_t *sm,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   146
    space_map_func_t *func, space_map_t *mdest);
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   147
extern void space_map_walk(space_map_t *sm,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   148
    space_map_func_t *func, space_map_t *mdest);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   149
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   150
extern void space_map_load_wait(space_map_t *sm);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   151
extern int space_map_load(space_map_t *sm, space_map_ops_t *ops,
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   152
    uint8_t maptype, space_map_obj_t *smo, objset_t *os);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   153
extern void space_map_unload(space_map_t *sm);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   154
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   155
extern uint64_t space_map_alloc(space_map_t *sm, uint64_t size);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   156
extern void space_map_claim(space_map_t *sm, uint64_t start, uint64_t size);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   157
extern void space_map_free(space_map_t *sm, uint64_t start, uint64_t size);
9480
fcff33da767f 6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents: 8241
diff changeset
   158
extern uint64_t space_map_maxsize(space_map_t *sm);
1732
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   159
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   160
extern void space_map_sync(space_map_t *sm, uint8_t maptype,
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   161
    space_map_obj_t *smo, objset_t *os, dmu_tx_t *tx);
9e3ae798af31 6280668 pluggable block allocation policy
bonwick
parents: 789
diff changeset
   162
extern void space_map_truncate(space_map_obj_t *smo,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   163
    objset_t *os, dmu_tx_t *tx);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   164
8241
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   165
extern void space_map_ref_create(avl_tree_t *t);
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   166
extern void space_map_ref_destroy(avl_tree_t *t);
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   167
extern void space_map_ref_add_seg(avl_tree_t *t,
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   168
    uint64_t start, uint64_t end, int64_t refcnt);
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   169
extern void space_map_ref_add_map(avl_tree_t *t,
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   170
    space_map_t *sm, int64_t refcnt);
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   171
extern void space_map_ref_generate_map(avl_tree_t *t,
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   172
    space_map_t *sm, int64_t minref);
5a60f16123ba 6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents: 1732
diff changeset
   173
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   174
#ifdef	__cplusplus
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   175
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   176
#endif
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   177
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   178
#endif	/* _SYS_SPACE_MAP_H */