#if defined(AFS_LINUX24_ENV)
#include "h/smp_lock.h"
#endif
-#if defined(AFS_CACHE_BYPASS)
#include "afs/lock.h"
#include "afs/afs_bypasscache.h"
-#endif
#ifdef pgoff2loff
#define pageoff(pp) pgoff2loff((pp)->index)
{
ssize_t code = 0;
struct vcache *vcp = VTOAFS(fp->f_dentry->d_inode);
-#if defined(AFS_CACHE_BYPASS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
afs_size_t isize, offindex;
#endif
code = afs_linux_VerifyVCache(vcp, NULL);
if (code == 0) {
-#if defined(AFS_CACHE_BYPASS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
isize = (i_size_read(fp->f_mapping->host) - 1) >> PAGE_CACHE_SHIFT;
offindex = *offp >> PAGE_CACHE_SHIFT;
if(offindex > isize) {
afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER, vcp,
ICL_TYPE_OFFSET, offp, ICL_TYPE_INT32, count, ICL_TYPE_INT32,
code);
-#if defined(AFS_CACHE_BYPASS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
done:
#endif
AFS_GUNLOCK();
struct vcache *vcp;
cred_t *credp;
int code;
-#if defined(AFS_CACHE_BYPASS)
int bypasscache;
-#endif
AFS_GLOCK();
code = afs_InitReq(&treq, credp);
if (code)
goto out;
-#if defined(AFS_CACHE_BYPASS)
/* If caching is bypassed for this file, or globally, just return 0 */
if(cache_bypass_strategy == ALWAYS_BYPASS_CACHE)
bypasscache = 1;
/* future proof: don't rely on 0 return from afs_InitReq */
code = 0; goto out;
}
-#endif
ObtainSharedLock(&vcp->lock, 535);
if ((vcp->execsOrWriters > 0) && (file_count(fp) == 1)) {
ulong address = afs_linux_page_address(pp);
afs_offs_t offset = pageoff(pp);
#endif
-#if defined(AFS_CACHE_BYPASS)
afs_int32 bypasscache = 0; /* bypass for this read */
struct nocache_read_request *ancr;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
afs_int32 isize;
#endif
-#endif
uio_t *auio;
struct iovec *iovecp;
struct inode *ip = FILE_INODE(fp);
setup_uio(auio, iovecp, (char *)address, offset, PAGE_SIZE, UIO_READ,
AFS_UIOSYS);
-#if defined(AFS_CACHE_BYPASS)
bypasscache = afs_linux_can_bypass(ip);
/* In the new incarnation of selective caching, a file's caching policy
goto done; /* skips release page, doing it in bg thread */
}
-#endif
#ifdef AFS_LINUX24_ENV
maybe_lock_kernel();
free_page(address);
#endif
-#if defined(AFS_CACHE_BYPASS)
/* do not call afs_GetDCache if cache is bypassed */
if(bypasscache)
goto done;
-#endif
/* free if not bypassing cache */
osi_Free(auio, sizeof(uio_t));
AFS_GUNLOCK();
}
-#if defined(AFS_CACHE_BYPASS)
done:
-#endif
crfree(credp);
return afs_convert_code(code);
}