Mercurial > illumos > git > illumos-joyent
annotate usr/src/uts/common/fs/zfs/sys/arc.h @ 25465:2c417db70a87
3525 Persistent L2ARC
Portions contributed by: Saso Kiselkov <skiselkov@gmail.com>
Portions contributed by: Jorgen Lundman <lundman@lundman.net>
Portions contributed by: Brian Behlendorf <behlendorf1@llnl.gov>
Portions contributed by: Alexander Motin <mav@FreeBSD.org>
Portions contributed by: Jason King <jason.king@joyent.com>
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
author | George Amanakis <gamanakis@gmail.com> |
---|---|
date | Thu, 30 Jul 2020 18:40:44 -0500 |
parents | 78bc68a60a91 |
children | 6e6fa6693b95 |
rev | line source |
---|---|
789 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
1544 | 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 /* | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11539
diff
changeset
|
22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
16265
e134d1ae86d6
7970 zfs_arc_num_sublists_per_state should be common to all multilists
Matthew Ahrens <mahrens@delphix.com>
parents:
16020
diff
changeset
|
23 * Copyright (c) 2012, 2017 by Delphix. All rights reserved. |
14039
6cfd5a5778b9
3137 L2ARC compression
Saso Kiselkov <skiselkov@gmail.com>
parents:
13973
diff
changeset
|
24 * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. |
789 | 25 */ |
26 | |
27 #ifndef _SYS_ARC_H | |
28 #define _SYS_ARC_H | |
29 | |
30 #include <sys/zfs_context.h> | |
31 | |
32 #ifdef __cplusplus | |
33 extern "C" { | |
34 #endif | |
35 | |
36 #include <sys/zio.h> | |
4849
3a61e0a9a953
6536043 arc_byteswap_func_t and dmu_byteswap_func_t are redundant
ahrens
parents:
4309
diff
changeset
|
37 #include <sys/dmu.h> |
5450 | 38 #include <sys/spa.h> |
789 | 39 |
14849
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
40 /* |
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
41 * Used by arc_flush() to inform arc_evict_state() that it should evict |
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
42 * all available buffers from the arc state being passed in. |
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
43 */ |
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
44 #define ARC_EVICT_ALL -1ULL |
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
45 |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
46 #define HDR_SET_LSIZE(hdr, x) do { \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
47 ASSERT(IS_P2ALIGNED(x, 1U << SPA_MINBLOCKSHIFT)); \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
48 (hdr)->b_lsize = ((x) >> SPA_MINBLOCKSHIFT); \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
49 _NOTE(CONSTCOND) } while (0) |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
50 |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
51 #define HDR_SET_PSIZE(hdr, x) do { \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
52 ASSERT(IS_P2ALIGNED((x), 1U << SPA_MINBLOCKSHIFT)); \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
53 (hdr)->b_psize = ((x) >> SPA_MINBLOCKSHIFT); \ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
54 _NOTE(CONSTCOND) } while (0) |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
55 |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
56 #define HDR_GET_LSIZE(hdr) ((hdr)->b_lsize << SPA_MINBLOCKSHIFT) |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
57 #define HDR_GET_PSIZE(hdr) ((hdr)->b_psize << SPA_MINBLOCKSHIFT) |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
58 |
789 | 59 typedef struct arc_buf_hdr arc_buf_hdr_t; |
60 typedef struct arc_buf arc_buf_t; | |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
61 |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
62 /* |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
63 * Because the ARC can store encrypted data, errors (not due to bugs) may arise |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
64 * while transforming data into its desired format - specifically, when |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
65 * decrypting, the key may not be present, or the HMAC may not be correct |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
66 * which signifies deliberate tampering with the on-disk state |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
67 * (assuming that the checksum was correct). The "error" parameter will be |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
68 * nonzero in this case, even if there is no associated zio. |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
69 */ |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
70 typedef void arc_read_done_func_t(zio_t *zio, const zbookmark_phys_t *zb, |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
71 const blkptr_t *bp, arc_buf_t *buf, void *priv); |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
72 typedef void arc_write_done_func_t(zio_t *zio, arc_buf_t *buf, void *priv); |
789 | 73 |
74 /* generic arc_done_func_t's which you can use */ | |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
75 arc_read_done_func_t arc_bcopy_func; |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
76 arc_read_done_func_t arc_getbuf_func; |
789 | 77 |
14793
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
78 typedef enum arc_flags |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
79 { |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
80 /* |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
81 * Public flags that can be passed into the ARC by external consumers. |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
82 */ |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
83 ARC_FLAG_WAIT = 1 << 0, /* perform sync I/O */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
84 ARC_FLAG_NOWAIT = 1 << 1, /* perform async I/O */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
85 ARC_FLAG_PREFETCH = 1 << 2, /* I/O is a prefetch */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
86 ARC_FLAG_CACHED = 1 << 3, /* I/O was in cache */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
87 ARC_FLAG_L2CACHE = 1 << 4, /* cache in L2ARC */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
88 ARC_FLAG_PREDICTIVE_PREFETCH = 1 << 5, /* I/O from zfetch */ |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
89 ARC_FLAG_PRESCIENT_PREFETCH = 1 << 6, /* long min lifespan */ |
14793
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
90 |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
91 /* |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
92 * Private ARC flags. These flags are private ARC only flags that |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
93 * will show up in b_flags in the arc_hdr_buf_t. These flags should |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
94 * only be set by ARC code. |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
95 */ |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
96 ARC_FLAG_IN_HASH_TABLE = 1 << 7, /* buffer is hashed */ |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
97 ARC_FLAG_IO_IN_PROGRESS = 1 << 8, /* I/O in progress */ |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
98 ARC_FLAG_IO_ERROR = 1 << 9, /* I/O failed for buf */ |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
99 ARC_FLAG_INDIRECT = 1 << 10, /* indirect block */ |
15199
6684b4d1b6f6
5987 zfs prefetch code needs work
Matthew Ahrens <mahrens@delphix.com>
parents:
14849
diff
changeset
|
100 /* Indicates that block was read with ASYNC priority. */ |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
101 ARC_FLAG_PRIO_ASYNC_READ = 1 << 11, |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
102 ARC_FLAG_L2_WRITING = 1 << 12, /* write in progress */ |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
103 ARC_FLAG_L2_EVICTED = 1 << 13, /* evicted during I/O */ |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
104 ARC_FLAG_L2_WRITE_HEAD = 1 << 14, /* head of write list */ |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
105 /* |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
106 * Encrypted or authenticated on disk (may be plaintext in memory). |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
107 * This header has b_crypt_hdr allocated. Does not include indirect |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
108 * blocks with checksums of MACs which will also have their X |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
109 * (encrypted) bit set in the bp. |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
110 */ |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
111 ARC_FLAG_PROTECTED = 1 << 15, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
112 /* data has not been authenticated yet */ |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
113 ARC_FLAG_NOAUTH = 1 << 16, |
14836
457be6bc6292
5408 managing ZFS cache devices requires lots of RAM
Chris Williamson <Chris.Williamson@delphix.com>
parents:
14793
diff
changeset
|
114 /* indicates that the buffer contains metadata (otherwise, data) */ |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
115 ARC_FLAG_BUFC_METADATA = 1 << 17, |
14836
457be6bc6292
5408 managing ZFS cache devices requires lots of RAM
Chris Williamson <Chris.Williamson@delphix.com>
parents:
14793
diff
changeset
|
116 |
457be6bc6292
5408 managing ZFS cache devices requires lots of RAM
Chris Williamson <Chris.Williamson@delphix.com>
parents:
14793
diff
changeset
|
117 /* Flags specifying whether optional hdr struct fields are defined */ |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
118 ARC_FLAG_HAS_L1HDR = 1 << 18, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
119 ARC_FLAG_HAS_L2HDR = 1 << 19, |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
120 |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
121 /* |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
122 * Indicates the arc_buf_hdr_t's b_pdata matches the on-disk data. |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
123 * This allows the l2arc to use the blkptr's checksum to verify |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
124 * the data without having to store the checksum in the hdr. |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
125 */ |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
126 ARC_FLAG_COMPRESSED_ARC = 1 << 20, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
127 ARC_FLAG_SHARED_DATA = 1 << 21, |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
128 |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
129 /* |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
130 * The arc buffer's compression mode is stored in the top 7 bits of the |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
131 * flags field, so these dummy flags are included so that MDB can |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
132 * interpret the enum properly. |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
133 */ |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
134 ARC_FLAG_COMPRESS_0 = 1 << 24, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
135 ARC_FLAG_COMPRESS_1 = 1 << 25, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
136 ARC_FLAG_COMPRESS_2 = 1 << 26, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
137 ARC_FLAG_COMPRESS_3 = 1 << 27, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
138 ARC_FLAG_COMPRESS_4 = 1 << 28, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
139 ARC_FLAG_COMPRESS_5 = 1 << 29, |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
140 ARC_FLAG_COMPRESS_6 = 1 << 30 |
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
141 |
14793
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
142 } arc_flags_t; |
40e1d430faf1
5369 arc flags should be an enum
George Wilson <george.wilson@delphix.com>
parents:
14730
diff
changeset
|
143 |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
144 typedef enum arc_buf_flags { |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
145 ARC_BUF_FLAG_SHARED = 1 << 0, |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
146 ARC_BUF_FLAG_COMPRESSED = 1 << 1, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
147 /* |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
148 * indicates whether this arc_buf_t is encrypted, regardless of |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
149 * state on-disk |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
150 */ |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
151 ARC_BUF_FLAG_ENCRYPTED = 1 << 2 |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
152 } arc_buf_flags_t; |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
153 |
789 | 154 struct arc_buf { |
155 arc_buf_hdr_t *b_hdr; | |
156 arc_buf_t *b_next; | |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11539
diff
changeset
|
157 kmutex_t b_evict_lock; |
789 | 158 void *b_data; |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
159 arc_buf_flags_t b_flags; |
789 | 160 }; |
161 | |
3290 | 162 typedef enum arc_buf_contents { |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
163 ARC_BUFC_INVALID, /* invalid type */ |
3290 | 164 ARC_BUFC_DATA, /* buffer contains data */ |
4309
3dfde0f4662d
6542676 ARC needs to track meta-data memory overhead
maybee
parents:
3547
diff
changeset
|
165 ARC_BUFC_METADATA, /* buffer contains metadata */ |
3dfde0f4662d
6542676 ARC needs to track meta-data memory overhead
maybee
parents:
3547
diff
changeset
|
166 ARC_BUFC_NUMTYPES |
3290 | 167 } arc_buf_contents_t; |
789 | 168 |
8582
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
169 /* |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
170 * The following breakdows of arc_size exist for kstat only. |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
171 */ |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
172 typedef enum arc_space_type { |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
173 ARC_SPACE_DATA, |
14837
d416ccc025f2
5445 Add more visibility via arcstats; specifically arc_state_t stats and differentiate between "data" and "metadata"
Prakash Surya <prakash.surya@delphix.com>
parents:
14836
diff
changeset
|
174 ARC_SPACE_META, |
8582
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
175 ARC_SPACE_HDRS, |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
176 ARC_SPACE_L2HDRS, |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
177 ARC_SPACE_OTHER, |
22621
b172d70a6f88
8423 Implement large_dnode pool feature
Toomas Soome <tsoome@me.com>
parents:
17451
diff
changeset
|
178 ARC_SPACE_BONUS, |
8582
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
179 ARC_SPACE_NUMTYPES |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
180 } arc_space_type_t; |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
181 |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
182 void arc_space_consume(uint64_t space, arc_space_type_t type); |
df9361868dbe
6748019 ARC/L2ARC metadata accounting for arc_size
Brendan Gregg - Sun Microsystems <Brendan.Gregg@Sun.COM>
parents:
7872
diff
changeset
|
183 void arc_space_return(uint64_t space, arc_space_type_t type); |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
184 boolean_t arc_is_metadata(arc_buf_t *buf); |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
185 boolean_t arc_is_encrypted(arc_buf_t *buf); |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
186 boolean_t arc_is_unauthenticated(arc_buf_t *buf); |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
187 enum zio_compress arc_get_compression(arc_buf_t *buf); |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
188 void arc_get_raw_params(arc_buf_t *buf, boolean_t *byteorder, uint8_t *salt, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
189 uint8_t *iv, uint8_t *mac); |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
190 int arc_untransform(arc_buf_t *buf, spa_t *spa, const zbookmark_phys_t *zb, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
191 boolean_t in_place); |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
192 void arc_convert_to_raw(arc_buf_t *buf, uint64_t dsobj, boolean_t byteorder, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
193 dmu_object_type_t ot, const uint8_t *salt, const uint8_t *iv, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
194 const uint8_t *mac); |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
195 arc_buf_t *arc_alloc_buf(spa_t *spa, void *tag, arc_buf_contents_t type, |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
196 int32_t size); |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
197 arc_buf_t *arc_alloc_compressed_buf(spa_t *spa, void *tag, |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
198 uint64_t psize, uint64_t lsize, enum zio_compress compression_type); |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
199 arc_buf_t *arc_alloc_raw_buf(spa_t *spa, void *tag, uint64_t dsobj, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
200 boolean_t byteorder, const uint8_t *salt, const uint8_t *iv, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
201 const uint8_t *mac, dmu_object_type_t ot, uint64_t psize, uint64_t lsize, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
202 enum zio_compress compression_type); |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
203 arc_buf_t *arc_loan_buf(spa_t *spa, boolean_t is_metadata, int size); |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
204 arc_buf_t *arc_loan_compressed_buf(spa_t *spa, uint64_t psize, uint64_t lsize, |
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
205 enum zio_compress compression_type); |
23516
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
206 arc_buf_t *arc_loan_raw_buf(spa_t *spa, uint64_t dsobj, boolean_t byteorder, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
207 const uint8_t *salt, const uint8_t *iv, const uint8_t *mac, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
208 dmu_object_type_t ot, uint64_t psize, uint64_t lsize, |
cdac48beb362
8727 Native data and metadata encryption for zfs
Tom Caputi <tcaputi@datto.com>
parents:
23204
diff
changeset
|
209 enum zio_compress compression_type); |
9412
4aefd8704ce0
6717022 ZFS DMU needs zero-copy support
Aleksandr Guzovskiy <Aleksandr.Guzovskiy@Sun.COM>
parents:
8582
diff
changeset
|
210 void arc_return_buf(arc_buf_t *buf, void *tag); |
11539
10d35fc3d7fd
6873106 Need a mechanism to share buffers between fs modules
chunli zhang - Sun Microsystems - Irvine United States <Chunli.Zhang@Sun.COM>
parents:
10922
diff
changeset
|
211 void arc_loan_inuse_buf(arc_buf_t *buf, void *tag); |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
212 void arc_buf_destroy(arc_buf_t *buf, void *tag); |
789 | 213 int arc_buf_size(arc_buf_t *buf); |
16020
447c4863905f
7252 compressed zfs send / receive
Dan Kimmel <dan.kimmel@delphix.com>
parents:
15747
diff
changeset
|
214 int arc_buf_lsize(arc_buf_t *buf); |
22782 | 215 void arc_buf_access(arc_buf_t *buf); |
789 | 216 void arc_release(arc_buf_t *buf, void *tag); |
217 int arc_released(arc_buf_t *buf); | |
3093
71525e4187d5
6490569 verify arc bufs are not modified when they shouldn't be
ahrens
parents:
2391
diff
changeset
|
218 void arc_buf_freeze(arc_buf_t *buf); |
71525e4187d5
6490569 verify arc bufs are not modified when they shouldn't be
ahrens
parents:
2391
diff
changeset
|
219 void arc_buf_thaw(arc_buf_t *buf); |
1544 | 220 #ifdef ZFS_DEBUG |
221 int arc_referenced(arc_buf_t *buf); | |
222 #endif | |
789 | 223 |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13840
diff
changeset
|
224 int arc_read(zio_t *pio, spa_t *spa, const blkptr_t *bp, |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
225 arc_read_done_func_t *done, void *private, zio_priority_t priority, |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
226 int flags, arc_flags_t *arc_flags, const zbookmark_phys_t *zb); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10407
diff
changeset
|
227 zio_t *arc_write(zio_t *pio, spa_t *spa, uint64_t txg, |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
228 blkptr_t *bp, arc_buf_t *buf, boolean_t l2arc, const zio_prop_t *zp, |
23204
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
229 arc_write_done_func_t *ready, arc_write_done_func_t *child_ready, |
07339330e819
10405 Implement ZFS sorted scans
Toomas Soome <tsoome@me.com>
parents:
22782
diff
changeset
|
230 arc_write_done_func_t *physdone, arc_write_done_func_t *done, |
15660
a531c3f627f8
6513 partially filled holes lose birth time
Paul Dagnelie <pcd@delphix.com>
parents:
15201
diff
changeset
|
231 void *private, zio_priority_t priority, int zio_flags, |
a531c3f627f8
6513 partially filled holes lose birth time
Paul Dagnelie <pcd@delphix.com>
parents:
15201
diff
changeset
|
232 const zbookmark_phys_t *zb); |
14041
cb4a51285eeb
3805 arc shouldn't cache freed blocks
Matthew Ahrens <mahrens@delphix.com>
parents:
14039
diff
changeset
|
233 void arc_freed(spa_t *spa, const blkptr_t *bp); |
789 | 234 |
14849
be29a9ce2e0d
5497 lock contention on arcs_mtx
Prakash Surya <prakash.surya@delphix.com>
parents:
14837
diff
changeset
|
235 void arc_flush(spa_t *spa, boolean_t retry); |
6245
1a2a7cfb9f26
6429205 each zpool needs to monitor its throughput and throttle heavy writers
maybee
parents:
5642
diff
changeset
|
236 void arc_tempreserve_clear(uint64_t reserve); |
17451
1712dde80e8b
9465 ARC check for 'anon_size > arc_c/2' can stall the system
Don Brady <don.brady@delphix.com>
parents:
16265
diff
changeset
|
237 int arc_tempreserve_space(spa_t *spa, uint64_t reserve, uint64_t txg); |
789 | 238 |
24249
78bc68a60a91
11918 metaslab improvements
Paul Dagnelie <pcd@delphix.com>
parents:
23516
diff
changeset
|
239 uint64_t arc_all_memory(void); |
15747
506e78b5eb98
6950 ARC should cache compressed data
George Wilson <george.wilson@delphix.com>
parents:
15660
diff
changeset
|
240 uint64_t arc_max_bytes(void); |
789 | 241 void arc_init(void); |
242 void arc_fini(void); | |
243 | |
5450 | 244 /* |
245 * Level 2 ARC | |
246 */ | |
247 | |
9816
847676ec1c5b
PSARC 2008/353 zpool autoexpand property
George Wilson <George.Wilson@Sun.COM>
parents:
9412
diff
changeset
|
248 void l2arc_add_vdev(spa_t *spa, vdev_t *vd); |
5450 | 249 void l2arc_remove_vdev(vdev_t *vd); |
6643
3a34b0dbb107
6625086 changing cachefile doesn't remove old cache on last user
eschrock
parents:
6245
diff
changeset
|
250 boolean_t l2arc_vdev_present(vdev_t *vd); |
25465
2c417db70a87
3525 Persistent L2ARC
George Amanakis <gamanakis@gmail.com>
parents:
24249
diff
changeset
|
251 void l2arc_rebuild_vdev(vdev_t *vd, boolean_t reopen); |
2c417db70a87
3525 Persistent L2ARC
George Amanakis <gamanakis@gmail.com>
parents:
24249
diff
changeset
|
252 boolean_t l2arc_range_check_overlap(uint64_t bottom, uint64_t top, |
2c417db70a87
3525 Persistent L2ARC
George Amanakis <gamanakis@gmail.com>
parents:
24249
diff
changeset
|
253 uint64_t check); |
5450 | 254 void l2arc_init(void); |
255 void l2arc_fini(void); | |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7545
diff
changeset
|
256 void l2arc_start(void); |
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7545
diff
changeset
|
257 void l2arc_stop(void); |
25465
2c417db70a87
3525 Persistent L2ARC
George Amanakis <gamanakis@gmail.com>
parents:
24249
diff
changeset
|
258 void l2arc_spa_rebuild_start(spa_t *spa); |
5450 | 259 |
13790
ac6eff781c67
3112 ztest does not honor ZFS_DEBUG
Matthew Ahrens <mahrens@delphix.com>
parents:
12351
diff
changeset
|
260 #ifndef _KERNEL |
ac6eff781c67
3112 ztest does not honor ZFS_DEBUG
Matthew Ahrens <mahrens@delphix.com>
parents:
12351
diff
changeset
|
261 extern boolean_t arc_watch; |
ac6eff781c67
3112 ztest does not honor ZFS_DEBUG
Matthew Ahrens <mahrens@delphix.com>
parents:
12351
diff
changeset
|
262 extern int arc_procfd; |
ac6eff781c67
3112 ztest does not honor ZFS_DEBUG
Matthew Ahrens <mahrens@delphix.com>
parents:
12351
diff
changeset
|
263 #endif |
ac6eff781c67
3112 ztest does not honor ZFS_DEBUG
Matthew Ahrens <mahrens@delphix.com>
parents:
12351
diff
changeset
|
264 |
789 | 265 #ifdef __cplusplus |
266 } | |
267 #endif | |
268 | |
269 #endif /* _SYS_ARC_H */ |