FreeBSD ZFS
The Zettabyte File System

sys/dmu_zfetch.h

Go to the documentation of this file.
00001 /*
00002  * CDDL HEADER START
00003  *
00004  * The contents of this file are subject to the terms of the
00005  * Common Development and Distribution License (the "License").
00006  * You may not use this file except in compliance with the License.
00007  *
00008  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
00009  * or http://www.opensolaris.org/os/licensing.
00010  * See the License for the specific language governing permissions
00011  * and limitations under the License.
00012  *
00013  * When distributing Covered Code, include this CDDL HEADER in each
00014  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
00015  * If applicable, add the following below this CDDL HEADER, with the
00016  * fields enclosed by brackets "[]" replaced with your own identifying
00017  * information: Portions Copyright [yyyy] [name of copyright owner]
00018  *
00019  * CDDL HEADER END
00020  */
00021 /*
00022  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
00023  * Use is subject to license terms.
00024  */
00025 
00026 #ifndef _DFETCH_H
00027 #define _DFETCH_H
00028 
00029 #include <sys/zfs_context.h>
00030 
00031 #ifdef  __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035 extern uint64_t zfetch_array_rd_sz;
00036 
00037 struct dnode;                           
00039 typedef enum zfetch_dirn {
00040         ZFETCH_FORWARD = 1,             
00041         ZFETCH_BACKWARD = -1            
00042 } zfetch_dirn_t;
00043 
00044 typedef struct zstream {
00045         uint64_t        zst_offset;     
00046         uint64_t        zst_len;        
00047         zfetch_dirn_t   zst_direction;  
00048         uint64_t        zst_stride;     
00049         uint64_t        zst_ph_offset;  
00050         uint64_t        zst_cap;        
00051         kmutex_t        zst_lock;       
00052         clock_t         zst_last;       
00053         avl_node_t      zst_node;       
00054 } zstream_t;
00055 
00056 typedef struct zfetch {
00057         krwlock_t       zf_rwlock;      
00058         list_t          zf_stream;      
00059         struct dnode    *zf_dnode;      
00060         uint32_t        zf_stream_cnt;  
00061         uint64_t        zf_alloc_fail;  
00062 } zfetch_t;
00063 
00064 void            zfetch_init(void);
00065 void            zfetch_fini(void);
00066 
00067 void            dmu_zfetch_init(zfetch_t *, struct dnode *);
00068 void            dmu_zfetch_rele(zfetch_t *);
00069 void            dmu_zfetch(zfetch_t *, uint64_t, uint64_t, int);
00070 
00071 
00072 #ifdef  __cplusplus
00073 }
00074 #endif
00075 
00076 #endif  /* _DFETCH_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines