author | Jeff Bonwick <Jeff.Bonwick@Sun.COM> |
Sun, 01 Nov 2009 14:14:46 -0800 | |
changeset 10922 | e2081f502306 |
parent 10921 | 8aac17999e4d |
child 10974 | 32d689ba6466 |
permissions | -rw-r--r-- |
789 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
1732 | 5 |
* Common Development and Distribution License (the "License"). |
6 |
* You may not use this file except in compliance with the License. |
|
789 | 7 |
* |
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
/* |
|
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
1732
diff
changeset
|
22 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
789 | 23 |
* Use is subject to license terms. |
24 |
*/ |
|
25 |
||
26 |
#ifndef _SYS_METASLAB_IMPL_H |
|
27 |
#define _SYS_METASLAB_IMPL_H |
|
28 |
||
29 |
#include <sys/metaslab.h> |
|
30 |
#include <sys/space_map.h> |
|
31 |
#include <sys/vdev.h> |
|
32 |
#include <sys/txg.h> |
|
33 |
#include <sys/avl.h> |
|
34 |
||
35 |
#ifdef __cplusplus |
|
36 |
extern "C" { |
|
37 |
#endif |
|
38 |
||
39 |
struct metaslab_class { |
|
10594
986cb68d2347
6574286 removing a slog doesn't work
George Wilson <George.Wilson@Sun.COM>
parents:
9480
diff
changeset
|
40 |
spa_t *mc_spa; |
789 | 41 |
metaslab_group_t *mc_rotor; |
9480
fcff33da767f
6596237 Stop looking and start ganging
George Wilson <George.Wilson@Sun.COM>
parents:
1732
diff
changeset
|
42 |
space_map_ops_t *mc_ops; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
43 |
uint64_t mc_aliquot; |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
44 |
uint64_t mc_alloc; /* total allocated space */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
45 |
uint64_t mc_deferred; /* total deferred frees */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
46 |
uint64_t mc_space; /* total space (alloc + free) */ |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10921
diff
changeset
|
47 |
uint64_t mc_dspace; /* total deflated space */ |
789 | 48 |
}; |
49 |
||
50 |
struct metaslab_group { |
|
51 |
kmutex_t mg_lock; |
|
52 |
avl_tree_t mg_metaslab_tree; |
|
53 |
uint64_t mg_aliquot; |
|
54 |
int64_t mg_bias; |
|
55 |
metaslab_class_t *mg_class; |
|
56 |
vdev_t *mg_vd; |
|
57 |
metaslab_group_t *mg_prev; |
|
58 |
metaslab_group_t *mg_next; |
|
59 |
}; |
|
60 |
||
61 |
/* |
|
1732 | 62 |
* Each metaslab's free space is tracked in space map object in the MOS, |
63 |
* which is only updated in syncing context. Each time we sync a txg, |
|
64 |
* we append the allocs and frees from that txg to the space map object. |
|
65 |
* When the txg is done syncing, metaslab_sync_done() updates ms_smo |
|
66 |
* to ms_smo_syncing. Everything in ms_smo is always safe to allocate. |
|
789 | 67 |
*/ |
68 |
struct metaslab { |
|
69 |
kmutex_t ms_lock; /* metaslab lock */ |
|
1732 | 70 |
space_map_obj_t ms_smo; /* synced space map object */ |
71 |
space_map_obj_t ms_smo_syncing; /* syncing space map object */ |
|
789 | 72 |
space_map_t ms_allocmap[TXG_SIZE]; /* allocated this txg */ |
73 |
space_map_t ms_freemap[TXG_SIZE]; /* freed this txg */ |
|
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10594
diff
changeset
|
74 |
space_map_t ms_defermap[TXG_DEFER_SIZE]; /* deferred frees */ |
1732 | 75 |
space_map_t ms_map; /* in-core free space map */ |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
10594
diff
changeset
|
76 |
int64_t ms_deferspace; /* sum of ms_defermap[] space */ |
1732 | 77 |
uint64_t ms_weight; /* weight vs. others in group */ |
78 |
metaslab_group_t *ms_group; /* metaslab group */ |
|
79 |
avl_node_t ms_group_node; /* node in metaslab group tree */ |
|
789 | 80 |
txg_node_t ms_txg_node; /* per-txg dirty metaslab links */ |
81 |
}; |
|
82 |
||
83 |
#ifdef __cplusplus |
|
84 |
} |
|
85 |
#endif |
|
86 |
||
87 |
#endif /* _SYS_METASLAB_IMPL_H */ |