[OpenAFS-devel] reproducible problem during cache flush
chas williams
chas@cmf.nrl.navy.mil
Fri, 02 Aug 2002 18:30:43 -0400
In message <200207301752.NAA17090@contents-vnder-pressvre.mit.edu>,Nickolai Zel
dovich writes:
>On a slightly related note, I also noticed that the Linux client never
>calls afs_PrefetchChunk. We probably want to copy the afs_PrefetchChunk
>invocation from some other VM-based platform into afs_linux_read or
>somesuch..
how 'bout this?
Index: src/afs/LINUX/osi_vnodeops.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_vnodeops.c,v
retrieving revision 1.29.2.17
diff -u -d -b -w -r1.29.2.17 osi_vnodeops.c
--- src/afs/LINUX/osi_vnodeops.c 2002/08/01 19:12:01 1.29.2.17
+++ src/afs/LINUX/osi_vnodeops.c 2002/08/02 22:24:58
@@ -1254,6 +1254,7 @@
struct iovec iovec;
struct inode *ip = FILE_INODE(fp);
int cnt = atomic_read(&pp->count);
+ struct vcache *avc = ITOAFS(ip);
AFS_GLOCK();
afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE,
@@ -1275,7 +1276,7 @@
setup_uio(&tuio, &iovec, (char*)address, offset, PAGESIZE,
UIO_READ, AFS_UIOSYS);
- code = afs_rdwr(ITOAFS(ip), &tuio, UIO_READ, 0, credp);
+ code = afs_rdwr(avc, &tuio, UIO_READ, 0, credp);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
unlock_kernel();
#endif
@@ -1300,6 +1301,20 @@
wake_up(&pp->wait);
free_page(address);
#endif
+
+ if (!code && AFS_CHUNKOFFSET(offset) == 0) {
+ struct dcache *tdc;
+ struct vrequest treq;
+
+ ObtainWriteLock(&avc->lock, 534);
+ tdc = afs_FindDCache(avc, offset);
+ if (tdc) {
+ if (!(tdc->flags & DFNextStarted))
+ afs_PrefetchChunk(avc, tdc, credp, &treq);
+ afs_PutDCache(tdc);
+ }
+ ReleaseWriteLock(&avc->lock);
+ }
crfree(credp);
afs_Trace4(afs_iclSetp, CM_TRACE_READPAGE,