1fa9e406ahrens/*
2fa9e406ahrens * CDDL HEADER START
3fa9e406ahrens *
4fa9e406ahrens * The contents of this file are subject to the terms of the
5ea8dc4beschrock * Common Development and Distribution License (the "License").
6ea8dc4beschrock * You may not use this file except in compliance with the License.
7fa9e406ahrens *
8fa9e406ahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fa9e406ahrens * or http://www.opensolaris.org/os/licensing.
10fa9e406ahrens * See the License for the specific language governing permissions
11fa9e406ahrens * and limitations under the License.
12fa9e406ahrens *
13fa9e406ahrens * When distributing Covered Code, include this CDDL HEADER in each
14fa9e406ahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fa9e406ahrens * If applicable, add the following below this CDDL HEADER, with the
16fa9e406ahrens * fields enclosed by brackets "[]" replaced with your own identifying
17fa9e406ahrens * information: Portions Copyright [yyyy] [name of copyright owner]
18fa9e406ahrens *
19fa9e406ahrens * CDDL HEADER END
20fa9e406ahrens */
21fa9e406ahrens/*
22a3f829aBill Moore * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23fa9e406ahrens * Use is subject to license terms.
24fa9e406ahrens */
25be6fd75Matthew Ahrens/*
26770499eDan Kimmel * Copyright (c) 2013, 2017 by Delphix. All rights reserved.
27be6fd75Matthew Ahrens */
28fa9e406ahrens
29fa9e406ahrens#include <sys/zfs_context.h>
30fa9e406ahrens#include <sys/spa.h>
31fa9e406ahrens#include <sys/vdev_impl.h>
32fa9e406ahrens#include <sys/zio.h>
3387db74cek#include <sys/kstat.h>
34770499eDan Kimmel#include <sys/abd.h>
35fa9e406ahrens
36fa9e406ahrens/*
37fa9e406ahrens * Virtual device read-ahead caching.
38fa9e406ahrens *
39fa9e406ahrens * This file implements a simple LRU read-ahead cache.  When the DMU reads
40fa9e406ahrens * a given block, it will often want other, nearby blocks soon thereafter.
41fa9e406ahrens * We take advantage of this by reading a larger disk region and caching
4287db74cek * the result.  In the best case, this can turn 128 back-to-back 512-byte
4387db74cek * reads into a single 64k read followed by 127 cache hits; this reduces
44fa9e406ahrens * latency dramatically.  In the worst case, it can turn an isolated 512-byte
4587db74cek * read into a 64k read, which doesn't affect latency all that much but is
46fa9e406ahrens * terribly wasteful of bandwidth.  A more intelligent version of the cache
47fa9e406ahrens * could keep track of access patterns and not do read-ahead unless it sees
48fdb2e90ek * at least two temporally close I/Os to the same region.  Currently, only
49fdb2e90ek * metadata I/O is inflated.  A futher enhancement could take advantage of
50fdb2e90ek * more semantic information about the I/O.  And it could use something
51fdb2e90ek * faster than an AVL tree; that was chosen solely for convenience.
52fa9e406ahrens *
53fa9e406ahrens * There are five cache operations: allocate, fill, read, write, evict.
54fa9e406ahrens *
55fa9e406ahrens * (1) Allocate.  This reserves a cache entry for the specified region.
56fa9e406ahrens *     We separate the allocate and fill operations so that multiple threads
57fa9e406ahrens *     don't generate I/O for the same cache miss.
58fa9e406ahrens *
59fa9e406ahrens * (2) Fill.  When the I/O for a cache miss completes, the fill routine
60fa9e406ahrens *     places the data in the previously allocated cache entry.
61fa9e406ahrens *
62fa9e406ahrens * (3) Read.  Read data from the cache.
63fa9e406ahrens *
64fa9e406ahrens * (4) Write.  Update cache contents after write completion.
65fa9e406ahrens *
66fa9e406ahrens * (5) Evict.  When allocating a new entry, we evict the oldest (LRU) entry
67614409bahrens *     if the total cache size exceeds zfs_vdev_cache_size.
68fa9e406ahrens */
69fa9e406ahrens
70614409bahrens/*
71614409bahrens * These tunables are for performance analysis.
72614409bahrens */
73614409bahrens/*
74614409bahrens * All i/os smaller than zfs_vdev_cache_max will be turned into
75614409bahrens * 1<<zfs_vdev_cache_bshift byte reads by the vdev_cache (aka software
7687db74cek * track buffer).  At most zfs_vdev_cache_size bytes will be kept in each
77614409bahrens * vdev's vdev_cache.
78b68a40aGarrett D'Amore *
79b68a40aGarrett D'Amore * TODO: Note that with the current ZFS code, it turns out that the
80b68a40aGarrett D'Amore * vdev cache is not helpful, and in some cases actually harmful.  It
81b68a40aGarrett D'Amore * is better if we disable this.  Once some time has passed, we should
82b68a40aGarrett D'Amore * actually remove this to simplify the code.  For now we just disable
83b68a40aGarrett D'Amore * it by setting the zfs_vdev_cache_size to zero.  Note that Solaris 11
84b68a40aGarrett D'Amore * has made these same changes.
85614409bahrens */
8687db74cekint zfs_vdev_cache_max = 1<<14;			/* 16KB */
87b68a40aGarrett D'Amoreint zfs_vdev_cache_size = 0;
88614409bahrensint zfs_vdev_cache_bshift = 16;
89614409bahrens
9087db74cek#define	VCBS (1 << zfs_vdev_cache_bshift)	/* 64KB */
9187db74cek
9287db74cekkstat_t	*vdc_ksp = NULL;
9387db74cek
9487db74cektypedef struct vdc_stats {
9587db74cek	kstat_named_t vdc_stat_delegations;
9687db74cek	kstat_named_t vdc_stat_hits;
9787db74cek	kstat_named_t vdc_stat_misses;
9887db74cek} vdc_stats_t;
9987db74cek
10087db74cekstatic vdc_stats_t vdc_stats = {
10187db74cek	{ "delegations",	KSTAT_DATA_UINT64 },
10287db74cek	{ "hits",		KSTAT_DATA_UINT64 },
10387db74cek	{ "misses",		KSTAT_DATA_UINT64 }
10487db74cek};
10587db74cek
1061a5e258Josef 'Jeff' Sipek#define	VDCSTAT_BUMP(stat)	atomic_inc_64(&vdc_stats.stat.value.ui64);
107614409bahrens
108c4ab0d3Gvozden Neskovicstatic inline int
109fa9e406ahrensvdev_cache_offset_compare(const void *a1, const void *a2)
110fa9e406ahrens{
111c4ab0d3Gvozden Neskovic	const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1;
112c4ab0d3Gvozden Neskovic	const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2;
113c4ab0d3Gvozden Neskovic
1144d7988dPaul Dagnelie	return (TREE_CMP(ve1->ve_offset, ve2->ve_offset));
115fa9e406ahrens}
116fa9e406ahrens
117fa9e406ahrensstatic int
118fa9e406ahrensvdev_cache_lastused_compare(const void *a1, const void *a2)
119fa9e406ahrens{
120c4ab0d3Gvozden Neskovic	const vdev_cache_entry_t *ve1 = (const vdev_cache_entry_t *)a1;
121c4ab0d3Gvozden Neskovic	const vdev_cache_entry_t *ve2 = (const vdev_cache_entry_t *)a2;
122fa9e406ahrens
1234d7988dPaul Dagnelie	int cmp = TREE_CMP(ve1->ve_lastused, ve2->ve_lastused);
124c4ab0d3Gvozden Neskovic	if (likely(cmp))
125c4ab0d3Gvozden Neskovic		return (cmp);
126fa9e406ahrens
127fa9e406ahrens	/*
128fa9e406ahrens	 * Among equally old entries, sort by offset to ensure uniqueness.
129fa9e406ahrens	 */
130fa9e406ahrens	return (vdev_cache_offset_compare(a1, a2));
131fa9e406ahrens}
132fa9e406ahrens
133fa9e406ahrens/*
134fa9e406ahrens * Evict the specified entry from the cache.
135fa9e406ahrens */
136fa9e406ahrensstatic void
137fa9e406ahrensvdev_cache_evict(vdev_cache_t *vc, vdev_cache_entry_t *ve)
138fa9e406ahrens{
139fa9e406ahrens	ASSERT(MUTEX_HELD(&vc->vc_lock));
140770499eDan Kimmel	ASSERT3P(ve->ve_fill_io, ==, NULL);
141770499eDan Kimmel	ASSERT3P(ve->ve_abd, !=, NULL);
142fa9e406ahrens
143fa9e406ahrens	avl_remove(&vc->vc_lastused_tree, ve);
144fa9e406ahrens	avl_remove(&vc->vc_offset_tree, ve);
145770499eDan Kimmel	abd_free(ve->ve_abd);
146fa9e406ahrens	kmem_free(ve, sizeof (vdev_cache_entry_t));
147fa9e406ahrens}
148fa9e406ahrens
149fa9e406ahrens/*
150fa9e406ahrens * Allocate an entry in the cache.  At the point we don't have the data,
151fa9e406ahrens * we're just creating a placeholder so that multiple threads don't all
152fa9e406ahrens * go off and read the same blocks.
153fa9e406ahrens */
154fa9e406ahrensstatic vdev_cache_entry_t *
155fa9e406ahrensvdev_cache_allocate(zio_t *zio)
156fa9e406ahrens{
157fa9e406ahrens	vdev_cache_t *vc = &zio->io_vd->vdev_cache;
158614409bahrens	uint64_t offset = P2ALIGN(zio->io_offset, VCBS);
159fa9e406ahrens	vdev_cache_entry_t *ve;
160fa9e406ahrens
161fa9e406ahrens	ASSERT(MUTEX_HELD(&vc->vc_lock));
162fa9e406ahrens
163614409bahrens	if (zfs_vdev_cache_size == 0)
164fa9e406ahrens		return (NULL);
165fa9e406ahrens
166fa9e406ahrens	/*
167fa9e406ahrens	 * If adding a new entry would exceed the cache size,
168fa9e406ahrens	 * evict the oldest entry (LRU).
169fa9e406ahrens	 */
170614409bahrens	if ((avl_numnodes(&vc->vc_lastused_tree) << zfs_vdev_cache_bshift) >
171614409bahrens	    zfs_vdev_cache_size) {
172fa9e406ahrens		ve = avl_first(&vc->vc_lastused_tree);
173e14bb32Jeff Bonwick		if (ve->ve_fill_io != NULL)
174fa9e406ahrens			return (NULL);
175770499eDan Kimmel		ASSERT3U(ve->ve_hits, !=, 0);
176fa9e406ahrens		vdev_cache_evict(vc, ve);
177fa9e406ahrens	}
178fa9e406ahrens
179fa9e406ahrens	ve = kmem_zalloc(sizeof (vdev_cache_entry_t), KM_SLEEP);
180fa9e406ahrens	ve->ve_offset = offset;
181d3d5073Rafael Vanoni	ve->ve_lastused = ddi_get_lbolt();
182770499eDan Kimmel	ve->ve_abd = abd_alloc_for_io(VCBS, B_TRUE);
183fa9e406ahrens
184fa9e406ahrens	avl_add(&vc->vc_offset_tree, ve);
185fa9e406ahrens	avl_add(&vc->vc_lastused_tree, ve);
186fa9e406ahrens
187fa9e406ahrens	return (ve);
188fa9e406ahrens}
189fa9e406ahrens
190fa9e406ahrensstatic void
191fa9e406ahrensvdev_cache_hit(vdev_cache_t *vc, vdev_cache_entry_t *ve, zio_t *zio)
192fa9e406ahrens{
193614409bahrens	uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS);
194fa9e406ahrens
195fa9e406ahrens	ASSERT(MUTEX_HELD(&vc->vc_lock));
196770499eDan Kimmel	ASSERT3P(ve->ve_fill_io, ==, NULL);
197fa9e406ahrens
198d3d5073Rafael Vanoni	if (ve->ve_lastused != ddi_get_lbolt()) {
199fa9e406ahrens		avl_remove(&vc->vc_lastused_tree, ve);
200d3d5073Rafael Vanoni		ve->ve_lastused = ddi_get_lbolt();
201fa9e406ahrens		avl_add(&vc->vc_lastused_tree, ve);
202fa9e406ahrens	}
203fa9e406ahrens
204fa9e406ahrens	ve->ve_hits++;
205770499eDan Kimmel	abd_copy_off(zio->io_abd, ve->ve_abd, 0, cache_phase, zio->io_size);
206fa9e406ahrens}
207fa9e406ahrens
208fa9e406ahrens/*
209fa9e406ahrens * Fill a previously allocated cache entry with data.
210fa9e406ahrens */
211fa9e406ahrensstatic void
212a3f829aBill Moorevdev_cache_fill(zio_t *fio)
213fa9e406ahrens{
214a3f829aBill Moore	vdev_t *vd = fio->io_vd;
215fa9e406ahrens	vdev_cache_t *vc = &vd->vdev_cache;
216a3f829aBill Moore	vdev_cache_entry_t *ve = fio->io_private;
217a3f829aBill Moore	zio_t *pio;
218fa9e406ahrens
219770499eDan Kimmel	ASSERT3U(fio->io_size, ==, VCBS);
220fa9e406ahrens
221fa9e406ahrens	/*
222fa9e406ahrens	 * Add data to the cache.
223fa9e406ahrens	 */
224fa9e406ahrens	mutex_enter(&vc->vc_lock);
225fa9e406ahrens
226770499eDan Kimmel	ASSERT3P(ve->ve_fill_io, ==, fio);
227770499eDan Kimmel	ASSERT3U(ve->ve_offset, ==, fio->io_offset);
228770499eDan Kimmel	ASSERT3P(ve->ve_abd, ==, fio->io_abd);
229fa9e406ahrens
230fa9e406ahrens	ve->ve_fill_io = NULL;
231fa9e406ahrens
232fa9e406ahrens	/*
233fa9e406ahrens	 * Even if this cache line was invalidated by a missed write update,
234fa9e406ahrens	 * any reads that were queued up before the missed update are still
235fa9e406ahrens	 * valid, so we can satisfy them from this line before we evict it.
236fa9e406ahrens	 */
2370f7643cGeorge Wilson	zio_link_t *zl = NULL;
2380f7643cGeorge Wilson	while ((pio = zio_walk_parents(fio, &zl)) != NULL)
239a3f829aBill Moore		vdev_cache_hit(vc, ve, pio);
240fa9e406ahrens
241a3f829aBill Moore	if (fio->io_error || ve->ve_missed_update)
242fa9e406ahrens		vdev_cache_evict(vc, ve);
243fa9e406ahrens
244fa9e406ahrens	mutex_exit(&vc->vc_lock);
245fa9e406ahrens}
246fa9e406ahrens
247fa9e406ahrens/*
24843466aaMax Grossman * Read data from the cache.  Returns B_TRUE cache hit, B_FALSE on miss.
249fa9e406ahrens */
25043466aaMax Grossmanboolean_t
251fa9e406ahrensvdev_cache_read(zio_t *zio)
252fa9e406ahrens{
253fa9e406ahrens	vdev_cache_t *vc = &zio->io_vd->vdev_cache;
254fa9e406ahrens	vdev_cache_entry_t *ve, ve_search;
255614409bahrens	uint64_t cache_offset = P2ALIGN(zio->io_offset, VCBS);
256614409bahrens	uint64_t cache_phase = P2PHASE(zio->io_offset, VCBS);
257fa9e406ahrens	zio_t *fio;
258fa9e406ahrens
259770499eDan Kimmel	ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);
260fa9e406ahrens
261fa9e406ahrens	if (zio->io_flags & ZIO_FLAG_DONT_CACHE)
26243466aaMax Grossman		return (B_FALSE);
263fa9e406ahrens
264614409bahrens	if (zio->io_size > zfs_vdev_cache_max)
26543466aaMax Grossman		return (B_FALSE);
266fa9e406ahrens
267fa9e406ahrens	/*
268fa9e406ahrens	 * If the I/O straddles two or more cache blocks, don't cache it.
269fa9e406ahrens	 */
27088b7b0fMatthew Ahrens	if (P2BOUNDARY(zio->io_offset, zio->io_size, VCBS))
27143466aaMax Grossman		return (B_FALSE);
272fa9e406ahrens
273770499eDan Kimmel	ASSERT3U(cache_phase + zio->io_size, <=, VCBS);
274fa9e406ahrens
275fa9e406ahrens	mutex_enter(&vc->vc_lock);
276fa9e406ahrens
277fa9e406ahrens	ve_search.ve_offset = cache_offset;
278fa9e406ahrens	ve = avl_find(&vc->vc_offset_tree, &ve_search, NULL);
279fa9e406ahrens
280fa9e406ahrens	if (ve != NULL) {
281fa9e406ahrens		if (ve->ve_missed_update) {
282fa9e406ahrens			mutex_exit(&vc->vc_lock);
28343466aaMax Grossman			return (B_FALSE);
284fa9e406ahrens		}
285fa9e406ahrens
286fa9e406ahrens		if ((fio = ve->ve_fill_io) != NULL) {
287fa9e406ahrens			zio_vdev_io_bypass(zio);
288a3f829aBill Moore			zio_add_child(zio, fio);
289fa9e406ahrens			mutex_exit(&vc->vc_lock);
29087db74cek			VDCSTAT_BUMP(vdc_stat_delegations);
29143466aaMax Grossman			return (B_TRUE);
292fa9e406ahrens		}
293fa9e406ahrens
294fa9e406ahrens		vdev_cache_hit(vc, ve, zio);
295fa9e406ahrens		zio_vdev_io_bypass(zio);
296fa9e406ahrens
297fa9e406ahrens		mutex_exit(&vc->vc_lock);
29887db74cek		VDCSTAT_BUMP(vdc_stat_hits);
29943466aaMax Grossman		return (B_TRUE);
300fa9e406ahrens	}
301fa9e406ahrens
302fa9e406ahrens	ve = vdev_cache_allocate(zio);
303fa9e406ahrens
304fa9e406ahrens	if (ve == NULL) {
305fa9e406ahrens		mutex_exit(&vc->vc_lock);
30643466aaMax Grossman		return (B_FALSE);
307fa9e406ahrens	}
308fa9e406ahrens
309e14bb32Jeff Bonwick	fio = zio_vdev_delegated_io(zio->io_vd, cache_offset,
310770499eDan Kimmel	    ve->ve_abd, VCBS, ZIO_TYPE_READ, ZIO_PRIORITY_NOW,
311e14bb32Jeff Bonwick	    ZIO_FLAG_DONT_CACHE, vdev_cache_fill, ve);
312fa9e406ahrens
313fa9e406ahrens	ve->ve_fill_io = fio;
314fa9e406ahrens	zio_vdev_io_bypass(zio);
315a3f829aBill Moore	zio_add_child(zio, fio);
316fa9e406ahrens
317fa9e406ahrens	mutex_exit(&vc->vc_lock);
318fa9e406ahrens	zio_nowait(fio);
31987db74cek	VDCSTAT_BUMP(vdc_stat_misses);
320fa9e406ahrens
32143466aaMax Grossman	return (B_TRUE);
322fa9e406ahrens}
323fa9e406ahrens
324fa9e406ahrens/*
325fa9e406ahrens * Update cache contents upon write completion.
326fa9e406ahrens */
327fa9e406ahrensvoid
328fa9e406ahrensvdev_cache_write(zio_t *zio)
329fa9e406ahrens{
330fa9e406ahrens	vdev_cache_t *vc = &zio->io_vd->vdev_cache;
331fa9e406ahrens	vdev_cache_entry_t *ve, ve_search;
332fa9e406ahrens	uint64_t io_start = zio->io_offset;
333fa9e406ahrens	uint64_t io_end = io_start + zio->io_size;
334614409bahrens	uint64_t min_offset = P2ALIGN(io_start, VCBS);
335614409bahrens	uint64_t max_offset = P2ROUNDUP(io_end, VCBS);
336fa9e406ahrens	avl_index_t where;
337fa9e406ahrens
338770499eDan Kimmel	ASSERT3U(zio->io_type, ==, ZIO_TYPE_WRITE);
339fa9e406ahrens
340fa9e406ahrens	mutex_enter(&vc->vc_lock);
341fa9e406ahrens
342fa9e406ahrens	ve_search.ve_offset = min_offset;
343fa9e406ahrens	ve = avl_find(&vc->vc_offset_tree, &ve_search, &where);
344fa9e406ahrens
345fa9e406ahrens	if (ve == NULL)
346fa9e406ahrens		ve = avl_nearest(&vc->vc_offset_tree, where, AVL_AFTER);
347fa9e406ahrens
348fa9e406ahrens	while (ve != NULL && ve->ve_offset < max_offset) {
349fa9e406ahrens		uint64_t start = MAX(ve->ve_offset, io_start);
350614409bahrens		uint64_t end = MIN(ve->ve_offset + VCBS, io_end);
351fa9e406ahrens
352fa9e406ahrens		if (ve->ve_fill_io != NULL) {
353fa9e406ahrens			ve->ve_missed_update = 1;
354fa9e406ahrens		} else {
355770499eDan Kimmel			abd_copy_off(ve->ve_abd, zio->io_abd,
356770499eDan Kimmel			    start - ve->ve_offset, start - io_start,
357770499eDan Kimmel			    end - start);
358fa9e406ahrens		}
359fa9e406ahrens		ve = AVL_NEXT(&vc->vc_offset_tree, ve);
360fa9e406ahrens	}
361fa9e406ahrens	mutex_exit(&vc->vc_lock);
362fa9e406ahrens}
363fa9e406ahrens
364fa9e406ahrensvoid
3653d7072feschrockvdev_cache_purge(vdev_t *vd)
3663d7072feschrock{
3673d7072feschrock	vdev_cache_t *vc = &vd->vdev_cache;
3683d7072feschrock	vdev_cache_entry_t *ve;
3693d7072feschrock
3703d7072feschrock	mutex_enter(&vc->vc_lock);
3713d7072feschrock	while ((ve = avl_first(&vc->vc_offset_tree)) != NULL)
3723d7072feschrock		vdev_cache_evict(vc, ve);
3733d7072feschrock	mutex_exit(&vc->vc_lock);
3743d7072feschrock}
3753d7072feschrock
3763d7072feschrockvoid
377fa9e406ahrensvdev_cache_init(vdev_t *vd)
378fa9e406ahrens{
379fa9e406ahrens	vdev_cache_t *vc = &vd->vdev_cache;
380fa9e406ahrens
381fa9e406ahrens	mutex_init(&vc->vc_lock, NULL, MUTEX_DEFAULT, NULL);
382fa9e406ahrens
383fa9e406ahrens	avl_create(&vc->vc_offset_tree, vdev_cache_offset_compare,
384fa9e406ahrens	    sizeof (vdev_cache_entry_t),
385fa9e406ahrens	    offsetof(struct vdev_cache_entry, ve_offset_node));
386fa9e406ahrens
387fa9e406ahrens	avl_create(&vc->vc_lastused_tree, vdev_cache_lastused_compare,
388fa9e406ahrens	    sizeof (vdev_cache_entry_t),
389fa9e406ahrens	    offsetof(struct vdev_cache_entry, ve_lastused_node));
390fa9e406ahrens}
391fa9e406ahrens
392fa9e406ahrensvoid
393fa9e406ahrensvdev_cache_fini(vdev_t *vd)
394fa9e406ahrens{
395fa9e406ahrens	vdev_cache_t *vc = &vd->vdev_cache;
396fa9e406ahrens
3973d7072feschrock	vdev_cache_purge(vd);
398fa9e406ahrens
399fa9e406ahrens	avl_destroy(&vc->vc_offset_tree);
400fa9e406ahrens	avl_destroy(&vc->vc_lastused_tree);
401fa9e406ahrens
402fa9e406ahrens	mutex_destroy(&vc->vc_lock);
403fa9e406ahrens}
40487db74cek
40587db74cekvoid
40687db74cekvdev_cache_stat_init(void)
40787db74cek{
40887db74cek	vdc_ksp = kstat_create("zfs", 0, "vdev_cache_stats", "misc",
40987db74cek	    KSTAT_TYPE_NAMED, sizeof (vdc_stats) / sizeof (kstat_named_t),
41087db74cek	    KSTAT_FLAG_VIRTUAL);
41187db74cek	if (vdc_ksp != NULL) {
41287db74cek		vdc_ksp->ks_data = &vdc_stats;
41387db74cek		kstat_install(vdc_ksp);
41487db74cek	}
41587db74cek}
41687db74cek
41787db74cekvoid
41887db74cekvdev_cache_stat_fini(void)
41987db74cek{
42087db74cek	if (vdc_ksp != NULL) {
42187db74cek		kstat_delete(vdc_ksp);
42287db74cek		vdc_ksp = NULL;
42387db74cek	}
42487db74cek}
425