3 * THE REGENTS OF THE UNIVERSITY OF MICHIGAN
6 * Permission is granted to use, copy, create derivative works
7 * and redistribute this software and such derivative works
8 * for any purpose, so long as the name of The University of
9 * Michigan is not used in any advertising or publicity
10 * pertaining to the use of distribution of this software
11 * without specific, written prior authorization. If the
12 * above copyright notice or any other identification of the
13 * University of Michigan is included in any copy of any
14 * portion of this software, then the disclaimer below must
17 * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
18 * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
19 * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY O
20 * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
21 * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
23 * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
24 * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
25 * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
26 * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
27 * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
32 * Portions Copyright (c) 2008
33 * The Linux Box Corporation
36 * Permission is granted to use, copy, create derivative works
37 * and redistribute this software and such derivative works
38 * for any purpose, so long as the name of the Linux Box
39 * Corporation is not used in any advertising or publicity
40 * pertaining to the use or distribution of this software
41 * without specific, written prior authorization. If the
42 * above copyright notice or any other identification of the
43 * Linux Box Corporation is included in any copy of any
44 * portion of this software, then the disclaimer below must
47 * This software is provided as is, without representation
48 * from the Linux Box Corporation as to its fitness for any
49 * purpose, and without warranty by the Linux Box Corporation
50 * of any kind, either express or implied, including
51 * without limitation the implied warranties of
52 * merchantability and fitness for a particular purpose. The
53 * Linux Box Corporation shall not be liable for any damages,
54 * including special, indirect, incidental, or consequential
55 * damages, with respect to any claim arising out of or in
56 * connection with the use of the software, even if it has been
57 * or is hereafter advised of the possibility of such damages.
61 #ifndef _AFS_BYPASSCACHE_H
62 #define _AFS_BYPASSCACHE_H
64 #if defined(AFS_CACHE_BYPASS)
66 #include <afsconfig.h>
67 #include "afs/param.h"
68 #include "afs/sysincludes.h"
69 #include "afsincludes.h"
71 #define AFS_CACHE_BYPASS_DISABLED -1
74 typedef struct uio uio_t;
76 #define PAGE_SIZE 1024 * sizeof(long) / 8
80 /* A ptr to an object of the following type is expected to be passed
81 * as the ab->parm[0] to afs_BQueue */
82 struct nocache_read_request {
83 /* Why can't we all get along? */
84 #if defined(AFS_SUN5_ENV)
89 #elif defined(AFS_SGI_ENV)
90 /* SGI (of some vintage) */
95 #elif defined(AFS_LINUX24_ENV) || defined(AFS_USR_LINUX24_ENV)
96 /* The tested platform, as CITI impl. just packs ab->parms */
98 struct vrequest *areq;
104 enum cache_bypass_strategies
108 LARGE_FILES_BYPASS_CACHE
111 extern int cache_bypass_prefetch;
112 extern int cache_bypass_strategy;
113 extern int cache_bypass_threshold;
115 void afs_TransitionToBypass(register struct vcache *, register AFS_UCRED *, int);
116 void afs_TransitionToCaching(register struct vcache *, register AFS_UCRED *, int);
118 /* Cache strategy permits vnode transition between caching and no-cache--
119 * currently, this means LARGE_FILES_BYPASS_CACHE. Currently, no pioctl permits
120 * setting FCSBypass manually for a vnode */
121 #define variable_cache_strategy \
122 (! ((cache_bypass_strategy == ALWAYS_BYPASS_CACHE) || \
123 (cache_bypass_strategy == NEVER_BYPASS_CACHE)) )
125 /* Cache-coherently toggle cache/no-cache for a vnode */
126 #define trydo_cache_transition(avc, credp, bypasscache) \
128 if(variable_cache_strategy) { \
130 if(!(avc->cachingStates & FCSBypass)) \
131 afs_TransitionToBypass(avc, credp, TRANSChangeDesiredBit); \
133 if(avc->cachingStates & FCSBypass) \
134 afs_TransitionToCaching(avc, credp, TRANSChangeDesiredBit); \
140 /* dispatch a no-cache read request */
142 afs_ReadNoCache(register struct vcache *avc, register struct nocache_read_request *bparms,
145 /* no-cache prefetch routine */
147 afs_PrefetchNoCache(register struct vcache *avc, register AFS_UCRED *acred,
148 struct nocache_read_request *bparms);
151 #endif /* AFS_CACHE_BYPASS */
152 #endif /* _AFS_BYPASSCACHE_H */