OpenAFS
OpenAFS distributed network file system
|
00001 /* 00002 * COPYRIGHT © 2000 00003 * THE REGENTS OF THE UNIVERSITY OF MICHIGAN 00004 * ALL RIGHTS RESERVED 00005 * 00006 * Permission is granted to use, copy, create derivative works 00007 * and redistribute this software and such derivative works 00008 * for any purpose, so long as the name of The University of 00009 * Michigan is not used in any advertising or publicity 00010 * pertaining to the use of distribution of this software 00011 * without specific, written prior authorization. If the 00012 * above copyright notice or any other identification of the 00013 * University of Michigan is included in any copy of any 00014 * portion of this software, then the disclaimer below must 00015 * also be included. 00016 * 00017 * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION 00018 * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY 00019 * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY O 00020 * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING 00021 * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF 00022 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE 00023 * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE 00024 * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR 00025 * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING 00026 * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN 00027 * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF 00028 * SUCH DAMAGES. 00029 */ 00030 00031 /* 00032 * Portions Copyright (c) 2008 00033 * The Linux Box Corporation 00034 * ALL RIGHTS RESERVED 00035 * 00036 * Permission is granted to use, copy, create derivative works 00037 * and redistribute this software and such derivative works 00038 * for any purpose, so long as the name of the Linux Box 00039 * Corporation is not used in any advertising or publicity 00040 * pertaining to the use or distribution of this software 00041 * without specific, written prior authorization. If the 00042 * above copyright notice or any other identification of the 00043 * Linux Box Corporation is included in any copy of any 00044 * portion of this software, then the disclaimer below must 00045 * also be included. 00046 * 00047 * This software is provided as is, without representation 00048 * from the Linux Box Corporation as to its fitness for any 00049 * purpose, and without warranty by the Linux Box Corporation 00050 * of any kind, either express or implied, including 00051 * without limitation the implied warranties of 00052 * merchantability and fitness for a particular purpose. The 00053 * Linux Box Corporation shall not be liable for any damages, 00054 * including special, indirect, incidental, or consequential 00055 * damages, with respect to any claim arising out of or in 00056 * connection with the use of the software, even if it has been 00057 * or is hereafter advised of the possibility of such damages. 00058 */ 00059 00060 00061 #ifndef _AFS_BYPASSCACHE_H 00062 #define _AFS_BYPASSCACHE_H 00063 00064 #if defined(AFS_CACHE_BYPASS) || defined(UKERNEL) 00065 #include <afsconfig.h> 00066 #include "afs/param.h" 00067 #include "afs/sysincludes.h" 00068 #include "afsincludes.h" 00069 00070 #define AFS_CACHE_BYPASS_DISABLED -1 00071 00072 #ifdef UKERNEL 00073 #ifndef PAGE_CACHE_SIZE 00074 #define PAGE_CACHE_SIZE 4096 00075 #endif 00076 #endif 00077 00078 /* A ptr to an object of the following type is expected to be passed 00079 * as the ab->parm[0] to afs_BQueue */ 00080 struct nocache_read_request { 00081 /* Why can't we all get along? */ 00082 #if defined(AFS_SUN5_ENV) 00083 /* SOLARIS */ 00084 u_offset_t offset; 00085 struct seg *segment; 00086 caddr_t address; 00087 #elif defined(AFS_LINUX24_ENV) || defined(UKERNEL) 00088 /* The tested platform, as CITI impl. just packs ab->parms */ 00089 struct uio *auio; 00090 struct vrequest *areq; 00091 afs_size_t offset; 00092 afs_size_t length; 00093 #endif 00094 }; 00095 00096 enum cache_bypass_strategies 00097 { 00098 ALWAYS_BYPASS_CACHE, 00099 NEVER_BYPASS_CACHE, 00100 LARGE_FILES_BYPASS_CACHE 00101 }; 00102 00103 extern int cache_bypass_prefetch; 00104 extern int cache_bypass_strategy; 00105 extern int cache_bypass_threshold; 00106 00107 void afs_TransitionToBypass(struct vcache *, afs_ucred_t *, int); 00108 void afs_TransitionToCaching(struct vcache *, afs_ucred_t *, int); 00109 00110 /* Cache strategy permits vnode transition between caching and no-cache-- 00111 * currently, this means LARGE_FILES_BYPASS_CACHE. Currently, no pioctl permits 00112 * setting FCSBypass manually for a vnode */ 00113 #define variable_cache_strategy \ 00114 (! ((cache_bypass_strategy == ALWAYS_BYPASS_CACHE) || \ 00115 (cache_bypass_strategy == NEVER_BYPASS_CACHE)) ) 00116 00117 /* Cache-coherently toggle cache/no-cache for a vnode */ 00118 #define trydo_cache_transition(avc, credp, bypasscache) \ 00119 do { \ 00120 if(variable_cache_strategy) { \ 00121 if(bypasscache) { \ 00122 if(!(avc->cachingStates & FCSBypass)) \ 00123 afs_TransitionToBypass(avc, credp, TRANSChangeDesiredBit); \ 00124 } else { \ 00125 if(avc->cachingStates & FCSBypass) \ 00126 afs_TransitionToCaching(avc, credp, TRANSChangeDesiredBit); \ 00127 } \ 00128 } \ 00129 } \ 00130 while(0); 00131 00132 /* dispatch a no-cache read request */ 00133 afs_int32 00134 afs_ReadNoCache(struct vcache *avc, struct nocache_read_request *bparms, 00135 afs_ucred_t *acred) AFS_NONNULL((1,2)); 00136 00137 /* no-cache prefetch routine */ 00138 afs_int32 00139 afs_PrefetchNoCache(struct vcache *avc, afs_ucred_t *acred, 00140 struct nocache_read_request *bparms); 00141 00142 #endif /* AFS_CACHE_BYPASS || UKERNEL */ 00143 #endif /* _AFS_BYPASSCACHE_H */