config/dracut/90zfs: handle cases where hostid(1) returns all zeros
[zfs.git] / include / sys / dmu_zfetch.h
blob34b711fc06e55afd01deeb8ea10a2bc7f2f3c391
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * Copyright (c) 2014, 2017 by Delphix. All rights reserved.
30 #ifndef _DMU_ZFETCH_H
31 #define _DMU_ZFETCH_H
33 #include <sys/zfs_context.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
39 extern unsigned long zfetch_array_rd_sz;
41 struct dnode; /* so we can reference dnode */
43 typedef struct zfetch {
44 kmutex_t zf_lock; /* protects zfetch structure */
45 list_t zf_stream; /* list of zstream_t's */
46 struct dnode *zf_dnode; /* dnode that owns this zfetch */
47 int zf_numstreams; /* number of zstream_t's */
48 } zfetch_t;
50 typedef struct zstream {
51 uint64_t zs_blkid; /* expect next access at this blkid */
52 uint64_t zs_pf_blkid; /* next block to prefetch */
55 * We will next prefetch the L1 indirect block of this level-0
56 * block id.
58 uint64_t zs_ipf_blkid;
60 kmutex_t zs_lock; /* protects stream */
61 hrtime_t zs_atime; /* time last prefetch issued */
62 hrtime_t zs_start_time; /* start of last prefetch */
63 list_node_t zs_node; /* link for zf_stream */
64 zfetch_t *zs_fetch; /* parent fetch */
65 zfs_refcount_t zs_blocks; /* number of pending blocks in the stream */
66 } zstream_t;
68 void zfetch_init(void);
69 void zfetch_fini(void);
71 void dmu_zfetch_init(zfetch_t *, struct dnode *);
72 void dmu_zfetch_fini(zfetch_t *);
73 void dmu_zfetch(zfetch_t *, uint64_t, uint64_t, boolean_t,
74 boolean_t);
77 #ifdef __cplusplus
79 #endif
81 #endif /* _DMU_ZFETCH_H */