]>
Commit | Line | Data |
---|---|---|
34dc7c2f BB |
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 | |
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 | /* | |
428870ff | 22 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
34dc7c2f BB |
23 | * Use is subject to license terms. |
24 | */ | |
25 | ||
7f60329a MA |
26 | /* |
27 | * Copyright (c) 2014 by Delphix. All rights reserved. | |
28 | */ | |
29 | ||
30 | #ifndef _DMU_ZFETCH_H | |
31 | #define _DMU_ZFETCH_H | |
34dc7c2f | 32 | |
34dc7c2f BB |
33 | #include <sys/zfs_context.h> |
34 | ||
35 | #ifdef __cplusplus | |
36 | extern "C" { | |
37 | #endif | |
38 | ||
c409e464 | 39 | extern unsigned long zfetch_array_rd_sz; |
34dc7c2f BB |
40 | |
41 | struct dnode; /* so we can reference dnode */ | |
42 | ||
34dc7c2f | 43 | typedef struct zstream { |
7f60329a MA |
44 | uint64_t zs_blkid; /* expect next access at this blkid */ |
45 | uint64_t zs_pf_blkid; /* next block to prefetch */ | |
755065f3 AM |
46 | |
47 | /* | |
48 | * We will next prefetch the L1 indirect block of this level-0 | |
49 | * block id. | |
50 | */ | |
51 | uint64_t zs_ipf_blkid; | |
52 | ||
7f60329a MA |
53 | kmutex_t zs_lock; /* protects stream */ |
54 | hrtime_t zs_atime; /* time last prefetch issued */ | |
55 | list_node_t zs_node; /* link for zf_stream */ | |
34dc7c2f BB |
56 | } zstream_t; |
57 | ||
58 | typedef struct zfetch { | |
59 | krwlock_t zf_rwlock; /* protects zfetch structure */ | |
7f60329a | 60 | list_t zf_stream; /* list of zstream_t's */ |
34dc7c2f | 61 | struct dnode *zf_dnode; /* dnode that owns this zfetch */ |
34dc7c2f BB |
62 | } zfetch_t; |
63 | ||
428870ff BB |
64 | void zfetch_init(void); |
65 | void zfetch_fini(void); | |
66 | ||
34dc7c2f | 67 | void dmu_zfetch_init(zfetch_t *, struct dnode *); |
7f60329a | 68 | void dmu_zfetch_fini(zfetch_t *); |
755065f3 | 69 | void dmu_zfetch(zfetch_t *, uint64_t, uint64_t, boolean_t); |
34dc7c2f BB |
70 | |
71 | ||
72 | #ifdef __cplusplus | |
73 | } | |
74 | #endif | |
75 | ||
7f60329a | 76 | #endif /* _DMU_ZFETCH_H */ |