Deleted Added
full compact
metaslab_impl.h (302408) metaslab_impl.h (307277)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 10 unchanged lines hidden (view full) ---

19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26/*
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 10 unchanged lines hidden (view full) ---

19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26/*
27 * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
27 * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
28 */
29
30#ifndef _SYS_METASLAB_IMPL_H
31#define _SYS_METASLAB_IMPL_H
32
33#include <sys/metaslab.h>
34#include <sys/space_map.h>
35#include <sys/range_tree.h>

--- 18 unchanged lines hidden (view full) ---

54 * This rotor points to the next metaslab group where allocations will be
55 * attempted. Allocating a block is a 3 step process -- select the metaslab
56 * group, select the metaslab, and then allocate the block. The metaslab
57 * class defines the low-level block allocator that will be used as the
58 * final step in allocation. These allocators are pluggable allowing each class
59 * to use a block allocator that best suits that class.
60 */
61struct metaslab_class {
28 */
29
30#ifndef _SYS_METASLAB_IMPL_H
31#define _SYS_METASLAB_IMPL_H
32
33#include <sys/metaslab.h>
34#include <sys/space_map.h>
35#include <sys/range_tree.h>

--- 18 unchanged lines hidden (view full) ---

54 * This rotor points to the next metaslab group where allocations will be
55 * attempted. Allocating a block is a 3 step process -- select the metaslab
56 * group, select the metaslab, and then allocate the block. The metaslab
57 * class defines the low-level block allocator that will be used as the
58 * final step in allocation. These allocators are pluggable allowing each class
59 * to use a block allocator that best suits that class.
60 */
61struct metaslab_class {
62 kmutex_t mc_lock;
62 spa_t *mc_spa;
63 metaslab_group_t *mc_rotor;
64 metaslab_ops_t *mc_ops;
65 uint64_t mc_aliquot;
63 spa_t *mc_spa;
64 metaslab_group_t *mc_rotor;
65 metaslab_ops_t *mc_ops;
66 uint64_t mc_aliquot;
67
68 /*
69 * Track the number of metaslab groups that have been initialized
70 * and can accept allocations. An initialized metaslab group is
71 * one has been completely added to the config (i.e. we have
72 * updated the MOS config and the space has been added to the pool).
73 */
74 uint64_t mc_groups;
75
76 /*
77 * Toggle to enable/disable the allocation throttle.
78 */
79 boolean_t mc_alloc_throttle_enabled;
80
81 /*
82 * The allocation throttle works on a reservation system. Whenever
83 * an asynchronous zio wants to perform an allocation it must
84 * first reserve the number of blocks that it wants to allocate.
85 * If there aren't sufficient slots available for the pending zio
86 * then that I/O is throttled until more slots free up. The current
87 * number of reserved allocations is maintained by the mc_alloc_slots
88 * refcount. The mc_alloc_max_slots value determines the maximum
89 * number of allocations that the system allows. Gang blocks are
90 * allowed to reserve slots even if we've reached the maximum
91 * number of allocations allowed.
92 */
93 uint64_t mc_alloc_max_slots;
94 refcount_t mc_alloc_slots;
95
66 uint64_t mc_alloc_groups; /* # of allocatable groups */
96 uint64_t mc_alloc_groups; /* # of allocatable groups */
97
67 uint64_t mc_alloc; /* total allocated space */
68 uint64_t mc_deferred; /* total deferred frees */
69 uint64_t mc_space; /* total space (alloc + free) */
70 uint64_t mc_dspace; /* total deflated space */
71 uint64_t mc_minblocksize;
72 uint64_t mc_histogram[RANGE_TREE_HISTOGRAM_SIZE];
73};
74

--- 6 unchanged lines hidden (view full) ---

81 * simply find the next metaslab group in the linked list and attempt
82 * to allocate from that group instead.
83 */
84struct metaslab_group {
85 kmutex_t mg_lock;
86 avl_tree_t mg_metaslab_tree;
87 uint64_t mg_aliquot;
88 boolean_t mg_allocatable; /* can we allocate? */
98 uint64_t mc_alloc; /* total allocated space */
99 uint64_t mc_deferred; /* total deferred frees */
100 uint64_t mc_space; /* total space (alloc + free) */
101 uint64_t mc_dspace; /* total deflated space */
102 uint64_t mc_minblocksize;
103 uint64_t mc_histogram[RANGE_TREE_HISTOGRAM_SIZE];
104};
105

--- 6 unchanged lines hidden (view full) ---

112 * simply find the next metaslab group in the linked list and attempt
113 * to allocate from that group instead.
114 */
115struct metaslab_group {
116 kmutex_t mg_lock;
117 avl_tree_t mg_metaslab_tree;
118 uint64_t mg_aliquot;
119 boolean_t mg_allocatable; /* can we allocate? */
120
121 /*
122 * A metaslab group is considered to be initialized only after
123 * we have updated the MOS config and added the space to the pool.
124 * We only allow allocation attempts to a metaslab group if it
125 * has been initialized.
126 */
127 boolean_t mg_initialized;
128
89 uint64_t mg_free_capacity; /* percentage free */
90 int64_t mg_bias;
91 int64_t mg_activation_count;
92 metaslab_class_t *mg_class;
93 vdev_t *mg_vd;
94 taskq_t *mg_taskq;
95 metaslab_group_t *mg_prev;
96 metaslab_group_t *mg_next;
129 uint64_t mg_free_capacity; /* percentage free */
130 int64_t mg_bias;
131 int64_t mg_activation_count;
132 metaslab_class_t *mg_class;
133 vdev_t *mg_vd;
134 taskq_t *mg_taskq;
135 metaslab_group_t *mg_prev;
136 metaslab_group_t *mg_next;
137
138 /*
139 * Each metaslab group can handle mg_max_alloc_queue_depth allocations
140 * which are tracked by mg_alloc_queue_depth. It's possible for a
141 * metaslab group to handle more allocations than its max. This
142 * can occur when gang blocks are required or when other groups
143 * are unable to handle their share of allocations.
144 */
145 uint64_t mg_max_alloc_queue_depth;
146 refcount_t mg_alloc_queue_depth;
147
148 /*
149 * A metalab group that can no longer allocate the minimum block
150 * size will set mg_no_free_space. Once a metaslab group is out
151 * of space then its share of work must be distributed to other
152 * groups.
153 */
154 boolean_t mg_no_free_space;
155
156 uint64_t mg_allocations;
157 uint64_t mg_failed_allocations;
97 uint64_t mg_fragmentation;
98 uint64_t mg_histogram[RANGE_TREE_HISTOGRAM_SIZE];
99};
100
101/*
102 * This value defines the number of elements in the ms_lbas array. The value
103 * of 64 was chosen as it covers all power of 2 buckets up to UINT64_MAX.
104 * This is the equivalent of highbit(UINT64_MAX).

--- 98 unchanged lines hidden ---
158 uint64_t mg_fragmentation;
159 uint64_t mg_histogram[RANGE_TREE_HISTOGRAM_SIZE];
160};
161
162/*
163 * This value defines the number of elements in the ms_lbas array. The value
164 * of 64 was chosen as it covers all power of 2 buckets up to UINT64_MAX.
165 * This is the equivalent of highbit(UINT64_MAX).

--- 98 unchanged lines hidden ---