Print this page
NEX-16904 Need to port Illumos Bug #9433 to fix ARC hit rate
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-9752 backport illumos 6950 ARC should cache compressed data
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
6950 ARC should cache compressed data
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-5058 WBC: Race between the purging of window and opening new one
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Alex Aizman <alex.aizman@nexenta.com>
NEX-2830 ZFS smart compression
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
6214 zpools going south
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
5987 zfs prefetch code needs work
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Gordon Ross <gordon.ross@nexenta.com>
NEX-4408 backport illumos #6214 to avoid corruption
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3541 Implement persistent L2ARC
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Conflicts:
usr/src/uts/common/fs/zfs/sys/spa.h
NEX-3558 KRRP Integration
NEX-3300 ddt byte count ceiling tunables should not depend on zfs_ddt_limit_type being set
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-3165 need some dedup improvements
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
NEX-3165 segregate ddt in arc (other lint fix)
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-3165 segregate ddt in arc (lint fix)
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-3165 segregate ddt in arc
NEX-3079 port illumos ARC improvements
re #13989 port of illumos-3805
3805 arc shouldn't cache freed blocks
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Richard Elling <richard.elling@dey-sys.com>
Reviewed by: Will Andrews <will@firepipe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/zfs/sys/arc.h
+++ new/usr/src/uts/common/fs/zfs/sys/arc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
24 24 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
25 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 26 */
26 27
27 28 #ifndef _SYS_ARC_H
28 29 #define _SYS_ARC_H
29 30
30 31 #include <sys/zfs_context.h>
31 32
32 33 #ifdef __cplusplus
33 34 extern "C" {
34 35 #endif
35 36
37 +#include <sys/kreplication_common.h>
36 38 #include <sys/zio.h>
37 39 #include <sys/dmu.h>
38 40 #include <sys/spa.h>
39 41
40 42 /*
41 43 * Used by arc_flush() to inform arc_evict_state() that it should evict
42 44 * all available buffers from the arc state being passed in.
43 45 */
44 46 #define ARC_EVICT_ALL -1ULL
45 47
46 48 #define HDR_SET_LSIZE(hdr, x) do { \
47 49 ASSERT(IS_P2ALIGNED(x, 1U << SPA_MINBLOCKSHIFT)); \
48 50 (hdr)->b_lsize = ((x) >> SPA_MINBLOCKSHIFT); \
49 51 _NOTE(CONSTCOND) } while (0)
50 52
51 53 #define HDR_SET_PSIZE(hdr, x) do { \
52 54 ASSERT(IS_P2ALIGNED((x), 1U << SPA_MINBLOCKSHIFT)); \
53 55 (hdr)->b_psize = ((x) >> SPA_MINBLOCKSHIFT); \
54 56 _NOTE(CONSTCOND) } while (0)
55 57
56 58 #define HDR_GET_LSIZE(hdr) ((hdr)->b_lsize << SPA_MINBLOCKSHIFT)
57 59 #define HDR_GET_PSIZE(hdr) ((hdr)->b_psize << SPA_MINBLOCKSHIFT)
58 60
59 61 typedef struct arc_buf_hdr arc_buf_hdr_t;
60 62 typedef struct arc_buf arc_buf_t;
61 63 typedef void arc_done_func_t(zio_t *zio, arc_buf_t *buf, void *private);
62 64
63 65 /* generic arc_done_func_t's which you can use */
64 66 arc_done_func_t arc_bcopy_func;
65 67 arc_done_func_t arc_getbuf_func;
66 68
67 69 typedef enum arc_flags
68 70 {
69 71 /*
70 72 * Public flags that can be passed into the ARC by external consumers.
71 73 */
72 74 ARC_FLAG_WAIT = 1 << 0, /* perform sync I/O */
73 75 ARC_FLAG_NOWAIT = 1 << 1, /* perform async I/O */
74 76 ARC_FLAG_PREFETCH = 1 << 2, /* I/O is a prefetch */
75 77 ARC_FLAG_CACHED = 1 << 3, /* I/O was in cache */
76 78 ARC_FLAG_L2CACHE = 1 << 4, /* cache in L2ARC */
77 79 ARC_FLAG_PREDICTIVE_PREFETCH = 1 << 5, /* I/O from zfetch */
78 80
79 81 /*
80 82 * Private ARC flags. These flags are private ARC only flags that
81 83 * will show up in b_flags in the arc_hdr_buf_t. These flags should
82 84 * only be set by ARC code.
|
↓ open down ↓ |
37 lines elided |
↑ open up ↑ |
83 85 */
84 86 ARC_FLAG_IN_HASH_TABLE = 1 << 6, /* buffer is hashed */
85 87 ARC_FLAG_IO_IN_PROGRESS = 1 << 7, /* I/O in progress */
86 88 ARC_FLAG_IO_ERROR = 1 << 8, /* I/O failed for buf */
87 89 ARC_FLAG_INDIRECT = 1 << 9, /* indirect block */
88 90 /* Indicates that block was read with ASYNC priority. */
89 91 ARC_FLAG_PRIO_ASYNC_READ = 1 << 10,
90 92 ARC_FLAG_L2_WRITING = 1 << 11, /* write in progress */
91 93 ARC_FLAG_L2_EVICTED = 1 << 12, /* evicted during I/O */
92 94 ARC_FLAG_L2_WRITE_HEAD = 1 << 13, /* head of write list */
93 - /* indicates that the buffer contains metadata (otherwise, data) */
95 +
96 + /*
97 + * Below BUFC flags indicate that either the buffer contains
98 + * metadata or DDT metadata. If both of these are not set then the
99 + * buffer contains data.
100 + * ARC_FLAG_BUFC_DDT is only used when zfs_arc_segregate_ddt is true.
101 + * If this tunable is zero ARC_FLAG_BUFC_METADATA is used for both DDT
102 + * and regular metadata.
103 + */
94 104 ARC_FLAG_BUFC_METADATA = 1 << 14,
95 105
96 106 /* Flags specifying whether optional hdr struct fields are defined */
97 107 ARC_FLAG_HAS_L1HDR = 1 << 15,
98 108 ARC_FLAG_HAS_L2HDR = 1 << 16,
99 109
100 110 /*
101 111 * Indicates the arc_buf_hdr_t's b_pdata matches the on-disk data.
102 112 * This allows the l2arc to use the blkptr's checksum to verify
103 113 * the data without having to store the checksum in the hdr.
104 114 */
105 115 ARC_FLAG_COMPRESSED_ARC = 1 << 17,
106 116 ARC_FLAG_SHARED_DATA = 1 << 18,
107 117
118 + ARC_FLAG_BUFC_DDT = 1 << 19, /* DDT buf */
119 +
108 120 /*
109 121 * The arc buffer's compression mode is stored in the top 7 bits of the
110 122 * flags field, so these dummy flags are included so that MDB can
111 123 * interpret the enum properly.
112 124 */
113 125 ARC_FLAG_COMPRESS_0 = 1 << 24,
114 126 ARC_FLAG_COMPRESS_1 = 1 << 25,
115 127 ARC_FLAG_COMPRESS_2 = 1 << 26,
116 128 ARC_FLAG_COMPRESS_3 = 1 << 27,
117 129 ARC_FLAG_COMPRESS_4 = 1 << 28,
118 130 ARC_FLAG_COMPRESS_5 = 1 << 29,
119 131 ARC_FLAG_COMPRESS_6 = 1 << 30
120 -
121 132 } arc_flags_t;
122 133
123 134 typedef enum arc_buf_flags {
124 135 ARC_BUF_FLAG_SHARED = 1 << 0,
125 136 ARC_BUF_FLAG_COMPRESSED = 1 << 1
126 137 } arc_buf_flags_t;
127 138
128 139 struct arc_buf {
129 140 arc_buf_hdr_t *b_hdr;
130 141 arc_buf_t *b_next;
131 142 kmutex_t b_evict_lock;
132 143 void *b_data;
133 144 arc_buf_flags_t b_flags;
134 145 };
135 146
136 147 typedef enum arc_buf_contents {
137 148 ARC_BUFC_INVALID, /* invalid type */
138 149 ARC_BUFC_DATA, /* buffer contains data */
139 150 ARC_BUFC_METADATA, /* buffer contains metadata */
151 + ARC_BUFC_DDT, /* buffer contains ddt */
140 152 ARC_BUFC_NUMTYPES
141 153 } arc_buf_contents_t;
142 154
143 155 /*
144 156 * The following breakdows of arc_size exist for kstat only.
145 157 */
146 158 typedef enum arc_space_type {
147 159 ARC_SPACE_DATA,
148 160 ARC_SPACE_META,
161 + ARC_SPACE_DDT,
149 162 ARC_SPACE_HDRS,
150 163 ARC_SPACE_L2HDRS,
151 164 ARC_SPACE_OTHER,
152 165 ARC_SPACE_NUMTYPES
153 166 } arc_space_type_t;
154 167
168 +/* see spa_misc.c and zio_ddt_write() */
169 +extern uint64_t zfs_ddt_byte_ceiling;
170 +typedef enum zfs_ddt_limit {
171 + DDT_NO_LIMIT = 0,
172 + DDT_LIMIT_TO_ARC = 1,
173 + DDT_LIMIT_TO_L2ARC = 2,
174 +} zfs_ddt_limit_t;
175 +extern zfs_ddt_limit_t zfs_ddt_limit_type;
176 +extern boolean_t zfs_arc_segregate_ddt;
177 +extern uint64_t const * arc_ddt_evict_threshold;
178 +
179 +
155 180 void arc_space_consume(uint64_t space, arc_space_type_t type);
156 181 void arc_space_return(uint64_t space, arc_space_type_t type);
157 182 boolean_t arc_is_metadata(arc_buf_t *buf);
158 183 enum zio_compress arc_get_compression(arc_buf_t *buf);
159 184 int arc_decompress(arc_buf_t *buf);
160 185 arc_buf_t *arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type,
161 186 int32_t size);
162 187 arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, void *tag,
163 188 uint64_t psize, uint64_t lsize, enum zio_compress compression_type);
164 189 arc_buf_t *arc_loan_buf(spa_t *spa, boolean_t is_metadata, int size);
165 190 arc_buf_t *arc_loan_compressed_buf(spa_t *spa, uint64_t psize, uint64_t lsize,
166 191 enum zio_compress compression_type);
167 192 void arc_return_buf(arc_buf_t *buf, void *tag);
168 193 void arc_loan_inuse_buf(arc_buf_t *buf, void *tag);
169 194 void arc_buf_destroy(arc_buf_t *buf, void *tag);
170 195 int arc_buf_size(arc_buf_t *buf);
171 196 int arc_buf_lsize(arc_buf_t *buf);
197 +void arc_buf_access(arc_buf_t *buf);
172 198 void arc_release(arc_buf_t *buf, void *tag);
173 199 int arc_released(arc_buf_t *buf);
174 200 void arc_buf_freeze(arc_buf_t *buf);
175 201 void arc_buf_thaw(arc_buf_t *buf);
176 202 #ifdef ZFS_DEBUG
177 203 int arc_referenced(arc_buf_t *buf);
178 204 #endif
179 205
206 +int arc_io_bypass(spa_t *spa, const blkptr_t *bp,
207 + arc_bypass_io_func func, void *arg);
180 208 int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp,
181 209 arc_done_func_t *done, void *private, zio_priority_t priority, int flags,
182 210 arc_flags_t *arc_flags, const zbookmark_phys_t *zb);
183 211 zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
184 212 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp,
185 213 arc_done_func_t *ready, arc_done_func_t *child_ready,
186 214 arc_done_func_t *physdone, arc_done_func_t *done,
187 215 void *private, zio_priority_t priority, int zio_flags,
188 - const zbookmark_phys_t *zb);
216 + const zbookmark_phys_t *zb, const zio_smartcomp_info_t *smartcomp);
189 217 void arc_freed(spa_t *spa, const blkptr_t *bp);
190 218
191 219 void arc_flush(spa_t *spa, boolean_t retry);
192 220 void arc_tempreserve_clear(uint64_t reserve);
193 221 int arc_tempreserve_space(uint64_t reserve, uint64_t txg);
194 222
195 223 uint64_t arc_max_bytes(void);
196 224 void arc_init(void);
197 225 void arc_fini(void);
198 226
199 227 /*
200 228 * Level 2 ARC
201 229 */
202 230
203 -void l2arc_add_vdev(spa_t *spa, vdev_t *vd);
231 +void l2arc_add_vdev(spa_t *spa, vdev_t *vd, boolean_t rebuild);
204 232 void l2arc_remove_vdev(vdev_t *vd);
205 233 boolean_t l2arc_vdev_present(vdev_t *vd);
206 234 void l2arc_init(void);
207 235 void l2arc_fini(void);
208 236 void l2arc_start(void);
209 237 void l2arc_stop(void);
238 +void l2arc_spa_rebuild_start(spa_t *spa);
210 239
211 240 #ifndef _KERNEL
212 241 extern boolean_t arc_watch;
213 242 extern int arc_procfd;
214 243 #endif
215 244
216 245 #ifdef __cplusplus
217 246 }
218 247 #endif
219 248
220 249 #endif /* _SYS_ARC_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX