From 971b18bc424ac969f12166dd83d7b327b9257636 Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Thu, 1 Nov 2001 04:01:22 +0000 Subject: [PATCH] client-64bit-file-size-support-20011031 new RPCs and client-side support for large files --- src/afs/AIX/osi_vfsops.c | 3 + src/afs/AIX/osi_vnodeops.c | 212 +++++++++++++++++++-- src/afs/LINUX/osi_machdep.h | 2 +- src/afs/LINUX/osi_misc.c | 4 +- src/afs/LINUX/osi_prototypes.h | 2 +- src/afs/LINUX/osi_vfs.hin | 2 +- src/afs/LINUX/osi_vnodeops.c | 184 +++++++++++++----- src/afs/VNOPS/afs_vnop_access.c | 3 +- src/afs/VNOPS/afs_vnop_attrs.c | 7 +- src/afs/VNOPS/afs_vnop_create.c | 8 +- src/afs/VNOPS/afs_vnop_dirops.c | 8 +- src/afs/VNOPS/afs_vnop_link.c | 6 +- src/afs/VNOPS/afs_vnop_lookup.c | 10 +- src/afs/VNOPS/afs_vnop_read.c | 89 +++++---- src/afs/VNOPS/afs_vnop_readdir.c | 15 +- src/afs/VNOPS/afs_vnop_remove.c | 6 +- src/afs/VNOPS/afs_vnop_rename.c | 2 +- src/afs/VNOPS/afs_vnop_symlink.c | 34 ++-- src/afs/VNOPS/afs_vnop_write.c | 84 +++++---- src/afs/afs.h | 24 ++- src/afs/afs_analyze.c | 4 + src/afs/afs_call.c | 78 +++++++- src/afs/afs_callback.c | 165 ++++++++++++++++ src/afs/afs_chunkops.h | 11 +- src/afs/afs_daemons.c | 12 +- src/afs/afs_dcache.c | 395 +++++++++++++++++++++++++++------------ src/afs/afs_init.c | 5 + src/afs/afs_memcache.c | 83 +++++--- src/afs/afs_pioctl.c | 12 +- src/afs/afs_segments.c | 99 ++++++++-- src/afs/afs_stats.h | 1 + src/afs/afs_trace.et | 60 ++++-- src/afs/afs_vcache.c | 30 ++- src/config/icl.h | 11 +- src/config/param.i386_linux24.h | 2 + src/config/param.rs_aix42.h | 3 + src/config/param.rs_aix42_usr.h | 3 + src/dir/dir.c | 1 + src/fsint/afscbint.xg | 22 ++- src/fsint/afsint.xg | 304 ++++++++++++++++++++---------- src/fsint/common.xg | 20 +- src/fsprobe/fsprobe_callback.c | 25 ++- src/sys/afssyscalls.h | 40 ++-- src/venus/fstrace.c | 2 + src/venus/kdump.c | 53 ++++-- src/viced/afsfileprocs.c | 96 +++++++++- src/xstat/xstat_fs_callback.c | 27 ++- 47 files changed, 1738 insertions(+), 531 deletions(-) diff --git a/src/afs/AIX/osi_vfsops.c b/src/afs/AIX/osi_vfsops.c index f8b3607..4a50361 100644 --- a/src/afs/AIX/osi_vfsops.c +++ b/src/afs/AIX/osi_vfsops.c @@ -58,6 +58,9 @@ static int afs_mount(afsp, path, data) afs_globalVFS = afsp; afsp->vfs_bsize = 8192; +#ifdef AFS_64BIT_CLIENT + afsp->vfs_flag |= VFS_DEVMOUNT; +#endif /* AFS_64BIT_CLIENT */ afsp->vfs_fsid.val[0] = AFS_VFSMAGIC; /* magic */ afsp->vfs_fsid.val[1] = AFS_VFSFSID; diff --git a/src/afs/AIX/osi_vnodeops.c b/src/afs/AIX/osi_vnodeops.c index 83e82d3..173bb6c 100644 --- a/src/afs/AIX/osi_vnodeops.c +++ b/src/afs/AIX/osi_vnodeops.c @@ -802,7 +802,9 @@ struct ucred *cred; va.va_size = length; error = afs_setattr(vp, &va, cred); afs_Trace4(afs_iclSetp, CM_TRACE_GFTRUNC, ICL_TYPE_POINTER, (afs_int32)vp, - ICL_TYPE_LONG, flags, ICL_TYPE_LONG, length, ICL_TYPE_LONG, error); + ICL_TYPE_LONG, flags, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length), + ICL_TYPE_LONG, error); return(error); } @@ -827,9 +829,12 @@ struct ucred *cred; AFS_STATCNT(afs_gn_rdwr); if (vcp->vc_error) { - if (op == UIO_WRITE) + if (op == UIO_WRITE) { + afs_Trace2(afs_iclSetp, CM_TRACE_GRDWR1, + ICL_TYPE_POINTER, (afs_int32)vp, + ICL_TYPE_LONG, vcp->vc_error); return vcp->vc_error; - else + } else return EIO; } @@ -891,18 +896,30 @@ struct ucred *cred; * We do a similar thing on the afs_read/write interface. */ if (op == UIO_WRITE) { +#ifdef AFS_64BIT_CLIENT + if (ubuf->afsio_offset < afs_vmMappingEnd) { +#endif /* AFS_64BIT_ENV */ ObtainWriteLock(&vcp->lock,240); vcp->states |= CDirty; /* Set the dirty bit */ afs_FakeOpen(vcp); ReleaseWriteLock(&vcp->lock); +#ifdef AFS_64BIT_CLIENT + } +#endif /* AFS_64BIT_ENV */ } error = afs_vm_rdwr(vp, ubuf, op, flags, cred); if (op == UIO_WRITE) { +#ifdef AFS_64BIT_CLIENT + if (ubuf->afsio_offset < afs_vmMappingEnd) { +#endif /* AFS_64BIT_ENV */ ObtainWriteLock(&vcp->lock,241); afs_FakeClose(vcp, cred); /* XXXX For nfs trans and cores XXXX */ ReleaseWriteLock(&vcp->lock); +#ifdef AFS_64BIT_CLIENT + } +#endif /* AFS_64BIT_ENV */ } if (vattrp != NULL && error == 0) afs_gn_getattr(vp, vattrp, cred); @@ -915,7 +932,6 @@ struct ucred *cred; return(error); } - #define AFS_MAX_VM_CHUNKS 10 afs_vm_rdwr(vp, uiop, rw, ioflag, credp) register struct vnode *vp; @@ -926,14 +942,20 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) { register afs_int32 code = 0; register int i; - afs_int32 blockSize, fileSize; - afs_int32 xfrSize, xfrOffset; + afs_int32 blockSize; + afs_size_t fileSize, xfrOffset, offset, old_offset; + afs_int32 xfrSize; +#ifdef AFS_64BIT_CLIENT + afs_size_t finalOffset; + afs_int32 toffset; + int mixed = 0; +#endif /* AFS_64BIT_CLIENT */ register struct vcache *vcp = (struct vcache *)vp; struct dcache *tdc; - register afs_int32 start_offset; - int save_resid = uiop->afsio_resid; - int old_offset, first_page; - int offset, count, len; + afs_size_t start_offset; + afs_int32 save_resid = uiop->afsio_resid; + int first_page, last_page, pages; + int count, len; int counter = 0; struct vrequest treq; @@ -954,11 +976,48 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) goto fail; } +#ifndef AFS_64BIT_CLIENT /* check for "file too big" error, which should really be done above us */ if (rw == UIO_WRITE && xfrSize + fileSize > get_ulimit()) { code = EFBIG; goto fail; } +#endif /* AFS_64BIT_CLIENT */ + +#ifdef AFS_64BIT_CLIENT + if (xfrOffset + xfrSize > afs_vmMappingEnd) { + if (xfrOffset < afs_vmMappingEnd) { + /* special case of a buffer crossing the VM mapping line */ + struct uio tuio; + struct iovec tvec[16]; /* Should have access to #define */ + afs_int32 tsize; + + mixed = 1; + finalOffset = xfrOffset + xfrSize; + tsize = (afs_size_t) (xfrOffset + xfrSize - afs_vmMappingEnd); + afsio_copy(uiop, &tuio, tvec); + afsio_skip(&tuio, xfrSize - tsize); + afsio_trim(&tuio, tsize); + tuio.afsio_offset = afs_vmMappingEnd; + ReleaseReadLock(&vcp->lock); + ObtainWriteLock(&vcp->lock,243); + afs_FakeClose(vcp, credp); /* XXXX For nfs trans and cores XXXX */ + ReleaseWriteLock(&vcp->lock); + code = afs_direct_rdwr(vp, &tuio, rw, ioflag, credp); + ObtainWriteLock(&vcp->lock,244); + afs_FakeOpen(vcp); /* XXXX For nfs trans and cores XXXX */ + ReleaseWriteLock(&vcp->lock); + ObtainReadLock(&vcp->lock); + if (code) goto fail; + xfrSize = (afs_size_t) (afs_vmMappingEnd - xfrOffset); + afsio_trim(uiop, xfrSize); + } else { + ReleaseReadLock(&vcp->lock); + code = afs_direct_rdwr(vp, uiop, rw, ioflag, credp); + return code; + } + } +#endif /* AFS_64BIT_CLIENT */ if (!vcp->vmh) { /* Consider V_INTRSEG too for interrupts */ @@ -974,8 +1033,19 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) xfrSize = fileSize - xfrOffset; if (xfrSize <= 0) goto fail; ReleaseReadLock(&vcp->lock); +#ifdef AFS_64BIT_CLIENT + toffset = xfrOffset; + uiop->afsio_offset = xfrOffset; + afs_Trace3(afs_iclSetp, CM_TRACE_VMWRITE, + ICL_TYPE_POINTER, vcp, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(xfrOffset), + ICL_TYPE_INT32, xfrSize); + AFS_GUNLOCK(); + code = vm_move(vcp->segid, toffset, xfrSize, rw, uiop); +#else /* AFS_64BIT_CLIENT */ AFS_GUNLOCK(); code = vm_move(vcp->segid, xfrOffset, xfrSize, rw, uiop); +#endif /* AFS_64BIT_CLIENT */ AFS_GLOCK(); /* * If at a chunk boundary and staying within chunk, @@ -992,16 +1062,27 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) } ReleaseWriteLock(&vcp->lock); } +#ifdef AFS_64BIT_CLIENT + if (mixed) { + uiop->afsio_offset = finalOffset; + } +#endif /* AFS_64BIT_CLIENT */ return code; } /* UIO_WRITE */ + start_offset = uiop->afsio_offset; + afs_Trace3(afs_iclSetp, CM_TRACE_VMWRITE, + ICL_TYPE_POINTER, vcp, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(start_offset), + ICL_TYPE_INT32, xfrSize); ReleaseReadLock(&vcp->lock); ObtainWriteLock(&vcp->lock,400); vcp->m.Date = osi_Time(); /* Set file date (for ranlib) */ /* extend file */ /* un-protect last page. */ - vm_protectp(vcp->vmh, vcp->m.Length/PAGESIZE, 1, FILEKEY); + last_page = vcp->m.Length/PAGESIZE; + vm_protectp(vcp->vmh, last_page, 1, FILEKEY); if (xfrSize + xfrOffset > fileSize) { vcp->m.Length = xfrSize+xfrOffset; } @@ -1015,7 +1096,6 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) * at once. Otherwise, we'll write one chunk at a time, flushing * some of it to disk. */ - start_offset = uiop->afsio_offset; count = 0; /* Only create a page to avoid excess VM access if we're writing a @@ -1039,7 +1119,13 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) /* All data goes to this one chunk. */ AFS_GUNLOCK(); old_offset = uiop->afsio_offset; +#ifdef AFS_64BIT_CLIENT + uiop->afsio_offset = xfrOffset; + toffset = xfrOffset; + code = vm_move(vcp->segid, toffset, xfrSize, rw, uiop); +#else /* AFS_64BIT_CLIENT */ code = vm_move(vcp->segid, xfrOffset, xfrSize, rw, uiop); +#endif /* AFS_64BIT_CLIENT */ AFS_GLOCK(); xfrOffset += len; xfrSize = 0; @@ -1067,7 +1153,12 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) AFS_GUNLOCK(); old_offset = uiop->afsio_offset; +#ifdef AFS_64BIT_CLIENT + toffset = xfrOffset; + code = vm_move(vcp->segid, toffset, len, rw, &tuio); +#else /* AFS_64BIT_CLIENT */ code = vm_move(vcp->segid, xfrOffset, len, rw, &tuio); +#endif /* AFS_64BIT_CLIENT */ AFS_GLOCK(); len -= tuio.afsio_resid; afsio_skip(uiop, len); @@ -1076,9 +1167,13 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) } first_page = old_offset >> PGSHIFT; + pages = 1 + ((old_offset + (len - 1)) >> PGSHIFT) - first_page; + afs_Trace3(afs_iclSetp, CM_TRACE_VMWRITE2, + ICL_TYPE_POINTER, (afs_int32) vcp, + ICL_TYPE_INT32, first_page, + ICL_TYPE_INT32, pages); AFS_GUNLOCK(); - code = vm_writep(vcp->segid, first_page, - 1 + ((old_offset + (len - 1)) >> PGSHIFT) - first_page); + code = vm_writep(vcp->segid, first_page, pages); if (++count > AFS_MAX_VM_CHUNKS) { count = 0; vms_iowait(vcp->segid); @@ -1097,7 +1192,7 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) if (code == 0 && (vcp->states & CDirty)) { code = afs_DoPartialWrite(vcp, &treq); } - vm_protectp(vcp->vmh, vcp->m.Length/PAGESIZE, 1, RDONLY); + vm_protectp(vcp->vmh, last_page, 1, RDONLY); ReleaseWriteLock(&vcp->lock); /* If requested, fsync the file after every write */ @@ -1116,13 +1211,100 @@ afs_vm_rdwr(vp, uiop, rw, ioflag, credp) if (code == EDQUOT || code == ENOSPC) uiop->afsio_resid = save_resid; } +#ifdef AFS_64BIT_CLIENT + if (mixed) { + uiop->afsio_offset = finalOffset; + } +#endif /* AFS_64BIT_CLIENT */ fail: ReleaseReadLock(&vcp->lock); + afs_Trace2(afs_iclSetp, CM_TRACE_VMWRITE3, + ICL_TYPE_POINTER, vcp, + ICL_TYPE_INT32, code); return code; } +afs_direct_rdwr(vp, uiop, rw, ioflag, credp) + register struct vnode *vp; + struct uio *uiop; + enum uio_rw rw; + int ioflag; + struct ucred *credp; +{ + register afs_int32 code = 0; + afs_int32 xfrSize; + afs_size_t fileSize, xfrOffset, offset, old_offset; + struct vcache *vcp = (struct vcache *)vp; + afs_int32 save_resid = uiop->afsio_resid; + struct vrequest treq; + + if (code = afs_InitReq(&treq, credp)) return code; + + /* special case easy transfer; apparently a lot are done */ + if ((xfrSize=uiop->afsio_resid) == 0) return 0; + + ObtainReadLock(&vcp->lock); + fileSize = vcp->m.Length; + if (rw == UIO_WRITE && (ioflag & IO_APPEND)) { /* handle IO_APPEND mode */ + uiop->afsio_offset = fileSize; + } + /* compute xfrOffset now, and do some checks */ + xfrOffset = uiop->afsio_offset; + if (xfrOffset < 0 || xfrOffset + xfrSize < 0) { + code = EINVAL; + ReleaseReadLock(&vcp->lock); + goto fail; + } + + /* check for "file too big" error, which should really be done above us */ +#ifdef notdef + if (rw == UIO_WRITE && xfrSize + fileSize > get_ulimit()) { + code = EFBIG; + ReleaseReadLock(&vcp->lock); + goto fail; + } +#endif + ReleaseReadLock(&vcp->lock); + if (rw == UIO_WRITE) { + ObtainWriteLock(&vcp->lock,400); + vcp->m.Date = osi_Time(); /* Set file date (for ranlib) */ + /* extend file */ + if (xfrSize + xfrOffset > fileSize) { + vcp->m.Length = xfrSize+xfrOffset; + } + ReleaseWriteLock(&vcp->lock); + } + afs_Trace3(afs_iclSetp, CM_TRACE_DIRECTRDWR, + ICL_TYPE_POINTER, (afs_int32)vp, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(uiop->afsio_offset), + ICL_TYPE_LONG, uiop->afsio_resid); + code = afs_rdwr(vp, uiop, rw, ioflag, credp); + if (code != 0) { + uiop->afsio_resid = save_resid; + } else { + uiop->afsio_offset = xfrOffset + xfrSize; + if (uiop->afsio_resid > 0) { + /* should zero here the remaining buffer */ + uiop->afsio_resid = 0; + } + /* Purge dirty chunks of file if there are too many dirty chunks. + * Inside the write loop, we only do this at a chunk boundary. + * Clean up partial chunk if necessary at end of loop. + */ + if (AFS_CHUNKBASE(uiop->afsio_offset) != AFS_CHUNKBASE(xfrOffset)) { + ObtainWriteLock(&vcp->lock,402); + code = afs_DoPartialWrite(vcp, &treq); + vcp->states |= CDirty; + ReleaseWriteLock(&vcp->lock); + } + } + + fail: + return code; +} + static int lock_normalize(vp, lckdat, offset, cred) struct vnode *vp; diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 96422d9..1cea9eb 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -116,7 +116,7 @@ typedef enum { UIO_READ, UIO_WRITE } uio_flag_t; typedef struct uio { struct iovec *uio_iov; int uio_iovcnt; - int uio_offset; + afs_offs_t uio_offset; uio_seg_t uio_seg; int uio_resid; uio_flag_t uio_flag; diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 039e18d..ec345b3 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -90,7 +90,7 @@ int osi_InitCacheInfo(char *aname) cacheInode = dp->d_inode->i_ino; cacheDev.dev = dp->d_inode->i_dev; - afs_fsfragsize = dp->d_inode->i_sb->s_blocksize; + afs_fsfragsize = dp->d_inode->i_sb->s_blocksize - 1; afs_cacheSBp = dp->d_inode->i_sb; dput(dp); @@ -192,7 +192,7 @@ int osi_file_uio_rdwr(struct osi_file *osifile, uio_t *uiop, int rw) * Setup a uio struct. */ void setup_uio(uio_t *uiop, struct iovec *iovecp, char *buf, - int pos, int count, uio_flag_t flag, + afs_offs_t pos, int count, uio_flag_t flag, uio_seg_t seg) { iovecp->iov_base = buf; diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h index e2b30ee..5bcbd30 100644 --- a/src/afs/LINUX/osi_prototypes.h +++ b/src/afs/LINUX/osi_prototypes.h @@ -35,7 +35,7 @@ extern int osi_InitCacheInfo(char *aname); extern int osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize, size_t *resid); extern void inline setup_uio(uio_t *uiop, struct iovec *iovecp, char *buf, - int pos, int count, uio_flag_t flag, + afs_offs_t pos, int count, uio_flag_t flag, uio_seg_t seg); extern int osi_file_uio_rdwr(struct osi_file *osifile, uio_t *uiop, int rw); extern void afs_osi_SetTime(osi_timeval_t *tvp); diff --git a/src/afs/LINUX/osi_vfs.hin b/src/afs/LINUX/osi_vfs.hin index ee0588b..55a14f6 100644 --- a/src/afs/LINUX/osi_vfs.hin +++ b/src/afs/LINUX/osi_vfs.hin @@ -79,7 +79,7 @@ enum vcexcl { EXCL, NONEXCL } ; typedef struct vattr { int va_type; /* One of v_types above. */ - size_t va_size; + afs_size_t va_size; unsigned long va_blocks; unsigned long va_blocksize; int va_mask; /* AT_xxx operation to perform. */ diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 1227272..bf7bb13 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -66,7 +66,7 @@ static ssize_t afs_linux_read(struct file *fp, char *buf, size_t count, AFS_GLOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_INT32, (int)*offp, + ICL_TYPE_OFFSET, offp, ICL_TYPE_INT32, count, ICL_TYPE_INT32, 99999); @@ -78,14 +78,51 @@ static ssize_t afs_linux_read(struct file *fp, char *buf, size_t count, if (code) code = -code; else { - osi_FlushPages(vcp, credp); /* ensure stale pages are gone */ - AFS_GUNLOCK(); - code = generic_file_read(fp, buf, count, offp); - AFS_GLOCK(); +#ifdef AFS_64BIT_CLIENT + if (*offp + count > afs_vmMappingEnd) { + uio_t tuio; + struct iovec iov; + afs_size_t oldOffset = *offp; + afs_int32 xfered = 0; + + if (*offp < afs_vmMappingEnd) { + /* special case of a buffer crossing the VM mapping end */ + afs_int32 tcount = afs_vmMappingEnd - *offp; + count -= tcount; + osi_FlushPages(vcp, credp); /* ensure stale pages are gone */ + AFS_GUNLOCK(); + code = generic_file_read(fp, buf, tcount, offp); + AFS_GLOCK(); + if (code != tcount) { + goto done; + } + xfered = tcount; + } + setup_uio(&tuio, &iov, buf + xfered, (afs_offs_t) *offp, count, + UIO_READ, AFS_UIOSYS); + code = afs_read(vcp, &tuio, credp, 0, 0, 0); + xfered += count - tuio.uio_resid; + if (code != 0) { + code = xfered; + *offp += count - tuio.uio_resid; + } else { + code = xfered; + *offp += count; + } +done: + } else { +#endif /* AFS_64BIT_CLIENT */ + osi_FlushPages(vcp, credp); /* ensure stale pages are gone */ + AFS_GUNLOCK(); + code = generic_file_read(fp, buf, count, offp); + AFS_GLOCK(); +#ifdef AFS_64BIT_CLIENT + } +#endif /* AFS_64BIT_CLIENT */ } afs_Trace4(afs_iclSetp, CM_TRACE_READOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_INT32, (int)*offp, + ICL_TYPE_OFFSET, offp, ICL_TYPE_INT32, count, ICL_TYPE_INT32, code); @@ -111,8 +148,9 @@ static ssize_t afs_linux_write(struct file *fp, const char *buf, size_t count, AFS_GLOCK(); afs_Trace4(afs_iclSetp, CM_TRACE_WRITEOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_INT32, (int)*offp, ICL_TYPE_INT32, count, - ICL_TYPE_INT32, (fp->f_flags & O_APPEND) ? 99998 : 99999); + ICL_TYPE_OFFSET, offp, + ICL_TYPE_INT32, count, + ICL_TYPE_INT32, (fp->f_flags & O_APPEND) ? 99998 : 99999); /* get a validated vcache entry */ @@ -123,26 +161,80 @@ static ssize_t afs_linux_write(struct file *fp, const char *buf, size_t count, ObtainWriteLock(&vcp->lock, 529); afs_FakeOpen(vcp); ReleaseWriteLock(&vcp->lock); - AFS_GUNLOCK(); if (code) code = -code; else { - code = generic_file_write(fp, buf, count, offp); +#ifdef AFS_64BIT_CLIENT + if (*offp + count > afs_vmMappingEnd) { + uio_t tuio; + struct iovec iov; + afs_size_t oldOffset = *offp; + afs_int32 xfered = 0; + + if (*offp < afs_vmMappingEnd) { + /* special case of a buffer crossing the VM mapping end */ + afs_int32 tcount = afs_vmMappingEnd - *offp; + count -= tcount; + AFS_GUNLOCK(); + code = generic_file_write(fp, buf, tcount, offp); + AFS_GLOCK(); + if (code != tcount) { + goto done; + } + xfered = tcount; + } + setup_uio(&tuio, &iov, buf + xfered, (afs_offs_t) *offp, count, + UIO_WRITE, AFS_UIOSYS); + code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); + xfered += count - tuio.uio_resid; + if (code != 0) { + code = xfered; + *offp += count - tuio.uio_resid; + } else { + /* Purge dirty chunks of file if there are too many dirty chunks. + * Inside the write loop, we only do this at a chunk boundary. + * Clean up partial chunk if necessary at end of loop. + */ + if (AFS_CHUNKBASE(tuio.afsio_offset) != AFS_CHUNKBASE(oldOffset)) { + ObtainWriteLock(&vcp->lock,402); + code = afs_DoPartialWrite(vcp, &treq); + vcp->states |= CDirty; + ReleaseWriteLock(&vcp->lock); + } + code = xfered; + *offp += count; + ObtainWriteLock(&vcp->lock,400); + vcp->m.Date = osi_Time(); /* Set file date (for ranlib) */ + /* extend file */ + if (*offp > vcp->m.Length) { + vcp->m.Length = *offp; + } + ReleaseWriteLock(&vcp->lock); + } +done: + } else { +#endif /* AFS_64BIT_CLIENT */ + AFS_GUNLOCK(); + code = generic_file_write(fp, buf, count, offp); + AFS_GLOCK(); +#ifdef AFS_64BIT_CLIENT + } +#endif /* AFS_64BIT_CLIENT */ } - AFS_GLOCK(); ObtainWriteLock(&vcp->lock, 530); vcp->m.Date = osi_Time(); /* set modification time */ afs_FakeClose(vcp, credp); if (code>=0) - code2 = afs_DoPartialWrite(vcp, &treq); + code2 = afs_DoPartialWrite(vcp, &treq); if (code2 && code >=0) - code = (ssize_t) -code2; + code = (ssize_t) -code2; ReleaseWriteLock(&vcp->lock); afs_Trace4(afs_iclSetp, CM_TRACE_WRITEOP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_INT32, (int)*offp, ICL_TYPE_INT32, count, - ICL_TYPE_INT32, code); + ICL_TYPE_OFFSET, offp, + ICL_TYPE_INT32, count, + ICL_TYPE_INT32, code); AFS_GUNLOCK(); crfree(credp); @@ -166,7 +258,7 @@ static int afs_linux_readdir(struct file *fp, struct DirEntry *de; ino_t ino; int len; - int origOffset; + afs_size_t origOffset, tlen; cred_t *credp = crref(); AFS_GLOCK(); @@ -188,7 +280,8 @@ tagain: } /* get a reference to the entire directory */ - tdc = afs_GetDCache(avc, 0, &treq, &origOffset, &len, 1); + tdc = afs_GetDCache(avc, (afs_size_t) 0, &treq, &origOffset, &tlen, 1); + len = tlen; if (!tdc) { AFS_GUNLOCK(); return -ENOENT; @@ -246,12 +339,11 @@ tagain: afid.Fid.Unique=ntohl(de->fid.vunique); if ((avc->states & CForeign) == 0 && (ntohl(de->fid.vnode) & 1)) { - type=DT_DIR; } else if ((tvc=afs_FindVCache(&afid,0,0,0,0))) { if (tvc->mvstat) { type=DT_DIR; } else if (((tvc->states) & (CStatd|CTruth))) { - /* CTruth will be set if the object has + /* CTruth will be set if the object has *ever* been statd */ vtype=vType(tvc); if (vtype == VDIR) @@ -263,13 +355,13 @@ tagain: type=DT_LNK; */ /* what other types does AFS support? */ } - /* clean up from afs_FindVCache */ - afs_PutVCache(tvc, WRITE_LOCK); + /* clean up from afs_FindVCache */ + afs_PutVCache(tvc, WRITE_LOCK); } code = (*filldir)(dirbuf, de->name, len, offset, ino, type); } #else - code = (*filldir)(dirbuf, de->name, len, offset, ino); + code = (*filldir)(dirbuf, de->name, len, offset, ino); #endif DRelease(de, 0); if (code) @@ -358,8 +450,8 @@ static int afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) AFS_GLOCK(); #if defined(AFS_LINUX24_ENV) afs_Trace3(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vcp, - ICL_TYPE_POINTER, vmap->vm_start, - ICL_TYPE_INT32, vmap->vm_end - vmap->vm_start); + ICL_TYPE_POINTER, vmap->vm_start, + ICL_TYPE_INT32, vmap->vm_end - vmap->vm_start); #else afs_Trace4(afs_iclSetp, CM_TRACE_GMAP, ICL_TYPE_POINTER, vcp, ICL_TYPE_POINTER, vmap->vm_start, @@ -404,8 +496,8 @@ static int afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) } vmap->vm_ops = &afs_private_mmap_ops; } - - + + /* Add an open reference on the first mapping. */ if (vcp->mapcnt == 0) { vcp->execsOrWriters++; @@ -695,22 +787,22 @@ static int afs_linux_dentry_revalidate(struct dentry *dp) cred_t *credp; struct vrequest treq; struct inode *ip = (struct inode *)dp->d_inode; - + unsigned long timeout = 3*HZ; /* 3 seconds */ - + if (!(flags & LOOKUP_CONTINUE)) { long diff = CURRENT_TIME - dp->d_parent->d_inode->i_mtime; - + if (diff < 15*60) timeout = 0; } - + if (time_after(jiffies, dp->d_time + timeout)) goto out_bad; - + out_valid: return 1; - + out_bad: return 0; } @@ -908,7 +1000,7 @@ int afs_linux_unlink(struct inode *dip, struct dentry *dp) if (putback) { dp->d_time = jiffies; d_add(dp, NULL); /* means definitely does _not_ exist */ - } + } } crfree(credp); return -code; @@ -1017,7 +1109,7 @@ int afs_linux_rename(struct inode *oldip, struct dentry *olddp, AFS_GUNLOCK(); if (!code) { - /* update time so it doesn't expire immediately */ + /* update time so it doesn't expire immediately */ newdp->d_time = jiffies; d_move(olddp, newdp); } @@ -1039,7 +1131,7 @@ static int afs_linux_ireadlink(struct inode *ip, char *target, int maxlen, uio_t tuio; struct iovec iov; - setup_uio(&tuio, &iov, target, 0, maxlen, UIO_READ, seg); + setup_uio(&tuio, &iov, target, (afs_offs_t) 0, maxlen, UIO_READ, seg); code = afs_readlink((struct vcache*)ip, &tuio, credp); crfree(credp); @@ -1076,6 +1168,7 @@ struct dentry * afs_linux_follow_link(struct dentry *dp, char *name; struct dentry *res; + AFS_GLOCK(); name = osi_Alloc(PATH_MAX+1); if (!name) { @@ -1112,10 +1205,10 @@ int afs_linux_readpage(struct file *fp, struct page *pp) cred_t *credp = crref(); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) char *address; - loff_t offset = pp->index << PAGE_CACHE_SHIFT; + afs_offs_t offset = pp->index << PAGE_CACHE_SHIFT; #else ulong address = afs_linux_page_address(pp); - loff_t offset = pageoff(pp); + afs_offs_t offset = pageoff(pp); #endif uio_t tuio; struct iovec iovec; @@ -1128,7 +1221,6 @@ int afs_linux_readpage(struct file *fp, struct page *pp) ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, cnt, ICL_TYPE_INT32, 99999); /* not a possible code value */ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) address = kmap(pp); ClearPageError(pp); @@ -1152,10 +1244,10 @@ int afs_linux_readpage(struct file *fp, struct page *pp) memset((void*)(address+(PAGESIZE-tuio.uio_resid)), 0, tuio.uio_resid); #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) - flush_dcache_page(pp); - SetPageUptodate(pp); + flush_dcache_page(pp); + SetPageUptodate(pp); #else - set_bit(PG_uptodate, &pp->flags); + set_bit(PG_uptodate, &pp->flags); #endif } @@ -1186,7 +1278,7 @@ int afs_linux_writepage(struct page *pp) unsigned long end_index; unsigned offset = PAGE_CACHE_SIZE; long status; - + inode = (struct inode *) mapping->host; end_index = inode->i_size >> PAGE_CACHE_SHIFT; @@ -1257,7 +1349,7 @@ int afs_linux_writepage_sync(struct inode *ip, struct page *pp, { struct vcache *vcp = (struct vcache *) ip; char *buffer; - loff_t base; + afs_offs_t base; int code = 0; cred_t *credp; uio_t tuio; @@ -1288,7 +1380,7 @@ int afs_linux_writepage_sync(struct inode *ip, struct page *pp, kunmap(pp); return code; -} +} static int afs_linux_updatepage(struct file *file, struct page *page, @@ -1323,8 +1415,8 @@ int afs_linux_updatepage(struct file *fp, struct page *pp, ICL_TYPE_POINTER, pp, ICL_TYPE_INT32, atomic_read(&pp->count), ICL_TYPE_INT32, 99999); - setup_uio(&tuio, &iovec, page_addr + offset, pageoff(pp) + offset, count, - UIO_WRITE, AFS_UIOSYS); + setup_uio(&tuio, &iovec, page_addr + offset, (afs_offs_t)(pageoff(pp) + offset), + count, UIO_WRITE, AFS_UIOSYS); code = afs_write(vcp, &tuio, fp->f_flags, credp, 0); diff --git a/src/afs/VNOPS/afs_vnop_access.c b/src/afs/VNOPS/afs_vnop_access.c index a1bf302..e3c00a6 100644 --- a/src/afs/VNOPS/afs_vnop_access.c +++ b/src/afs/VNOPS/afs_vnop_access.c @@ -192,7 +192,8 @@ afs_access(OSI_VC_ARG(avc), amode, acred) AFS_STATCNT(afs_access); afs_Trace3(afs_iclSetp, CM_TRACE_ACCESS, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, amode, ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_INT32, amode, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); if (code = afs_InitReq(&treq, acred)) return code; code = afs_VerifyVCache(avc, &treq); diff --git a/src/afs/VNOPS/afs_vnop_attrs.c b/src/afs/VNOPS/afs_vnop_attrs.c index 184ced9..48b878a 100644 --- a/src/afs/VNOPS/afs_vnop_attrs.c +++ b/src/afs/VNOPS/afs_vnop_attrs.c @@ -190,7 +190,7 @@ afs_getattr(OSI_VC_ARG(avc), attrs, acred) AFS_STATCNT(afs_getattr); afs_Trace2(afs_iclSetp, CM_TRACE_GETATTR, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); #if defined(AFS_SUN5_ENV) if (flags & ATTR_HINT) { @@ -396,7 +396,7 @@ afs_setattr(avc, attrs, acred) AFS_STATCNT(afs_setattr); afs_Trace2(afs_iclSetp, CM_TRACE_SETATTR, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); if (code = afs_InitReq(&treq, acred)) return code; if (avc->states & CRO) { code=EROFS; @@ -462,9 +462,10 @@ afs_setattr(avc, attrs, acred) if (attrs->va_size != -1) { #endif #endif + afs_size_t tsize = attrs->va_size; ObtainWriteLock(&avc->lock,128); avc->states |= CDirty; - code = afs_TruncateAllSegments(avc, (afs_int32)attrs->va_size, &treq, acred); + code = afs_TruncateAllSegments(avc, tsize, &treq, acred); /* if date not explicitly set by this call, set it ourselves, since we * changed the data */ if (!(astat.Mask & AFS_SETMODTIME)) { diff --git a/src/afs/VNOPS/afs_vnop_create.c b/src/afs/VNOPS/afs_vnop_create.c index 32135b7..c8793d0 100644 --- a/src/afs/VNOPS/afs_vnop_create.c +++ b/src/afs/VNOPS/afs_vnop_create.c @@ -68,7 +68,7 @@ afs_create(OSI_VC_ARG(adp), aname, attrs, aexcl, amode, avcp, acred) struct AFSCallBack CallBack; afs_int32 now; struct dcache *tdc; - afs_int32 offset, len; + afs_size_t offset, len; struct server *hostp=0; struct vcache *tvc; struct volume* volp = 0; @@ -117,7 +117,7 @@ tagain: goto done; } - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); ObtainWriteLock(&adp->lock,135); /* @@ -487,7 +487,11 @@ afs_LocalHero(avc, adc, astat, aincr) /* Don't update the vcache entry unless the stats are current. */ if (avc->states & CStatd) { hset(avc->m.DataVersion, avers); +#ifdef AFS_64BIT_CLIENT + FillInt64(avc->m.Length, astat->Length_hi, astat->Length); +#else /* AFS_64BIT_ENV */ avc->m.Length = astat->Length; +#endif /* AFS_64BIT_ENV */ avc->m.Date = astat->ClientModTime; } if (ok) { diff --git a/src/afs/VNOPS/afs_vnop_dirops.c b/src/afs/VNOPS/afs_vnop_dirops.c index 6512b59..ff0846f 100644 --- a/src/afs/VNOPS/afs_vnop_dirops.c +++ b/src/afs/VNOPS/afs_vnop_dirops.c @@ -55,7 +55,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred) register struct conn *tc; struct VenusFid newFid; register struct dcache *tdc; - afs_int32 offset, len; + afs_size_t offset, len; register struct vcache *tvc; struct AFSStoreStatus InStatus; struct AFSFetchStatus OutFidStatus, OutDirStatus; @@ -90,7 +90,7 @@ afs_mkdir(OSI_VC_ARG(adp), aname, attrs, avcp, acred) InStatus.ClientModTime = osi_Time(); InStatus.UnixModeBits = attrs->va_mode & 0xffff; /* only care about protection bits */ InStatus.Group = (afs_int32)acred->cr_gid; - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); ObtainWriteLock(&adp->lock,153); do { tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); @@ -182,7 +182,7 @@ afs_rmdir(adp, aname, acred) register struct vcache *tvc = (struct vcache *)0; register afs_int32 code; register struct conn *tc; - afs_int32 offset, len; + afs_size_t offset, len; struct AFSFetchStatus OutDirStatus; struct AFSVolSync tsync; XSTATS_DECLS @@ -205,7 +205,7 @@ afs_rmdir(adp, aname, acred) goto done; } - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); /* test for error below */ + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */ ObtainWriteLock(&adp->lock,154); if (tdc && (adp->states & CForeign)) { struct VenusFid unlinkFid; diff --git a/src/afs/VNOPS/afs_vnop_link.c b/src/afs/VNOPS/afs_vnop_link.c index 2c65222..32bc1e2 100644 --- a/src/afs/VNOPS/afs_vnop_link.c +++ b/src/afs/VNOPS/afs_vnop_link.c @@ -53,7 +53,7 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred) register struct dcache *tdc; register afs_int32 code; register struct conn *tc; - afs_int32 offset, len; + afs_size_t offset, len; struct AFSFetchStatus OutFidStatus, OutDirStatus; struct AFSVolSync tsync; XSTATS_DECLS @@ -79,7 +79,7 @@ afs_link(avc, OSI_VC_ARG(adp), aname, acred) goto done; } - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); /* test for error below */ + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */ ObtainWriteLock(&adp->lock,145); do { tc = afs_Conn(&adp->fid, &treq, SHARED_LOCK); @@ -147,6 +147,6 @@ done: #ifdef AFS_OSF_ENV afs_PutVCache(adp, WRITE_LOCK); #endif /* AFS_OSF_ENV */ - return afs_CheckCode(code, &treq); + return afs_CheckCode(code, &treq, 24); } diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index d2bd090..94ccacc 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -364,7 +364,7 @@ int afs_DoBulkStat(adp, dirCookie, areqp) struct dcache *dcp; /* chunk containing the dir block */ char *statMemp; /* status memory block */ char *cbfMemp; /* callback and fid memory block */ - long temp; /* temp for holding chunk length, &c. */ + afs_size_t temp; /* temp for holding chunk length, &c. */ struct AFSFid *fidsp; /* file IDs were collecting */ struct AFSCallBack *cbsp; /* call back pointers */ struct AFSCallBack *tcbp; /* temp callback ptr */ @@ -385,7 +385,7 @@ int afs_DoBulkStat(adp, dirCookie, areqp) long startTime; /* time we started the call, * for callback expiration base */ - int statSeqNo; /* Valued of file size to detect races */ + afs_size_t statSeqNo; /* Valued of file size to detect races */ int code; /* error code */ long newIndex; /* new index in the dir */ struct DirEntry *dirEntryp; /* dir entry we are examining */ @@ -437,7 +437,7 @@ tagain: code = afs_VerifyVCache(adp, areqp); if (code) goto done; - dcp = afs_GetDCache(adp, 0, areqp, &temp, &temp, 1); + dcp = afs_GetDCache(adp, (afs_size_t) 0, areqp, &temp, &temp, 1); if (!dcp) { code = ENOENT; goto done; @@ -1061,12 +1061,12 @@ afs_lookup(adp, aname, avcp, acred) { register struct dcache *tdc; - afs_int32 dirOffset, dirLen; + afs_size_t dirOffset, dirLen; ino_t theDir; struct VenusFid tfid; /* now we have to lookup the next fid */ - tdc = afs_GetDCache(adp, 0, &treq, &dirOffset, &dirLen, 1); + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &dirOffset, &dirLen, 1); if (!tdc) { *avcp = (struct vcache *)0; /* redundant, but harmless */ code = EIO; diff --git a/src/afs/VNOPS/afs_vnop_read.c b/src/afs/VNOPS/afs_vnop_read.c index e457076..c93edd6 100644 --- a/src/afs/VNOPS/afs_vnop_read.c +++ b/src/afs/VNOPS/afs_vnop_read.c @@ -53,12 +53,15 @@ afs_MemRead(avc, auio, acred, albn, abpp, noLock) struct AFS_UCRED *acred; daddr_t albn; int noLock; - struct buf **abpp; { - afs_int32 totalLength; - afs_int32 transferLength; - afs_int32 filePos; + struct buf **abpp; +{ + afs_size_t totalLength; + afs_size_t transferLength; + afs_size_t filePos; + afs_size_t offset, len, tlen; + afs_int32 trimlen; struct dcache *tdc=0; - afs_int32 offset, len, error, trybusy=1; + afs_int32 error, trybusy=1; struct uio tuio; struct iovec *tvec; char *tfile; @@ -92,8 +95,9 @@ afs_MemRead(avc, auio, acred, albn, abpp, noLock) totalLength = auio->afsio_resid; filePos = auio->afsio_offset; afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, filePos, ICL_TYPE_INT32, totalLength, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), + ICL_TYPE_INT32, totalLength, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); error = 0; transferLength = 0; if (!noLock) @@ -161,7 +165,8 @@ tagain: /* start the daemon (may already be running, however) */ tdc->flags |= DFFetchReq; bp = afs_BQueue(BOP_FETCH, avc, B_DONTWAIT, 0, acred, - (long)filePos, (long) tdc, 0L, 0L); + (afs_size_t)filePos, (afs_size_t) tdc, + (afs_size_t) 0, (afs_size_t) 0); if (!bp) { tdc->flags &= ~DFFetchReq; trybusy = 0; /* Avoid bkg daemon since they're too busy */ @@ -222,12 +227,13 @@ tagain: also not at eof, so may have to supply fake zeros */ len = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; /* bytes left in chunk addr space */ if (len > totalLength) len = totalLength; /* and still within xfr request */ - code = avc->m.Length - offset; /* and still within file */ - if (len > code) len = code; + tlen = avc->m.Length - offset; /* and still within file */ + if (len > tlen) len = tlen; if (len > AFS_ZEROS) len = sizeof(afs_zeros); /* and in 0 buffer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); - AFS_UIOMOVE(afs_zeros, len, UIO_READ, &tuio, code); + trimlen = len; + afsio_trim(&tuio, trimlen); + AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code); if (code) { error = code; break; @@ -238,7 +244,8 @@ tagain: /* mung uio structure to be right for this transfer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); + trimlen = len; + afsio_trim(&tuio, trimlen); tuio.afsio_offset = offset; code = afs_MemReadUIO(tdc->f.inode, &tuio); @@ -250,7 +257,8 @@ tagain: } /* otherwise we've read some, fixup length, etc and continue with next seg */ len = len - tuio.afsio_resid; /* compute amount really transferred */ - afsio_skip(auio, len); /* update input uio structure */ + trimlen = len; + afsio_skip(auio, trimlen); /* update input uio structure */ totalLength -= len; transferLength += len; filePos += len; @@ -291,8 +299,8 @@ void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc, struct AFS_UCRED *acred, struct vrequest *areq) { register struct dcache *tdc; - register afs_int32 offset; - afs_int32 j1, j2; /* junk vbls for GetDCache to trash */ + afs_size_t offset; + afs_size_t j1, j2; /* junk vbls for GetDCache to trash */ offset = adc->f.chunk+1; /* next chunk we'll need */ offset = AFS_CHUNKTOBASE(offset); /* base of next chunk */ @@ -309,8 +317,9 @@ void afs_PrefetchChunk(struct vcache *avc, struct dcache *adc, #ifdef AFS_SUN5_ENVX mutex_exit(&tdc->lock); #endif - bp = afs_BQueue(BOP_FETCH, avc, B_DONTWAIT, 0, acred, (long)offset, - (long) tdc, 1L, 0L, 0L); + bp = afs_BQueue(BOP_FETCH, avc, B_DONTWAIT, 0, acred, + (afs_size_t) offset, (afs_size_t) tdc, + (afs_size_t) 1, (afs_size_t) 0); if (!bp) { /* Bkg table full; just abort non-important prefetching to avoid deadlocks */ tdc->flags &= ~(DFNextStarted | DFFetchReq); @@ -353,7 +362,8 @@ afs_UFSReadFast(avc, auio, acred, albn, abpp, noLock) struct AFS_UCRED *acred; int noLock; daddr_t albn; - struct buf **abpp; { + struct buf **abpp; +{ struct vrequest treq; int offDiff; struct dcache *tdc; @@ -379,6 +389,11 @@ afs_UFSReadFast(avc, auio, acred, albn, abpp, noLock) auio->afsio_offset -= avc->quick.minLoc; + afs_Trace4(afs_iclSetp, CM_TRACE_READFAST, ICL_TYPE_POINTER, avc, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(auio->afsio_offset), + ICL_TYPE_INT32, auio->afsio_resid, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); + tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode); #ifdef AFS_AIX_ENV @@ -475,12 +490,15 @@ afs_UFSRead(avc, auio, acred, albn, abpp, noLock) struct AFS_UCRED *acred; daddr_t albn; int noLock; - struct buf **abpp; { - afs_int32 totalLength; - afs_int32 transferLength; - afs_int32 filePos; + struct buf **abpp; +{ + afs_size_t totalLength; + afs_size_t transferLength; + afs_size_t filePos; + afs_size_t offset, len, tlen; + afs_int32 trimlen; struct dcache *tdc=0; - afs_int32 offset, len, error; + afs_int32 error; struct uio tuio; struct iovec *tvec; struct osi_file *tfile; @@ -520,8 +538,9 @@ afs_UFSRead(avc, auio, acred, albn, abpp, noLock) totalLength = auio->afsio_resid; filePos = auio->afsio_offset; afs_Trace4(afs_iclSetp, CM_TRACE_READ, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, filePos, ICL_TYPE_INT32, totalLength, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), + ICL_TYPE_INT32, totalLength, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); error = 0; transferLength = 0; if (!noLock) @@ -595,7 +614,8 @@ tagain: munlocked = 1; #endif bp = afs_BQueue(BOP_FETCH, avc, B_DONTWAIT, 0, acred, - (long)filePos, (long) tdc, 0L, 0L); + (afs_size_t)filePos, (afs_size_t) tdc, + (afs_size_t) 0, (afs_size_t) 0); if (!bp) { /* Bkg table full; retry deadlocks */ tdc->flags &= ~DFFetchReq; @@ -656,12 +676,13 @@ tagain: also not at eof, so may have to supply fake zeros */ len = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset; /* bytes left in chunk addr space */ if (len > totalLength) len = totalLength; /* and still within xfr request */ - code = avc->m.Length - offset; /* and still within file */ - if (len > code) len = code; + tlen = avc->m.Length - offset; /* and still within file */ + if (len > tlen) len = tlen; if (len > AFS_ZEROS) len = sizeof(afs_zeros); /* and in 0 buffer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); - AFS_UIOMOVE(afs_zeros, len, UIO_READ, &tuio, code); + trimlen = len; + afsio_trim(&tuio, trimlen); + AFS_UIOMOVE(afs_zeros, trimlen, UIO_READ, &tuio, code); if (code) { error = code; break; @@ -688,7 +709,8 @@ tagain: tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode); /* mung uio structure to be right for this transfer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); + trimlen = len; + afsio_trim(&tuio, trimlen); tuio.afsio_offset = offset; #ifdef AFS_AIX_ENV #ifdef AFS_AIX41_ENV @@ -795,7 +817,8 @@ tagain: } /* otherwise we've read some, fixup length, etc and continue with next seg */ len = len - tuio.afsio_resid; /* compute amount really transferred */ - afsio_skip(auio, len); /* update input uio structure */ + trimlen = len; + afsio_skip(auio, trimlen); /* update input uio structure */ totalLength -= len; transferLength += len; filePos += len; diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index 58bb488..0305cdf 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -245,7 +245,7 @@ ssize_t rlen; #else int rlen; #endif -int off; +afs_size_t off; { int code = 0; #if defined(AFS_SUN56_ENV) @@ -435,10 +435,12 @@ afs_readdir(OSI_VC_ARG(avc), auio, acred) #endif OSI_VC_DECL(avc); struct uio *auio; - struct AFS_UCRED *acred; { + struct AFS_UCRED *acred; +{ struct vrequest treq; register struct dcache *tdc; - afs_int32 origOffset, len, dirsiz; + afs_size_t origOffset, tlen; + afs_int32 len, dirsiz; int code = 0; struct DirEntry *ode = 0, *nde = 0; int o_slen = 0, n_slen = 0; @@ -499,7 +501,8 @@ tagain: code = afs_VerifyVCache(avc, &treq); if (code) goto done; /* get a reference to the entire directory */ - tdc = afs_GetDCache(avc, 0, &treq, &origOffset, &len, 1); + tdc = afs_GetDCache(avc, (afs_size_t) 0, &treq, &origOffset, &tlen, 1); + len = tlen; if (!tdc) { code = ENOENT; goto done; @@ -745,7 +748,7 @@ afs1_readdir(avc, auio, acred) struct AFS_UCRED *acred; { struct vrequest treq; register struct dcache *tdc; - afs_int32 origOffset, len; + afs_size_t origOffset, len; int code = 0; struct DirEntry *ode = 0, *nde = 0; int o_slen = 0, n_slen = 0; @@ -775,7 +778,7 @@ tagain: code = afs_VerifyVCache(avc, &treq); if (code) goto done; /* get a reference to the entire directory */ - tdc = afs_GetDCache(avc, 0, &treq, &origOffset, &len, 1); + tdc = afs_GetDCache(avc, (afs_size_t) 0, &treq, &origOffset, &len, 1); if (!tdc) { code = ENOENT; goto done; diff --git a/src/afs/VNOPS/afs_vnop_remove.c b/src/afs/VNOPS/afs_vnop_remove.c index c3df294..09e68a1 100644 --- a/src/afs/VNOPS/afs_vnop_remove.c +++ b/src/afs/VNOPS/afs_vnop_remove.c @@ -50,9 +50,9 @@ static void FetchWholeEnchilada(avc, areq) #endif struct vrequest *areq; register struct vcache *avc; { - register afs_int32 nextChunk, pos; + register afs_int32 nextChunk; register struct dcache *tdc; - afs_int32 offset, len; + afs_size_t pos, offset, len; AFS_STATCNT(FetchWholeEnchilada); if ((avc->states & CStatd) == 0) return; /* don't know size */ @@ -260,7 +260,7 @@ tagain: return code; } - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); /* test for error below */ + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */ ObtainWriteLock(&adp->lock,142); /* diff --git a/src/afs/VNOPS/afs_vnop_rename.c b/src/afs/VNOPS/afs_vnop_rename.c index 7c86a15..7b1cbbb 100644 --- a/src/afs/VNOPS/afs_vnop_rename.c +++ b/src/afs/VNOPS/afs_vnop_rename.c @@ -102,7 +102,7 @@ tagain: * fileFid in order to handle ".." invalidation at the very end. */ code = 0; - tdc1 = afs_GetDCache(aodp, 0, &treq, &offset, &len, 0); + tdc1 = afs_GetDCache(aodp, (afs_size_t) 0, &treq, &offset, &len, 0); if (!tdc1) { code = ENOENT; } diff --git a/src/afs/VNOPS/afs_vnop_symlink.c b/src/afs/VNOPS/afs_vnop_symlink.c index 47d2ee0..72f0d6e 100644 --- a/src/afs/VNOPS/afs_vnop_symlink.c +++ b/src/afs/VNOPS/afs_vnop_symlink.c @@ -63,7 +63,8 @@ afs_symlink struct conn *tc; struct VenusFid newFid; struct dcache *tdc; - afs_int32 offset, len, alen; + afs_size_t offset, len; + afs_int32 alen; struct server *hostp=0; struct vcache *tvc; struct AFSStoreStatus InStatus; @@ -104,7 +105,7 @@ afs_symlink InStatus.UnixModeBits = 0755; alen++; /* add in the null */ } - tdc = afs_GetDCache(adp, 0, &treq, &offset, &len, 1); + tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); volp = afs_FindVolume(&adp->fid, READ_LOCK); /*parent is also in same vol*/ ObtainWriteLock(&adp->lock,156); ObtainSharedLock(&afs_xvcache,17); /* prevent others from creating this entry */ @@ -221,7 +222,8 @@ afs_MemHandleLink(avc, areq) { register struct dcache *tdc; register char *tp; - afs_int32 offset, len, alen; + afs_size_t offset, len; + afs_int32 tlen, alen; register afs_int32 code; AFS_STATCNT(afs_MemHandleLink); @@ -230,7 +232,7 @@ afs_MemHandleLink(avc, areq) protected 755, we add a null to the end of */ if (!avc->linkData) { void *addr; - tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 0); + tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 0); if (!tdc) { return EIO; } @@ -243,7 +245,8 @@ afs_MemHandleLink(avc, areq) else alen = len; /* mt point */ tp = afs_osi_Alloc(alen); /* make room for terminating null */ addr = afs_MemCacheOpen(tdc->f.inode); - code = afs_MemReadBlk(addr, 0, tp, len); + tlen = len; + code = afs_MemReadBlk(addr, 0, tp, tlen); tp[alen-1] = 0; afs_PutDCache(tdc); if (code != len) { @@ -257,11 +260,13 @@ afs_MemHandleLink(avc, areq) afs_UFSHandleLink(avc, areq) register struct vcache *avc; - struct vrequest *areq; { + struct vrequest *areq; +{ register struct dcache *tdc; register char *tp; char *tfile; - afs_int32 offset, len, alen; + afs_size_t offset, len; + afs_int32 tlen, alen; register afs_int32 code; /* two different formats, one for links protected 644, have a "." at the end @@ -269,7 +274,10 @@ afs_UFSHandleLink(avc, areq) we add a null to the end of */ AFS_STATCNT(afs_UFSHandleLink); if (!avc->linkData) { - tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 0); + tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 0); + afs_Trace3(afs_iclSetp, CM_TRACE_UFSLINK, ICL_TYPE_POINTER, avc, + ICL_TYPE_POINTER, tdc, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); if (!tdc) { return EIO; } @@ -281,12 +289,13 @@ afs_UFSHandleLink(avc, areq) tfile = osi_UFSOpen (tdc->f.inode); if (avc->m.Mode & 0111) alen = len+1; /* regular link */ else alen = len; /* mt point */ - tp = afs_osi_Alloc(alen); /* make room for terminating null */ - code = afs_osi_Read(tfile, -1, tp, len); + tp = afs_osi_Alloc(alen); /* make room for terminating null */ + tlen = len; + code = afs_osi_Read(tfile, -1, tp, tlen); tp[alen-1] = 0; osi_UFSClose(tfile); afs_PutDCache(tdc); - if (code != len) { + if (code != tlen) { afs_osi_Free(tp, alen); return EIO; } @@ -298,7 +307,8 @@ afs_UFSHandleLink(avc, areq) afs_readlink(OSI_VC_ARG(avc), auio, acred) OSI_VC_DECL(avc); struct uio *auio; - struct AFS_UCRED *acred; { + struct AFS_UCRED *acred; +{ register afs_int32 code; struct vrequest treq; register char *tp; diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 8f8c598..1e1aa79 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -92,17 +92,20 @@ afs_MemWrite(avc, auio, aio, acred, noLock) register struct vcache *avc; struct uio *auio; int aio, noLock; - struct AFS_UCRED *acred; { - afs_int32 totalLength; - afs_int32 transferLength; - afs_int32 filePos; + struct AFS_UCRED *acred; +{ + afs_size_t totalLength; + afs_size_t transferLength; + afs_size_t filePos; + afs_size_t offset, len; + afs_int32 tlen, trimlen; afs_int32 startDate; afs_int32 max; register struct dcache *tdc; #ifdef _HIGHC_ volatile #endif - afs_int32 offset, len, error; + afs_int32 error; struct uio tuio; struct iovec *tvec; /* again, should have define */ char *tfile; @@ -121,8 +124,9 @@ afs_MemWrite(avc, auio, aio, acred, noLock) error = 0; transferLength = 0; afs_Trace4(afs_iclSetp, CM_TRACE_WRITE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, filePos, ICL_TYPE_INT32, totalLength, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(totalLength), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); if (!noLock) { afs_MaybeWakeupTruncateDaemon(); ObtainWriteLock(&avc->lock,126); @@ -193,10 +197,6 @@ afs_MemWrite(avc, auio, aio, acred, noLock) */ if (noLock) { tdc = afs_FindDCache(avc, filePos); - if (tdc) { - offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; - } } else if (afs_blocksUsed > (CM_WAITFORDRAINPCT*afs_cacheBlocks)/100) { tdc = afs_FindDCache(avc, filePos); if (tdc) { @@ -204,9 +204,6 @@ afs_MemWrite(avc, auio, aio, acred, noLock) (tdc->flags & DFFetching)) { afs_PutDCache(tdc); tdc = NULL; - } else { - offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; } } if (!tdc) { @@ -243,6 +240,7 @@ afs_MemWrite(avc, auio, aio, acred, noLock) tdc->flags |= DFEntryMod; } len = totalLength; /* write this amount by default */ + offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); max = AFS_CHUNKTOSIZE(tdc->f.chunk); /* max size of this chunk */ if (max <= len + offset) { /*if we'd go past the end of this chunk */ /* it won't all fit in this chunk, so write as much @@ -251,7 +249,8 @@ afs_MemWrite(avc, auio, aio, acred, noLock) } /* mung uio structure to be right for this transfer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); + trimlen = len; + afsio_trim(&tuio, trimlen); tuio.afsio_offset = offset; code = afs_MemWriteUIO(tdc->f.inode, &tuio); @@ -266,10 +265,13 @@ afs_MemWrite(avc, auio, aio, acred, noLock) } /* otherwise we've written some, fixup length, etc and continue with next seg */ len = len - tuio.afsio_resid; /* compute amount really transferred */ - afsio_skip(auio, len); /* advance auio over data written */ + tlen = len; + afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ - if (offset + len > tdc->f.chunkBytes) - afs_AdjustSize(tdc, offset+len); + if (offset + len > tdc->f.chunkBytes) { + afs_int32 toffset = offset+len; + afs_AdjustSize(tdc, toffset); + } totalLength -= len; transferLength += len; filePos += len; @@ -319,17 +321,21 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) register struct vcache *avc; struct uio *auio; int aio, noLock; - struct AFS_UCRED *acred; { - afs_int32 totalLength; - afs_int32 transferLength; - afs_int32 filePos; + struct AFS_UCRED *acred; +{ + afs_size_t totalLength; + afs_size_t transferLength; + afs_size_t filePos; + afs_size_t offset, len; + afs_int32 tlen; + afs_int32 trimlen; afs_int32 startDate; afs_int32 max; register struct dcache *tdc; #ifdef _HIGHC_ volatile #endif - afs_int32 offset, len, error; + afs_int32 error; struct uio tuio; struct iovec *tvec; /* again, should have define */ struct osi_file *tfile; @@ -349,8 +355,9 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) error = 0; transferLength = 0; afs_Trace4(afs_iclSetp, CM_TRACE_WRITE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, filePos, ICL_TYPE_INT32, totalLength, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(totalLength), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); if (!noLock) { afs_MaybeWakeupTruncateDaemon(); ObtainWriteLock(&avc->lock,556); @@ -416,10 +423,6 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) /* read the cached info */ if (noLock) { tdc = afs_FindDCache(avc, filePos); - if (tdc) { - offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; - } } else if (afs_blocksUsed > (CM_WAITFORDRAINPCT*afs_cacheBlocks)/100) { tdc = afs_FindDCache(avc, filePos); if (tdc) { @@ -427,9 +430,6 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) (tdc->flags & DFFetching)) { afs_PutDCache(tdc); tdc = NULL; - } else { - offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); - len = tdc->f.chunkBytes - offset; } } if (!tdc) { @@ -467,6 +467,7 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) } tfile = (struct osi_file *)osi_UFSOpen(tdc->f.inode); len = totalLength; /* write this amount by default */ + offset = filePos - AFS_CHUNKTOBASE(tdc->f.chunk); max = AFS_CHUNKTOSIZE(tdc->f.chunk); /* max size of this chunk */ if (max <= len + offset) { /*if we'd go past the end of this chunk */ /* it won't all fit in this chunk, so write as much @@ -475,7 +476,8 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) } /* mung uio structure to be right for this transfer */ afsio_copy(auio, &tuio, tvec); - afsio_trim(&tuio, len); + trimlen = len; + afsio_trim(&tuio, trimlen); tuio.afsio_offset = offset; #ifdef AFS_AIX_ENV #ifdef AFS_AIX41_ENV @@ -561,10 +563,13 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) } /* otherwise we've written some, fixup length, etc and continue with next seg */ len = len - tuio.afsio_resid; /* compute amount really transferred */ - afsio_skip(auio, len); /* advance auio over data written */ + tlen = len; + afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ - if (offset + len > tdc->f.chunkBytes) - afs_AdjustSize(tdc, offset+len); + if (offset + len > tdc->f.chunkBytes) { + afs_int32 toffset = offset+len; + afs_AdjustSize(tdc, toffset); + } totalLength -= len; transferLength += len; filePos += len; @@ -643,7 +648,7 @@ struct vrequest *areq; { return 0; /* nothing to do */ /* otherwise, call afs_StoreDCache (later try to do this async, if possible) */ afs_Trace2(afs_iclSetp, CM_TRACE_PARTIALWRITE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); #if defined(AFS_SUN5_ENV) code = afs_StoreAllSegments(avc, areq, AFS_ASYNC | AFS_VMSYNC_INVAL); #else @@ -837,8 +842,9 @@ afs_close(OSI_VC_ARG(avc), aflags, acred) #endif /* at least one daemon is idle, so ask it to do the store. Also, note that we don't lock it any more... */ - tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred, (long)acred->cr_uid, - 0L, 0L, 0L); + tb = afs_BQueue(BOP_STORE, avc, 0, 1, acred, + (afs_size_t) acred->cr_uid, (afs_size_t) 0, + (afs_size_t) 0, (afs_size_t) 0); /* sleep waiting for the store to start, then retrieve error code */ while ((tb->flags & BUVALID) == 0) { tb->flags |= BUWAIT; diff --git a/src/afs/afs.h b/src/afs/afs.h index 2424c40..d37fe87 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -116,9 +116,7 @@ struct sysname_info { struct brequest { struct vcache *vnode; /* vnode to use, with vrefcount bumped */ struct AFS_UCRED *cred; /* credentials to use for operation */ - long parm[BPARMS]; /* random parameters - long's work for - * both 32 and 64 bit platforms. - */ + afs_size_t parm[BPARMS]; /* random parameters */ afs_int32 code; /* return code */ short refCount; /* use counter for this structure */ char opcode; /* what to do (store, fetch, etc) */ @@ -330,6 +328,10 @@ struct srvAddr { #define SRVR_MULTIHOMED 0x40 #define SRVR_ISGONE 0x80 #define SNO_INLINEBULK 0x100 +#define SNO_64BIT 0x200 + +#define afs_serverSetNo64Bit(s) ((s)->srvr->server->flags |= SNO_64BIT) +#define afs_serverHasNo64Bit(s) ((s)->srvr->server->flags & SNO_64BIT) struct server { union { @@ -538,7 +540,11 @@ struct SimpleLocks { #endif #define AFS_MAXDV 0x7fffffff /* largest dataversion number */ +#ifdef AFS_64BIT_CLIENT +#define AFS_NOTRUNC 0x7fffffffffffffffLL /* largest positive int64 number */ +#else /* AFS_64BIT_CLIENT */ #define AFS_NOTRUNC 0x7fffffff /* largest dataversion number */ +#endif /* AFS_64BIT_CLIENT */ extern afs_int32 vmPageHog; /* counter for # of vnodes which are page hogs. */ @@ -550,8 +556,8 @@ struct vtodc struct dcache * dc; afs_uint32 stamp; struct osi_file * f; - afs_uint32 minLoc; /* smallest offset into dc. */ - afs_uint32 len; /* largest offset into dc. */ + afs_offs_t minLoc; /* smallest offset into dc. */ + afs_offs_t len; /* largest offset into dc. */ }; extern afs_uint32 afs_stampValue; /* stamp for pair's usage */ @@ -568,7 +574,7 @@ struct vcache { struct vcache *hnext; /* Hash next */ struct VenusFid fid; struct mstat { - afs_uint32 Length; + afs_size_t Length; afs_hyper_t DataVersion; afs_uint32 Date; afs_uint32 Owner; @@ -608,7 +614,7 @@ struct vcache { char *linkData; /* Link data if a symlink. */ afs_hyper_t flushDV; /* data version last flushed from text */ afs_hyper_t mapDV; /* data version last flushed from map */ - afs_uint32 truncPos; /* truncate file to this position at next store */ + afs_size_t truncPos; /* truncate file to this position at next store */ struct server *callback; /* The callback host, if any */ afs_uint32 cbExpires; /* time the callback expires */ struct afs_q callsort; /* queue in expiry order, sort of */ @@ -859,10 +865,10 @@ struct fcache { struct dcache { struct afs_q lruq; /* Free queue for in-memory images */ afs_rwlock_t lock; /* XXX */ - short refCount; /* Associated reference count. */ + afs_size_t validPos; /* number of valid bytes during fetch */ afs_int32 index; /* The index in the CacheInfo file*/ + short refCount; /* Associated reference count. */ short flags; /* more flags bits */ - afs_int32 validPos; /* number of valid bytes during fetch */ struct fcache f; /* disk image */ afs_int32 stamp; /* used with vtodc struct for hints */ }; diff --git a/src/afs/afs_analyze.c b/src/afs/afs_analyze.c index 95855af..ae16db2 100644 --- a/src/afs/afs_analyze.c +++ b/src/afs/afs_analyze.c @@ -448,6 +448,10 @@ int afs_Analyze(aconn, acode, afid, areq, op, locktype, cellp) /* If network troubles, mark server as having bogued out again. */ /* VRESTARTING is < 0 because of backward compatibility issues * with 3.4 file servers and older cache managers */ +#ifdef AFS_64BIT_CLIENT + if (acode == -455) + acode = 455; +#endif /* AFS_64BIT_CLIENT */ if ((acode < 0) && (acode != VRESTARTING)) { afs_ServerDown(sa); ForceNewConnections(sa); /*multi homed clients lock:afs_xsrvAddr?*/ diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 72d5b4d..f4e029a 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -1714,7 +1714,7 @@ afs_icl_UseAddr(type) int type; { if (type == ICL_TYPE_HYPER || type == ICL_TYPE_STRING - || type == ICL_TYPE_FID) + || type == ICL_TYPE_FID || type == ICL_TYPE_INT64) return 1; else return 0; @@ -1825,6 +1825,25 @@ afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4) ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p1)->high); ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p1)->low); } + else if (t1 == ICL_TYPE_INT64) { +#ifdef AFSLITTLE_ENDIAN +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[1]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[0]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) p1); + ICL_APPENDINT32(logp, (afs_int32) 0); +#endif /* AFS_64BIT_CLIENT */ +#else /* AFSLITTLE_ENDIAN */ +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[0]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[1]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) 0); + ICL_APPENDINT32(logp, (afs_int32) p1); +#endif /* AFS_64BIT_CLIENT */ +#endif /* AFSLITTLE_ENDIAN */ + } else if (t1 == ICL_TYPE_FID) { ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[0]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p1)[1]); @@ -1844,6 +1863,25 @@ afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4) ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p2)->high); ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p2)->low); } + else if (t2 == ICL_TYPE_INT64) { +#ifdef AFSLITTLE_ENDIAN +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[1]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[0]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) p2); + ICL_APPENDINT32(logp, (afs_int32) 0); +#endif /* AFS_64BIT_CLIENT */ +#else /* AFSLITTLE_ENDIAN */ +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[0]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[1]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) 0); + ICL_APPENDINT32(logp, (afs_int32) p2); +#endif /* AFS_64BIT_CLIENT */ +#endif /* AFSLITTLE_ENDIAN */ + } else if (t2 == ICL_TYPE_FID) { ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[0]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p2)[1]); @@ -1863,6 +1901,25 @@ afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4) ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p3)->high); ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p3)->low); } + else if (t3 == ICL_TYPE_INT64) { +#ifdef AFSLITTLE_ENDIAN +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[1]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[0]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) p3); + ICL_APPENDINT32(logp, (afs_int32) 0); +#endif /* AFS_64BIT_CLIENT */ +#else /* AFSLITTLE_ENDIAN */ +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[0]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[1]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) 0); + ICL_APPENDINT32(logp, (afs_int32) p3); +#endif /* AFS_64BIT_CLIENT */ +#endif /* AFSLITTLE_ENDIAN */ + } else if (t3 == ICL_TYPE_FID) { ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[0]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p3)[1]); @@ -1882,6 +1939,25 @@ afs_icl_AppendRecord(logp, op, types, p1, p2, p3, p4) ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p4)->high); ICL_APPENDINT32(logp, (afs_int32)((struct afs_hyper_t *)p4)->low); } + else if (t4 == ICL_TYPE_INT64) { +#ifdef AFSLITTLE_ENDIAN +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[1]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[0]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) p4); + ICL_APPENDINT32(logp, (afs_int32) 0); +#endif /* AFS_64BIT_CLIENT */ +#else /* AFSLITTLE_ENDIAN */ +#ifdef AFS_64BIT_CLIENT + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[0]); + ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[1]); +#else /* AFS_64BIT_CLIENT */ + ICL_APPENDINT32(logp, (afs_int32) 0); + ICL_APPENDINT32(logp, (afs_int32) p4); +#endif /* AFS_64BIT_CLIENT */ +#endif /* AFSLITTLE_ENDIAN */ + } else if (t4 == ICL_TYPE_FID) { ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[0]); ICL_APPENDINT32(logp, (afs_int32)((afs_int32 *)p4)[1]); diff --git a/src/afs/afs_callback.c b/src/afs/afs_callback.c index 193c642..53611f7 100644 --- a/src/afs/afs_callback.c +++ b/src/afs/afs_callback.c @@ -153,7 +153,11 @@ int SRXAFSCB_GetCE(a_call, a_index, a_result) a_result->lock.pid_writer = 0; a_result->lock.src_indicator = 0; #endif /* AFS_OSF20_ENV */ +#ifdef AFS_64BIT_CLIENT + a_result->Length = (afs_int32) tvc->m.Length & 0xffffffff; +#else /* AFS_64BIT_CLIENT */ a_result->Length = tvc->m.Length; +#endif /* AFS_64BIT_CLIENT */ a_result->DataVersion = hgetlo(tvc->m.DataVersion); a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */ a_result->cbExpires = tvc->cbExpires; @@ -178,6 +182,96 @@ fcnDone: } /*SRXAFSCB_GetCE*/ +int SRXAFSCB_GetCE64(a_call, a_index, a_result) + struct rx_call *a_call; + afs_int32 a_index; + struct AFSDBCacheEntry64 *a_result; + +{ /*SRXAFSCB_GetCE64*/ + + register int i; /*Loop variable*/ + register struct vcache *tvc; /*Ptr to current cache entry*/ + int code; /*Return code*/ + XSTATS_DECLS; + +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + + XSTATS_START_CMTIME(AFS_STATS_CM_RPCIDX_GETCE); + + AFS_STATCNT(SRXAFSCB_GetCE64); + for (i = 0; i < VCSIZE; i++) { + for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { + if (a_index == 0) + goto searchDone; + a_index--; + } /*Zip through current hash chain*/ + } /*Zip through hash chains*/ + + searchDone: + if (tvc == (struct vcache *) 0) { + /*Past EOF*/ + code = 1; + goto fcnDone; + } + + /* + * Copy out the located entry. + */ + a_result->addr = afs_data_pointer_to_int32(tvc); + a_result->cell = tvc->fid.Cell; + a_result->netFid.Volume = tvc->fid.Fid.Volume; + a_result->netFid.Vnode = tvc->fid.Fid.Vnode; + a_result->netFid.Unique = tvc->fid.Fid.Unique; + a_result->lock.waitStates = tvc->lock.wait_states; + a_result->lock.exclLocked = tvc->lock.excl_locked; + a_result->lock.readersReading = tvc->lock.readers_reading; + a_result->lock.numWaiting = tvc->lock.num_waiting; +#if defined(INSTRUMENT_LOCKS) + a_result->lock.pid_last_reader = tvc->lock.pid_last_reader; + a_result->lock.pid_writer = tvc->lock.pid_writer; + a_result->lock.src_indicator = tvc->lock.src_indicator; +#else + /* On osf20 , the vcache does not maintain these three fields */ + a_result->lock.pid_last_reader = 0; + a_result->lock.pid_writer = 0; + a_result->lock.src_indicator = 0; +#endif /* AFS_OSF20_ENV */ +#ifdef AFS_64BIT_ENV + a_result->Length = tvc->m.Length; +#else /* AFS_64BIT_ENV */ +#ifdef AFS_64BIT_CLIENT + a_result->Length = tvc->m.Length; +#else /* AFS_64BIT_CLIENT */ + a_result->Length.high = 0; + a_result->Length.low = tvc->m.Length; +#endif /* AFS_64BIT_CLIENT */ +#endif /* AFS_64BIT_ENV */ + a_result->DataVersion = hgetlo(tvc->m.DataVersion); + a_result->callback = afs_data_pointer_to_int32(tvc->callback); /* XXXX Now a pointer; change it XXXX */ + a_result->cbExpires = tvc->cbExpires; + a_result->refCount = VREFCOUNT(tvc); + a_result->opens = tvc->opens; + a_result->writers = tvc->execsOrWriters; + a_result->mvstat = tvc->mvstat; + a_result->states = tvc->states; + code = 0; + + /* + * Return our results. + */ +fcnDone: + XSTATS_END_TIME; + +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + + return(code); + +} /*SRXAFSCB_GetCE64*/ + /*------------------------------------------------------------------------ * EXPORTED SRXAFSCB_GetLock @@ -1363,3 +1457,74 @@ int SRXAFSCB_GetCacheConfig( return 0; } + +/*------------------------------------------------------------------------ + * EXPORTED SRXAFSCB_FetchData + * + * Description: + * Routine to do third party move from a remioserver to the original + * issuer of an ArchiveData request. Presently supported only by the + * "fs" command, not by the AFS client. + * + * Arguments: + * rxcall: Ptr to Rx call on which this request came in. + * Fid: pointer to AFSFid structure. + * Fd: File descriptor inside fs command. + * Position: Offset in the file. + * Length: Data length to transfer. + * TotalLength: Pointer to total file length field + * + * Returns: + * 0 on success + * + * Environment: + * Nothing interesting. + * + * Side Effects: + *------------------------------------------------------------------------*/ +SRXAFSCB_FetchData(rxcall, Fid, Fd, Position, Length, TotalLength) + struct rx_call *rxcall; + struct AFSFid *Fid; + afs_int32 Fd; + afs_int64 Position; + afs_int64 Length; + afs_int64 *TotalLength; +{ + return ENOSYS; +} + +/*------------------------------------------------------------------------ + * EXPORTED SRXAFSCB_StoreData + * + * Description: + * Routine to do third party move from a remioserver to the original + * issuer of a RetrieveData request. Presently supported only by the + * "fs" command, not by the AFS client. + * + * Arguments: + * rxcall: Ptr to Rx call on which this request came in. + * Fid: pointer to AFSFid structure. + * Fd: File descriptor inside fs command. + * Position: Offset in the file. + * Length: Data length to transfer. + * TotalLength: Pointer to total file length field + * + * Returns: + * 0 on success + * + * Environment: + * Nothing interesting. + * + * Side Effects: + * As advertised. + *------------------------------------------------------------------------*/ +SRXAFSCB_StoreData(rxcall, Fid, Fd, Position, Length, TotalLength) + struct rx_call *rxcall; + struct AFSFid *Fid; + afs_int32 Fd; + afs_int64 Position; + afs_int64 Length; + afs_int64 *TotalLength; +{ + return ENOSYS; +} diff --git a/src/afs/afs_chunkops.h b/src/afs/afs_chunkops.h index caff566..fa246da 100644 --- a/src/afs/afs_chunkops.h +++ b/src/afs/afs_chunkops.h @@ -27,6 +27,11 @@ #else /* AFS_NOCHUNKING */ extern afs_int32 afs_OtherCSize, afs_LogChunk, afs_FirstCSize; +#ifdef AFS_64BIT_CLIENT +#ifdef AFS_VM_RDWR_ENV +extern afs_size_t afs_vmMappingEnd; +#endif /* AFS_VM_RDWR_ENV */ +#endif /* AFS_64BIT_CLIENT */ #define AFS_OTHERCSIZE (afs_OtherCSize) #define AFS_LOGCHUNK (afs_LogChunk) @@ -66,7 +71,7 @@ extern int afs_ChunkOffset(), afs_Chunk(), afs_ChunkBase(), afs_ChunkSize(), afs_OtherCSize) #define AFS_CHUNKTOBASE(chunk) ((chunk == 0) ? 0 : \ - (afs_FirstCSize + ((chunk - 1) << afs_LogChunk))) + ((afs_size_t) afs_FirstCSize + ((afs_size_t) (chunk - 1) << afs_LogChunk))) #define AFS_CHUNKTOSIZE(chunk) ((chunk == 0) ? afs_FirstCSize : afs_OtherCSize) @@ -108,8 +113,8 @@ struct afs_cacheOps { #define afs_GetVolSlot() (*(afs_cacheType->GetVolSlot))() #define afs_HandleLink(avc, areq) (*(afs_cacheType->HandleLink))(avc, areq) -#define afs_CacheFetchProc(call, file, base, adc, avc, toxfer, xfered) \ - (*(afs_cacheType->FetchProc))(call, file, base, adc, avc, toxfer, xfered) +#define afs_CacheFetchProc(call, file, base, adc, avc, toxfer, xfered, length) \ + (*(afs_cacheType->FetchProc))(call, file, (afs_size_t)base, adc, avc, (afs_size_t *)toxfer, (afs_size_t *)xfered, length) #define afs_CacheStoreProc(call, file, bytes, avc, wake, toxfer, xfered) \ (*(afs_cacheType->StoreProc))(call, file, bytes, avc, wake, toxfer, xfered) diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 5ee44eb..3bab9d2 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -355,7 +355,7 @@ void BPath(ab) #ifdef AFS_LINUX22_ENV struct dentry *dp = NULL; #endif - afs_int32 offset, len; + afs_size_t offset, len; struct vrequest treq; afs_int32 code; @@ -394,7 +394,7 @@ void BPath(ab) tvc = (struct vcache *) tvn; #endif /* here we know its an afs vnode, so we can get the data for the chunk */ - tdc = afs_GetDCache(tvc, ab->parm[1], &treq, &offset, &len, 1); + tdc = afs_GetDCache(tvc, (afs_size_t) ab->parm[1], &treq, &offset, &len, 1); if (tdc) { afs_PutDCache(tdc); } @@ -416,13 +416,13 @@ void BPrefetch(ab) register struct brequest *ab; { register struct dcache *tdc; register struct vcache *tvc; - afs_int32 offset, len; + afs_size_t offset, len; struct vrequest treq; AFS_STATCNT(BPrefetch); if (len = afs_InitReq(&treq, ab->cred)) return; tvc = ab->vnode; - tdc = afs_GetDCache(tvc, (afs_int32)ab->parm[0], &treq, &offset, &len, 1); + tdc = afs_GetDCache(tvc, (afs_size_t)ab->parm[0], &treq, &offset, &len, 1); if (tdc) { afs_PutDCache(tdc); } @@ -433,7 +433,7 @@ void BPrefetch(ab) tdc = (struct dcache *) (ab->parm[1]); tdc->flags &= ~DFFetchReq; afs_osi_Wakeup(&tdc->validPos); - if (ab->parm[2]) { + if ((afs_size_t)ab->parm[2]) { #ifdef AFS_SUN5_ENVX mutex_enter(&tdc->lock); tdc->refCount--; @@ -518,7 +518,7 @@ struct brequest *afs_BQueue(aopcode, avc, dontwait, ause, acred, aparm0, aparm1, register struct vcache *avc; struct AFS_UCRED *acred; /* On 64 bit platforms, "long" does the right thing. */ - long aparm0, aparm1, aparm2, aparm3; + afs_size_t aparm0, aparm1, aparm2, aparm3; { register int i; register struct brequest *tb; diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index f1839c3..dd0f2aa 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -37,8 +37,8 @@ extern afs_int32 cacheInfoModTime; /*Last time cache info modified*/ * --------------------- Exported definitions --------------------- */ afs_lock_t afs_xdcache; /*Lock: alloc new disk cache entries*/ -afs_int32 afs_freeDCList; /*Free list for disk cache entries*/ -afs_int32 afs_freeDCCount; /*Count of elts in freeDCList*/ +afs_int32 afs_freeDCList; /*Free list for disk cache entries*/ +afs_int32 afs_freeDCCount; /*Count of elts in freeDCList*/ afs_int32 afs_discardDCList; /*Discarded disk cache entries*/ afs_int32 afs_discardDCCount; /*Count of elts in discardDCList*/ struct dcache *afs_freeDSList; /*Free list for disk slots */ @@ -47,25 +47,36 @@ ino_t cacheInode; /*Inode for CacheItems file*/ struct osi_file *afs_cacheInodep = 0; /* file for CacheItems inode */ struct afs_q afs_DLRU; /*dcache LRU*/ afs_int32 afs_dhashsize = 1024; -afs_int32 *afs_dvhashTbl; /*Data cache hash table*/ -afs_int32 *afs_dchashTbl; /*Data cache hash table*/ -afs_int32 *afs_dvnextTbl; /*Dcache hash table links */ -afs_int32 *afs_dcnextTbl; /*Dcache hash table links */ +afs_int32 *afs_dvhashTbl; /*Data cache hash table*/ +afs_int32 *afs_dchashTbl; /*Data cache hash table*/ +afs_int32 *afs_dvnextTbl; /*Dcache hash table links */ +afs_int32 *afs_dcnextTbl; /*Dcache hash table links */ struct dcache **afs_indexTable; /*Pointers to dcache entries*/ -afs_hyper_t *afs_indexTimes; /*Dcache entry Access times*/ -afs_int32 *afs_indexUnique; /*dcache entry Fid.Unique */ +afs_hyper_t *afs_indexTimes; /*Dcache entry Access times*/ +afs_int32 *afs_indexUnique; /*dcache entry Fid.Unique */ unsigned char *afs_indexFlags; /*(only one) Is there data there?*/ -afs_hyper_t afs_indexCounter; /*Fake time for marking index +afs_hyper_t afs_indexCounter; /*Fake time for marking index entries*/ afs_int32 afs_cacheFiles =0; /*Size of afs_indexTable*/ -afs_int32 afs_cacheBlocks; /*1K blocks in cache*/ -afs_int32 afs_cacheStats; /*Stat entries in cache*/ -afs_int32 afs_blocksUsed; /*Number of blocks in use*/ +afs_int32 afs_cacheBlocks; /*1K blocks in cache*/ +afs_int32 afs_cacheStats; /*Stat entries in cache*/ +afs_int32 afs_blocksUsed; /*Number of blocks in use*/ afs_int32 afs_blocksDiscarded; /*Blocks freed but not truncated */ -afs_int32 afs_fsfragsize = 1023; /*Underlying Filesystem minimum unit +afs_int32 afs_fsfragsize = 1023; /*Underlying Filesystem minimum unit *of disk allocation usually 1K *this value is (truefrag -1 ) to *save a bunch of subtracts... */ +#ifdef AFS_64BIT_CLIENT +#ifdef AFS_VM_RDWR_ENV +afs_size_t afs_vmMappingEnd; /* for large files (>= 2GB) the VM + * mapping an 32bit addressing machines + * can only be used below the 2 GB + * line. From this point upwards we + * must do direct I/O into the cache + * files. The value should be on a + * chunk boundary. */ +#endif /* AFS_VM_RDWR_ENV */ +#endif /* AFS_64BIT_CLIENT */ /* The following is used to ensure that new dcache's aren't obtained when * the cache is nearly full. @@ -207,6 +218,17 @@ afs_StoreWarn(acode, avolume, aflags) } } /*afs_StoreWarn*/ +void afs_MaybeWakeupTruncateDaemon() { + if (!afs_CacheTooFull && afs_CacheIsTooFull()) { + afs_CacheTooFull = 1; + if (!afs_TruncateDaemonRunning) + afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); + } else if (!afs_TruncateDaemonRunning && + afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) { + afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); + } +} + /* Keep statistics on run time for afs_CacheTruncateDaemon. This is a * struct so we need only export one symbol for AIX. */ @@ -218,17 +240,6 @@ struct CTD_stats { int CTD_nSleeps; } CTD_stats; -void afs_MaybeWakeupTruncateDaemon() { - if (!afs_CacheTooFull && afs_CacheIsTooFull()) { - afs_CacheTooFull = 1; - if (!afs_TruncateDaemonRunning) - afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); - } else if (!afs_TruncateDaemonRunning && - afs_blocksDiscarded > CM_MAXDISCARDEDCHUNKS) { - afs_osi_Wakeup((char *)afs_CacheTruncateDaemon); - } -} - u_int afs_min_cache = 0; void afs_CacheTruncateDaemon() { osi_timeval_t CTD_tmpTime; @@ -334,24 +345,25 @@ void afs_CacheTruncateDaemon() { */ void -afs_AdjustSize(adc, anewSize) +afs_AdjustSize(adc, newSize) register struct dcache *adc; - register afs_int32 anewSize; + register afs_int32 newSize; { /*afs_AdjustSize*/ register afs_int32 oldSize; AFS_STATCNT(afs_AdjustSize); + adc->flags |= DFEntryMod; oldSize = ((adc->f.chunkBytes + afs_fsfragsize)^afs_fsfragsize)>>10;/* round up */ - adc->f.chunkBytes = anewSize; - anewSize = ((anewSize + afs_fsfragsize)^afs_fsfragsize)>>10;/* round up */ - if (anewSize > oldSize) { + adc->f.chunkBytes = newSize; + newSize = ((newSize + afs_fsfragsize)^afs_fsfragsize)>>10;/* round up */ + if (newSize > oldSize) { /* We're growing the file, wakeup the daemon */ afs_MaybeWakeupTruncateDaemon(); } - afs_blocksUsed += (anewSize - oldSize); + afs_blocksUsed += (newSize - oldSize); afs_stats_cmperf.cacheBlocksInUse = afs_blocksUsed; /* XXX */ } /*afs_AdjustSize*/ @@ -373,7 +385,7 @@ afs_AdjustSize(adc, anewSize) * * Environment: * The anumber parameter is just a hint; at least one entry MUST be - * moved, of we'll panic. We must be called with afs_xdcache + * moved, or we'll panic. We must be called with afs_xdcache * write-locked. We should try to satisfy both anumber and aneedspace, * whichever is more demanding - need to do several things: * 1. only grab up to anumber victims if aneedSpace <= 0, not @@ -495,6 +507,7 @@ static void afs_GetDownD(int anumber, int *aneedSpace) */ if (tdc->refCount == 1) { unsigned char chunkFlags; + afs_size_t tchunkoffset; afid = &tdc->f.fid; /* xdcache is lower than the xvcache lock */ MReleaseWriteLock(&afs_xdcache); @@ -505,6 +518,7 @@ static void afs_GetDownD(int anumber, int *aneedSpace) skip = 0; if (tdc->refCount > 1) skip = 1; if (tvc) { + tchunkoffset = AFS_CHUNKTOBASE(tdc->f.chunk); chunkFlags = afs_indexFlags[tdc->index]; if (phase == 0 && osi_Active(tvc)) skip = 1; if (phase > 0 && osi_Active(tvc) && (tvc->states & CDCLock) @@ -512,9 +526,9 @@ static void afs_GetDownD(int anumber, int *aneedSpace) if (chunkFlags & IFDataMod) skip = 1; afs_Trace4(afs_iclSetp, CM_TRACE_GETDOWND, ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, skip, - ICL_TYPE_INT32, - (afs_int32)(chunkFlags & IFDirtyPages), - ICL_TYPE_INT32, AFS_CHUNKTOBASE(tdc->f.chunk)); + ICL_TYPE_INT32, tdc->index, + ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(tchunkoffset)); #if defined(AFS_SUN5_ENV) /* @@ -599,6 +613,11 @@ endmultipage: if (skip) { /* skip this guy and mark him as recently used */ afs_indexFlags[tdc->index] |= IFFlag; + afs_Trace4(afs_iclSetp, CM_TRACE_GETDOWND, + ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, 2, + ICL_TYPE_INT32, tdc->index, + ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(tchunkoffset)); } else { /* flush this dude from the data cache and reclaim; @@ -607,6 +626,11 @@ endmultipage: * melt it down for parts. Note that any concurrent * (new possibility!) calls to GetDownD won't touch * this guy because his reference count is > 0. */ + afs_Trace4(afs_iclSetp, CM_TRACE_GETDOWND, + ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, 3, + ICL_TYPE_INT32, tdc->index, + ICL_TYPE_OFFSET, + ICL_HANDLE_OFFSET(tchunkoffset)); #ifndef AFS_DEC_ENV AFS_STATCNT(afs_gget); #endif @@ -1091,7 +1115,7 @@ afs_TryToSmush(avc, acred, sync) register int i; AFS_STATCNT(afs_TryToSmush); afs_Trace2(afs_iclSetp, CM_TRACE_TRYTOSMUSH, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); sync = 1; /* XX Temp testing XX*/ #if defined(AFS_SUN5_ENV) @@ -1162,7 +1186,7 @@ afs_TryToSmush(avc, acred, sync) struct dcache *afs_FindDCache(avc, abyte) register struct vcache *avc; - afs_int32 abyte; + afs_size_t abyte; { /*afs_FindDCache*/ @@ -1228,10 +1252,10 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake, register struct rx_call *acall; struct osi_file *afile; register afs_int32 alen; + afs_size_t *abytesToXferP; + afs_size_t *abytesXferredP; struct vcache *avc; int *shouldWake; - afs_int32 *abytesToXferP; - afs_int32 *abytesXferredP; { /* afs_UFSCacheStoreProc*/ afs_int32 code, got; @@ -1249,8 +1273,10 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake, (*abytesXferredP) = 0; #endif /* AFS_NOSTATS */ - afs_Trace3(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, ICL_TYPE_INT32, alen); + afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc, + ICL_TYPE_FID, &(avc->fid), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_INT32, alen); tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ); while (alen > 0) { tlen = (alen > AFS_LRALLOCSIZ ? AFS_LRALLOCSIZ : alen); @@ -1263,6 +1289,8 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake, osi_FreeLargeSpace(tbuffer); return EIO; } + afs_Trace1(afs_iclSetp, CM_TRACE_STOREPROC2, ICL_TYPE_INT32, got); +if (got == 0) printf("StoreProc: got == 0\n"); #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ @@ -1289,6 +1317,10 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake, afs_wakeup(avc); } } + afs_Trace4(afs_iclSetp, CM_TRACE_STOREPROC, ICL_TYPE_POINTER, avc, + ICL_TYPE_FID, &(avc->fid), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_INT32, alen); osi_FreeLargeSpace(tbuffer); return 0; @@ -1320,44 +1352,46 @@ static int afs_UFSCacheStoreProc(acall, afile, alen, avc, shouldWake, */ static int afs_UFSCacheFetchProc(acall, afile, abase, adc, avc, - abytesToXferP, abytesXferredP) + abytesToXferP, abytesXferredP, lengthFound) register struct rx_call *acall; - afs_int32 abase; + afs_size_t abase; + afs_size_t *abytesToXferP; + afs_size_t *abytesXferredP; struct dcache *adc; struct vcache *avc; struct osi_file *afile; - afs_int32 *abytesToXferP; - afs_int32 *abytesXferredP; - + afs_int32 lengthFound; { /*UFS_CacheFetchProc*/ - afs_int32 length; register afs_int32 code; register char *tbuffer; register int tlen; - int moredata; + int moredata = 0; AFS_STATCNT(UFS_CacheFetchProc); afile->offset = 0; /* Each time start from the beginning */ + length = lengthFound; #ifndef AFS_NOSTATS (*abytesToXferP) = 0; (*abytesXferredP) = 0; #endif /* AFS_NOSTATS */ tbuffer = osi_AllocLargeSpace(AFS_LRALLOCSIZ); do { + if (moredata) { #ifdef RX_ENABLE_LOCKS - AFS_GUNLOCK(); + AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ - code = rx_Read(acall, (char *)&length, sizeof(afs_int32)); + code = rx_Read(acall, (char *)&length, sizeof(afs_int32)); + length = ntohl(length); #ifdef RX_ENABLE_LOCKS - AFS_GLOCK(); + AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ - if (code != sizeof(afs_int32)) { - osi_FreeLargeSpace(tbuffer); - code = rx_Error(acall); - return (code?code:-1); /* try to return code, not -1 */ + if (code != sizeof(afs_int32)) { + osi_FreeLargeSpace(tbuffer); + code = rx_Error(acall); + return (code?code:-1); /* try to return code, not -1 */ + } } - length = ntohl(length); /* * The fetch protocol is extended for the AFS/DFS translator * to allow multiple blocks of data, each with its own length, @@ -1390,6 +1424,9 @@ static int afs_UFSCacheFetchProc(acall, afile, abase, adc, avc, #endif /* AFS_NOSTATS */ if (code != tlen) { osi_FreeLargeSpace(tbuffer); + afs_Trace3(afs_iclSetp, CM_TRACE_FETCH64READ, + ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code, + ICL_TYPE_INT32, length); return -34; } code = afs_osi_Write(afile, -1, tbuffer, tlen); @@ -1428,6 +1465,8 @@ static int afs_UFSCacheFetchProc(acall, afile, abase, adc, avc, * aflags : Settings as follows: * 1 : Set locks * 2 : Return after creating entry. + * 4 : called from afs_vnop_write.c + * *alen contains length of data to be written. * OUT: * aoffset : Set to the offset within the chunk where the resident * byte is located. @@ -1463,9 +1502,9 @@ void updateV2DC(int l, struct vcache *v, struct dcache *d, int src) { struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) register struct vcache *avc; /*Held*/ - afs_int32 abyte; + afs_size_t abyte; + afs_size_t *aoffset, *alen; int aflags; - afs_int32 *aoffset, *alen; register struct vrequest *areq; { /*afs_GetDCache*/ @@ -1475,22 +1514,29 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) afs_int32 index; afs_int32 us; afs_int32 chunk; - afs_int32 maxGoodLength; /* amount of good data at server */ + afs_size_t maxGoodLength; /* amount of good data at server */ struct rx_call *tcall; - afs_int32 Position = 0; - afs_int32 size; /* size of segment to transfer */ + afs_size_t Position = 0; +#ifdef AFS_64BIT_CLIENT + afs_size_t tsize; +#endif /* AFS_64BIT_CLIENT */ + afs_int32 size, tlen; /* size of segment to transfer */ + afs_size_t lengthFound; /* as returned from server */ struct tlocal1 *tsmall; register struct dcache *tdc; register struct osi_file *file; register struct conn *tc; int downDCount = 0; + int doAdjustSize = 0; + int doReallyAdjustSize = 0; + int overWriteWholeChunk = 0; XSTATS_DECLS #ifndef AFS_NOSTATS struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */ osi_timeval_t xferStartTime, /*FS xfer start time*/ xferStopTime; /*FS xfer stop time*/ - afs_int32 bytesToXfer; /* # bytes to xfer*/ - afs_int32 bytesXferred; /* # bytes actually xferred*/ + afs_size_t bytesToXfer; /* # bytes to xfer*/ + afs_size_t bytesXferred; /* # bytes actually xferred*/ struct afs_stats_AccessInfo *accP; /*Ptr to access record in stats*/ int fromReplica; /*Are we reading from a replica?*/ int numFetchLoops; /*# times around the fetch/analyze loop*/ @@ -1505,7 +1551,7 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) * Determine the chunk number and offset within the chunk corresponding * to the desired byte. */ - if (vType(avc) == VDIR) { + if (avc->fid.Fid.Vnode & 1) { /* if (vType(avc) == VDIR) */ chunk = 0; } else { @@ -1680,59 +1726,76 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) * read rpcs on newly created files (dv of 0) since only then we guarantee * that this chunk's data hasn't been filled by another client. */ - if (!hiszero(avc->m.DataVersion)) - aflags &= ~4; + size = AFS_CHUNKSIZE(abyte); + tlen = *alen; + Position = AFS_CHUNKTOBASE(chunk); + afs_Trace4(afs_iclSetp, CM_TRACE_GETDCACHE3, + ICL_TYPE_INT32, tlen, + ICL_TYPE_INT32, aflags, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(abyte), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(Position)); + if ((aflags & 4) && (hiszero(avc->m.DataVersion))) + doAdjustSize = 1; + if ((aflags & 4) && (abyte == Position) && (tlen >= size)) + overWriteWholeChunk = 1; + if (doAdjustSize || overWriteWholeChunk) { #if defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) -#ifdef AFS_SGI_ENV -#ifdef AFS_SGI64_ENV - if (aflags & 4) adjustsize = NBPP; -#else - if (aflags & 4) adjustsize = 8192; -#endif -#else - if (aflags & 4) adjustsize = 4096; -#endif - if (AFS_CHUNKTOBASE(chunk)+adjustsize >= avc->m.Length && -#else -#if defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) - if (((aflags & 4) || (AFS_CHUNKTOBASE(chunk) >= avc->m.Length)) && -#else - if (AFS_CHUNKTOBASE(chunk) >= avc->m.Length && -#endif -#endif - !hsame(avc->m.DataVersion, tdc->f.versionNo)) { - /* no data in file to read at this position */ - if (setLocks) { - ReleaseReadLock(&avc->lock); - ObtainWriteLock(&avc->lock,64); - } - /* check again, now that we have a write lock */ + #ifdef AFS_SGI_ENV + #ifdef AFS_SGI64_ENV + if (doAdjustSize) adjustsize = NBPP; + #else /* AFS_SGI64_ENV */ + if (doAdjustSize) adjustsize = 8192; + #endif /* AFS_SGI64_ENV */ + #else /* AFS_SGI_ENV */ + if (doAdjustSize) adjustsize = 4096; + #endif /* AFS_SGI_ENV */ + if (AFS_CHUNKTOBASE(chunk)+adjustsize >= avc->m.Length && +#else /* defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) */ + #if defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) + if ((doAdjustSize || (AFS_CHUNKTOBASE(chunk) >= avc->m.Length)) && + #else + if (AFS_CHUNKTOBASE(chunk) >= avc->m.Length && + #endif +#endif /* defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) */ + !hsame(avc->m.DataVersion, tdc->f.versionNo)) + doReallyAdjustSize = 1; + if (doReallyAdjustSize || overWriteWholeChunk) { + doReallyAdjustSize = 0; + /* no data in file to read at this position */ + if (setLocks) { + ReleaseReadLock(&avc->lock); + ObtainWriteLock(&avc->lock,64); + } + /* check again, now that we have a write lock */ #if defined(AFS_AIX32_ENV) || defined(AFS_SGI_ENV) - if (AFS_CHUNKTOBASE(chunk)+adjustsize >= avc->m.Length && + if (AFS_CHUNKTOBASE(chunk)+adjustsize >= avc->m.Length && #else #if defined(AFS_SUN_ENV) || defined(AFS_OSF_ENV) - if (((aflags & 4) || (AFS_CHUNKTOBASE(chunk) >= avc->m.Length)) && + if ((doAdjustSize || (AFS_CHUNKTOBASE(chunk) >= avc->m.Length)) && #else - if (AFS_CHUNKTOBASE(chunk) >= avc->m.Length && + if (AFS_CHUNKTOBASE(chunk) >= avc->m.Length && #endif #endif - !hsame(avc->m.DataVersion, tdc->f.versionNo)) { - file = afs_CFileOpen(tdc->f.inode); - afs_CFileTruncate(file, 0); - afs_CFileClose(file); - afs_AdjustSize(tdc, 0); - hset(tdc->f.versionNo, avc->m.DataVersion); - tdc->flags |= DFEntryMod; - } - if (setLocks) { - ReleaseWriteLock(&avc->lock); - ObtainReadLock(&avc->lock); + !hsame(avc->m.DataVersion, tdc->f.versionNo)) + doReallyAdjustSize = 1; + if (doReallyAdjustSize || overWriteWholeChunk) { + file = afs_CFileOpen(tdc->f.inode); + afs_CFileTruncate(file, 0); + afs_CFileClose(file); + afs_AdjustSize(tdc, 0); + hset(tdc->f.versionNo, avc->m.DataVersion); + tdc->flags |= DFEntryMod; + } + if (setLocks) { + ReleaseWriteLock(&avc->lock); + ObtainReadLock(&avc->lock); + } } } if (setLocks) ReleaseReadLock(&avc->lock); /* - * We must read in the whole chunk iff the version number doesn't + * We must read in the whole chunk if the version number doesn't * match. */ if (aflags & 2) { @@ -1745,7 +1808,7 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) osi_Assert(setLocks || WriteLocked(&avc->lock)); if (setLocks) ObtainReadLock(&avc->lock); - if (!hsame(avc->m.DataVersion, tdc->f.versionNo)) { + if (!hsame(avc->m.DataVersion, tdc->f.versionNo) && !overWriteWholeChunk) { /* * Version number mismatch. */ @@ -1877,10 +1940,13 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) (accP->unreplicatedRefs)++; #endif /* AFS_NOSTATS */ /* this is a cache miss */ - afs_stats_cmperf.dcacheMisses++; - afs_Trace3(afs_iclSetp, CM_TRACE_FETCHPROC, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, Position, ICL_TYPE_INT32, size); + afs_Trace4(afs_iclSetp, CM_TRACE_FETCHPROC, ICL_TYPE_POINTER, avc, + ICL_TYPE_FID, &(avc->fid), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(Position), + ICL_TYPE_INT32, size); + if (size) afs_stats_cmperf.dcacheMisses++; + code = 0; /* * Dynamic root support: fetch data from local memory. */ @@ -1909,9 +1975,10 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) /* * Not a dynamic vnode: do the real fetch. */ - do { + if (size) do { tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); if (tc) { + afs_int32 length_hi, length, bytes; #ifndef AFS_NOSTATS numFetchLoops++; if (fromReplica) @@ -1931,6 +1998,81 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_FETCHDATA); +#ifdef AFS_64BIT_CLIENT + length_hi = code = 0; + if (!afs_serverHasNo64Bit(tc)) { + tsize = size; +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + code = StartRXAFS_FetchData64(tcall, + (struct AFSFid *) &avc->fid.Fid, + Position, tsize); + if (code != 0) { +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + } else { + bytes = rx_Read(tcall, (char *)&length_hi, sizeof(afs_int32)); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (bytes == sizeof(afs_int32)) { + length_hi = ntohl(length_hi); + } else { + length_hi = 0; + code = rx_Error(tcall); +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + code1 = rx_EndCall(tcall, code); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + afs_Trace2(afs_iclSetp, CM_TRACE_FETCH64CODE, + ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code); + tcall = (struct rx_call *) 0; + } + } + } + if (code == RXGEN_OPCODE || afs_serverHasNo64Bit(tc)) { + if (Position > 0xFFFFFFFF) { + code = EFBIG; + } else { + afs_int32 pos; + pos = Position; +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (!tcall) + tcall = rx_NewCall(tc->id); + code = StartRXAFS_FetchData(tcall, + (struct AFSFid *) &avc->fid.Fid, pos, size); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + } + afs_serverSetNo64Bit(tc); + } + if (code == 0) { +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + bytes = rx_Read(tcall, (char *)&length, sizeof(afs_int32)); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (bytes == sizeof(afs_int32)) { + length = ntohl(length); + } else { + code = rx_Error(tcall); + } + } + FillInt64(lengthFound, length_hi, length); + afs_Trace3(afs_iclSetp, CM_TRACE_FETCH64LENG, + ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(lengthFound)); +#else /* AFS_64BIT_CLIENT */ #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ @@ -1940,14 +2082,30 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ + if (code == 0) { +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + bytes = rx_Read(tcall, (char *)&length, sizeof(afs_int32)); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (bytes == sizeof(afs_int32)) { + length = ntohl(length); + } else { + code = rx_Error(tcall); + } + } +#endif /* AFS_64BIT_CLIENT */ if (code == 0) { #ifndef AFS_NOSTATS xferP = &(afs_stats_cmfullperf.rpc.fsXferTimes[AFS_STATS_FS_XFERIDX_FETCHDATA]); osi_GetuTime(&xferStartTime); - code = afs_CacheFetchProc(tcall, file, Position, tdc, avc, - &bytesToXfer, &bytesXferred); + code = afs_CacheFetchProc(tcall, file, + (afs_size_t) Position, tdc, avc, + &bytesToXfer, &bytesXferred, length); osi_GetuTime(&xferStopTime); (xferP->numXfers)++; @@ -2002,7 +2160,7 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) } } #else - code = afs_CacheFetchProc(tcall, file, Position, tdc, avc, 0, 0); + code = afs_CacheFetchProc(tcall, file, Position, tdc, avc, 0, 0, length); #endif /* AFS_NOSTATS */ } if (code == 0) { @@ -2018,7 +2176,14 @@ struct dcache *afs_GetDCache(avc, abyte, areq, aoffset, alen, aflags) #endif /* RX_ENABLE_LOCKS */ } XSTATS_END_TIME; - code1 = rx_EndCall(tcall, code); +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (tcall) + code1 = rx_EndCall(tcall, code); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ UpgradeSToWLock(&avc->lock,27); } else { @@ -2490,7 +2655,7 @@ int afs_InitCacheFile(afile, ainode) { /*afs_InitCacheFile*/ register afs_int32 code; -#ifdef AFS_LINUX22_ENV +#if defined(AFS_LINUX22_ENV) struct dentry *filevp; #else struct vnode *filevp; @@ -2731,8 +2896,6 @@ void afs_dcacheInit(int afiles, int ablocks, int aDentries, int achunk, afs_dcentries = aDentries; afs_blocksUsed = 0; QInit(&afs_DLRU); - - } /* diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index f5b95b8..04c8f1c 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -223,6 +223,11 @@ afs_CacheInit(astatSize, afiles, ablocks, aDentries, aVolumes, achunk, aflags, afs_cacheStats = astatSize; afs_vcacheInit(astatSize); afs_dcacheInit(afiles, ablocks, aDentries, achunk, aflags); +#ifdef AFS_64BIT_CLIENT +#ifdef AFS_VM_RDWR_ENV + afs_vmMappingEnd = AFS_CHUNKBASE(0x7fffffff); +#endif /* AFS_VM_RDWR_ENV */ +#endif /* AFS_64BIT_CLIENT */ #if defined(AFS_AIX_ENV) { diff --git a/src/afs/afs_memcache.c b/src/afs/afs_memcache.c index f795110..b4b6848 100644 --- a/src/afs/afs_memcache.c +++ b/src/afs/afs_memcache.c @@ -106,6 +106,11 @@ void *afs_MemCacheOpen(ino_t blkno) osi_Panic("afs_MemCacheOpen: invalid block #"); } mep = (memCache + blkno); + afs_Trace4(afs_iclSetp, CM_TRACE_MEMOPEN, + ICL_TYPE_INT32, blkno, + ICL_TYPE_POINTER, mep, + ICL_TYPE_POINTER, mep->data, + ICL_TYPE_STRING, mep->data); return (void *) mep; } @@ -257,7 +262,7 @@ afs_MemWritevBlk(mceP, offset, iov, nio, size) int bytesToWrite; AFS_STATCNT(afs_MemWriteBlk); MObtainWriteLock(&mceP->afs_memLock,561); - if (size + offset > mceP->dataSize) { + if (offset + size > mceP->dataSize) { char *oldData = mceP->data; mceP->data = afs_osi_Alloc(size+offset); @@ -338,14 +343,15 @@ afs_MemCacheTruncate(mceP, size) return 0; } -afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesXferredP) +afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesXferredP, length) register struct memCacheEntry *mceP; register struct rx_call *acall; register afs_int32 alen; struct vcache *avc; int *shouldWake; - afs_int32 *abytesToXferP; - afs_int32 *abytesXferredP; + afs_size_t *abytesToXferP; + afs_size_t *abytesXferredP; + afs_int32 length; { @@ -371,7 +377,7 @@ afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesX */ tiov = (struct iovec *) osi_AllocSmallSpace(sizeof(struct iovec)*RX_MAXIOVECS); if(!tiov) { - osi_Panic("afs_MemCacheFetchProc: osi_AllocSmallSpace for iovecs returned NULL\n"); + osi_Panic("afs_MemCacheStoreProc: osi_AllocSmallSpace for iovecs returned NULL\n"); } #ifdef notdef @@ -385,10 +391,16 @@ afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesX else *shouldWake = 1; } #endif /* notdef */ - + while (alen > 0) { tlen = (alen > AFS_LRALLOCSIZ? AFS_LRALLOCSIZ : alen); +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ code = rx_WritevAlloc(acall, tiov, &tnio, RX_MAXIOVECS, tlen); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ if (code <= 0) { osi_FreeSmallSpace(tiov); return -33; @@ -399,7 +411,13 @@ afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesX osi_FreeSmallSpace(tiov); return -33; } +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ code = rx_Writev(acall, tiov, tnio, tlen); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ #ifndef AFS_NOSTATS (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ @@ -419,24 +437,30 @@ afs_MemCacheStoreProc(acall, mceP, alen, avc, shouldWake, abytesToXferP, abytesX return 0; } -afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferredP) +afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferredP, lengthFound) register struct rx_call *acall; - afs_int32 abase; + afs_size_t abase; + afs_size_t *abytesToXferP; + afs_size_t *abytesXferredP; struct dcache *adc; struct vcache *avc; register struct memCacheEntry *mceP; - afs_int32 *abytesToXferP; - afs_int32 *abytesXferredP; - - { - afs_int32 length; + afs_int32 lengthFound; +{ register afs_int32 code; - register int tlen, offset=0; - int moredata; + afs_int32 length; + int moredata = 0; struct iovec *tiov; /* no data copying with iovec */ + register int tlen, offset=0; int tnio; /* temp for iovec size */ AFS_STATCNT(afs_MemCacheFetchProc); + length = lengthFound; + afs_Trace4(afs_iclSetp, CM_TRACE_MEMFETCH, + ICL_TYPE_POINTER, avc, + ICL_TYPE_POINTER, mceP, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(abase), + ICL_TYPE_INT32, length); #ifndef AFS_NOSTATS (*abytesToXferP) = 0; (*abytesXferredP) = 0; @@ -450,13 +474,21 @@ afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferred osi_Panic("afs_MemCacheFetchProc: osi_AllocSmallSpace for iovecs returned NULL\n"); } do { - code = rx_Read(acall, (char *)&length, sizeof(afs_int32)); - if (code != sizeof(afs_int32)) { - code = rx_Error(acall); - osi_FreeSmallSpace(tiov); - return (code?code:-1); /* try to return code, not -1 */ + if (moredata) { +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ + code = rx_Read(acall, (char *)&length, sizeof(afs_int32)); + length = ntohl(length); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ + if (code != sizeof(afs_int32)) { + code = rx_Error(acall); + osi_FreeSmallSpace(tiov); + return (code?code:-1); /* try to return code, not -1 */ + } } - length = ntohl(length); /* * The fetch protocol is extended for the AFS/DFS translator * to allow multiple blocks of data, each with its own length, @@ -477,11 +509,20 @@ afs_MemCacheFetchProc(acall, mceP, abase, adc, avc, abytesToXferP, abytesXferred #endif /* AFS_NOSTATS */ while (length > 0) { tlen = (length > AFS_LRALLOCSIZ? AFS_LRALLOCSIZ : length); +#ifdef RX_ENABLE_LOCKS + AFS_GUNLOCK(); +#endif /* RX_ENABLE_LOCKS */ code = rx_Readv(acall, tiov, &tnio, RX_MAXIOVECS, tlen); +#ifdef RX_ENABLE_LOCKS + AFS_GLOCK(); +#endif /* RX_ENABLE_LOCKS */ #ifndef AFS_NOSTATS (*abytesXferredP) += code; #endif /* AFS_NOSTATS */ if (code <= 0) { + afs_Trace3(afs_iclSetp, CM_TRACE_FETCH64READ, + ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code, + ICL_TYPE_INT32, length); osi_FreeSmallSpace(tiov); return -34; } diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index c0fcb12..ebda69c 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1673,7 +1673,7 @@ static PNewStatMount(avc, afun, areq, ain, aout, ainSize, aoutSize) struct VenusFid tfid; char *bufp; struct sysname_info sysState; - afs_int32 offset, len; + afs_size_t offset, len; AFS_STATCNT(PNewStatMount); if (!avc) return EINVAL; @@ -1682,7 +1682,7 @@ static PNewStatMount(avc, afun, areq, ain, aout, ainSize, aoutSize) if (vType(avc) != VDIR) { return ENOTDIR; } - tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 1); + tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); if (!tdc) return ENOENT; Check_AtSys(avc, ain, &sysState, areq); do { @@ -2354,7 +2354,7 @@ static PRemoveMount(avc, afun, areq, ain, aout, ainSize, aoutSize) register afs_int32 code; char *bufp; struct sysname_info sysState; - afs_int32 offset, len; + afs_size_t offset, len; register struct conn *tc; register struct dcache *tdc; register struct vcache *tvc; @@ -2372,7 +2372,7 @@ static PRemoveMount(avc, afun, areq, ain, aout, ainSize, aoutSize) if (code) return code; if (vType(avc) != VDIR) return ENOTDIR; - tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 1); /* test for error below */ + tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); /* test for error below */ if (!tdc) return ENOENT; Check_AtSys(avc, ain, &sysState, areq); do { @@ -3558,7 +3558,7 @@ static PFlushMount(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) struct VenusFid tfid; char *bufp; struct sysname_info sysState; - afs_int32 offset, len; + afs_size_t offset, len; AFS_STATCNT(PFlushMount); if (!avc) return EINVAL; @@ -3567,7 +3567,7 @@ static PFlushMount(avc, afun, areq, ain, aout, ainSize, aoutSize, acred) if (vType(avc) != VDIR) { return ENOTDIR; } - tdc = afs_GetDCache(avc, 0, areq, &offset, &len, 1); + tdc = afs_GetDCache(avc, (afs_size_t) 0, areq, &offset, &len, 1); if (!tdc) return ENOENT; Check_AtSys(avc, ain, &sysState, areq); do { diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 980e5ea..b3c25a1 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -60,7 +60,7 @@ int afs_StoreMini(avc, areq) struct AFSVolSync tsync; register afs_int32 code; register struct rx_call *tcall; - afs_int32 tlen; + afs_size_t tlen, base = 0; XSTATS_DECLS AFS_STATCNT(afs_StoreMini); @@ -77,6 +77,7 @@ int afs_StoreMini(avc, areq) #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ +retry: tcall = rx_NewCall(tc->id); #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); @@ -92,14 +93,42 @@ int afs_StoreMini(avc, areq) InStatus.Mask = AFS_SETMODTIME; InStatus.ClientModTime = avc->m.Date; XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_STOREDATA); + afs_Trace4(afs_iclSetp, CM_TRACE_STOREDATA64, + ICL_TYPE_FID, &avc->fid.Fid, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(base), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ +#ifdef AFS_64BIT_CLIENT + if (!afs_serverHasNo64Bit(tc)) { + code = StartRXAFS_StoreData64(tcall, + (struct AFSFid *)&avc->fid.Fid, + &InStatus, avc->m.Length, + base, tlen); + } else { + afs_int32 l1, l2; + l1 = avc->m.Length; + l2 = tlen; + code = StartRXAFS_StoreData(tcall, + (struct AFSFid *)&avc->fid.Fid, + &InStatus, l1, 0, l2); + } +#else /* AFS_64BIT_CLIENT */ code = StartRXAFS_StoreData(tcall, (struct AFSFid *)&avc->fid.Fid, &InStatus, avc->m.Length, 0, tlen); +#endif /* AFS_64BIT_CLIENT */ if (code == 0) { code = EndRXAFS_StoreData(tcall, &OutStatus, &tsync); +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE) { + afs_serverSetNo64Bit(tc); + code = rx_EndCall(tcall, code); + goto retry; + } +#endif /* AFS_64BIT_CLIENT */ } code = rx_EndCall(tcall, code); #ifdef RX_ENABLE_LOCKS @@ -161,15 +190,15 @@ afs_StoreAllSegments(avc, areq, sync) afs_hyper_t newDV, oldDV; /* DV when we start, and finish, respectively */ struct dcache **dcList, **dclist; unsigned int i, j, minj, maxj, moredata, high, off; - unsigned long tlen; + afs_size_t tlen; + afs_size_t maxStoredLength; /* highest offset we've written to server. */ int safety; - int maxStoredLength; /* highest offset we've written to server. */ #ifndef AFS_NOSTATS struct afs_stats_xferData *xferP; /* Ptr to this op's xfer struct */ osi_timeval_t xferStartTime, /*FS xfer start time*/ xferStopTime; /*FS xfer stop time*/ - afs_int32 bytesToXfer; /* # bytes to xfer*/ - afs_int32 bytesXferred; /* # bytes actually xferred*/ + afs_size_t bytesToXfer; /* # bytes to xfer*/ + afs_size_t bytesXferred; /* # bytes actually xferred*/ #endif /* AFS_NOSTATS */ @@ -181,7 +210,7 @@ afs_StoreAllSegments(avc, areq, sync) foreign = (avc->states & CForeign); dcList = (struct dcache **) osi_AllocLargeSpace(AFS_LRALLOCSIZ); afs_Trace2(afs_iclSetp, CM_TRACE_STOREALL, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); #ifndef AFS_AIX32_ENV /* In the aix vm implementation we need to do the vm_writep even * on the memcache case since that's we adjust the file's size @@ -251,7 +280,6 @@ afs_StoreAllSegments(avc, areq, sync) (afs_indexUnique[index] == avc->fid.Fid.Unique)) { tdc = afs_GetDSlot(index, 0); /* refcount+1. */ if (!FidCmp( &tdc->f.fid, &avc->fid ) && tdc->f.chunk >= minj ) { - off = tdc->f.chunk - minj; if (off < NCHUNKSATONCE) { if ( dcList[ off ] ) @@ -263,8 +291,7 @@ afs_StoreAllSegments(avc, areq, sync) j++; if (tlen <= 0) break; - } - else { + } else { moredata = TRUE; lockedPutDCache(tdc); if (j == NCHUNKSATONCE) @@ -284,7 +311,8 @@ afs_StoreAllSegments(avc, areq, sync) if (j) { static afs_uint32 lp1 = 10000, lp2 = 10000; struct AFSStoreStatus InStatus; - afs_uint32 base, bytes, nchunks; + afs_size_t base, bytes; + afs_uint32 nchunks; int nomore; unsigned int first; int *shouldwake; @@ -336,17 +364,43 @@ afs_StoreAllSegments(avc, areq, sync) InStatus.Mask |= AFS_FSYNC; } tlen = lmin(avc->m.Length, avc->truncPos); + afs_Trace4(afs_iclSetp, CM_TRACE_STOREDATA64, + ICL_TYPE_FID, &avc->fid.Fid, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(base), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(bytes), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(tlen)); do { stored = 0; tc = afs_Conn(&avc->fid, areq); if (tc) { +restart: #ifdef RX_ENABLE_LOCKS AFS_GUNLOCK(); #endif /* RX_ENABLE_LOCKS */ tcall = rx_NewCall(tc->id); +#ifdef AFS_64BIT_CLIENT + if (!afs_serverHasNo64Bit(tc)) { + code = StartRXAFS_StoreData64(tcall, + (struct AFSFid *) &avc->fid.Fid, + &InStatus, base, bytes, tlen); + } else { + if (tlen > 0xFFFFFFFF) { + code = EFBIG; + } else { + afs_int32 t1, t2, t3; + t1 = base; + t2 = bytes; + t3 = tlen; + code = StartRXAFS_StoreData(tcall, + (struct AFSFid *) &avc->fid.Fid, + &InStatus, t1, t2, t3); + } + } +#else /* AFS_64BIT_CLIENT */ code = StartRXAFS_StoreData(tcall, (struct AFSFid *) &avc->fid.Fid, &InStatus, base, bytes, tlen); +#endif /* AFS_64BIT_CLIENT */ #ifdef RX_ENABLE_LOCKS AFS_GLOCK(); #endif /* RX_ENABLE_LOCKS */ @@ -365,6 +419,11 @@ afs_StoreAllSegments(avc, areq, sync) storeallmissing++; continue; /* panic? */ } + afs_Trace4(afs_iclSetp, CM_TRACE_STOREALL2, + ICL_TYPE_POINTER, avc, + ICL_TYPE_INT32, tdc->f.chunk, + ICL_TYPE_INT32, tdc->index, + ICL_TYPE_INT32, tdc->f.inode); shouldwake = 0; if (nomore) { if (avc->asynchrony == -1) { @@ -437,10 +496,16 @@ afs_StoreAllSegments(avc, areq, sync) } } #else - code = afs_CacheStoreProc(tcall, tfile, tdc->f.chunkBytes, avc, - shouldwake, &lp1, &lp2); + code = afs_CacheStoreProc(tcall, tfile, tdc->f.chunkBytes, + avc, shouldwake, &lp1, &lp2); #endif /* AFS_NOSTATS */ afs_CFileClose(tfile); +#ifdef AFS_64BIT_CLIENT + if (code == RXGEN_OPCODE) { + afs_serverSetNo64Bit(tc); + goto restart; + } +#endif /* AFS_64BIT_CLIENT */ if ((tdc->f.chunkBytes < afs_OtherCSize) && (i < (nchunks-1))) { int bsent, tlen, tlen1=0, sbytes = afs_OtherCSize - tdc->f.chunkBytes; @@ -692,7 +757,7 @@ afs_InvalidateAllSegments(avc, asetLock) AFS_STATCNT(afs_InvalidateAllSegments); afs_Trace2(afs_iclSetp, CM_TRACE_INVALL, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); hash = DVHash(&avc->fid); avc->truncPos = AFS_NOTRUNC; /* don't truncate later */ avc->states &= ~CExtendedFile; /* not any more */ @@ -754,7 +819,7 @@ afs_InvalidateAllSegments(avc, asetLock) * held. */ afs_TruncateAllSegments(avc, alen, areq, acred) - afs_int32 alen; + afs_size_t alen; register struct vcache *avc; struct vrequest *areq; struct AFS_UCRED *acred; @@ -780,12 +845,14 @@ afs_TruncateAllSegments(avc, alen, areq, acred) avc->states |= CExtendedFile; avc->m.Length = alen; afs_Trace3(afs_iclSetp, CM_TRACE_TRUNCALL1, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, ICL_TYPE_INT32, alen); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(alen)); return 0; } afs_Trace3(afs_iclSetp, CM_TRACE_TRUNCALL2, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, ICL_TYPE_INT32, alen); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(alen)); #if (defined(AFS_SUN5_ENV)) diff --git a/src/afs/afs_stats.h b/src/afs/afs_stats.h index a0919dc..495463d 100644 --- a/src/afs/afs_stats.h +++ b/src/afs/afs_stats.h @@ -189,6 +189,7 @@ struct afs_CMCallStats { afs_int32 C_shutdown_BKG; /* afs_call.c*/ afs_int32 C_shutdown_afstest; /* afs_call.c*/ afs_int32 C_SRXAFSCB_GetCE; /* afs_callback.c*/ + afs_int32 C_SRXAFSCB_GetCE64; /* afs_callback.c*/ afs_int32 C_ClearCallBack; /* afs_callback.c*/ afs_int32 C_SRXAFSCB_GetLock; /* afs_callback.c*/ afs_int32 C_SRXAFSCB_CallBack; /* afs_callback.c*/ diff --git a/src/afs/afs_trace.et b/src/afs/afs_trace.et index 42dd715..3c65d28 100644 --- a/src/afs/afs_trace.et +++ b/src/afs/afs_trace.et @@ -15,15 +15,15 @@ error_table 2 ZCM ec CM_TRACE_VMRW, "vmrw vp 0x%lx, write=0x%x, off=0x%x, len=0x%x" ec CM_TRACE_STRATEGYDONE, "strategy done vp 0x%lx code 0x%x left 0x%x" ec CM_TRACE_FLUSHV, "flushv vp 0x%lx states 0x%x" - ec CM_TRACE_GETDOWND, "getdownd vp 0x%lx skip 0x%x idxf 0x%x coff 0x%x" + ec CM_TRACE_GETDOWND, "getdownd vp 0x%lx skip 0x%x index %d coff (0x%x, 0x%x)" ec CM_TRACE_ACTCCORE, "ActiveCore vp 0x%lx XoW 0x%x" - ec CM_TRACE_WVCACHE, "RXAFS_StoreStatus vp 0x%lx len 0x%x" + ec CM_TRACE_WVCACHE, "RXAFS_StoreStatus vp 0x%lx len (0x%x, 0x%x)" ec CM_TRACE_TRYTOSMUSH, "TryToSmush vp 0x%lx len 0x%x" - ec CM_TRACE_STOREPROC, "StoreProc vp 0x%lx tlen 0x%x alen 0x%x" - ec CM_TRACE_FETCHPROC, "FetchProc vp 0x%lx pos 0x%x size 0x%x" - ec CM_TRACE_SIMPLEVSTAT, "SimpleVStat vp 0x%lx old len 0x%x new len 0x%x" - ec CM_TRACE_PROCESSFS, "ProcessFS vp 0x%lx old len 0x%x new len 0x%x" - ec CM_TRACE_STOREALL, "StoreAll vp 0x%lx len 0x%x" + ec CM_TRACE_STOREPROC, "StoreProc vp 0x%lx fid (%x:%d.%d.%d) m.Length (0x%x, 0x%x) alen 0x%x" + ec CM_TRACE_FETCHPROC, "FetchProc vp 0x%lx fid (%x:%d.%d.%d) pos (0x%x, 0x%x) size 0x%x" + ec CM_TRACE_SIMPLEVSTAT, "SimpleVStat vp 0x%lx old len (0x%x, 0x%x) new len (0x%x, 0x%x)" + ec CM_TRACE_PROCESSFS, "ProcessFS vp 0x%lx old len (0x%x, 0x%x) new len (0x%x, 0x%x)" + ec CM_TRACE_STOREALL, "StoreAll vp 0x%lx len (0x%x, 0x%x)" ec CM_TRACE_INVALL, "InvalAll vp 0x%lx len 0x%x" ec CM_TRACE_TRUNCALL1, "TruncAll vp 0x%lx old len 0x%x new len 0x%x" ec CM_TRACE_TRUNCALL2,"TruncAll vp 0x%lx vlen 0x%x len 0x%x" @@ -45,7 +45,7 @@ error_table 2 ZCM ec CM_TRACE_GSETATTR, "Gn_setattr vp 0x%lx (returns 0x%x)" ec CM_TRACE_GFCLEAR, "Gn_fclear vp 0x%lx offset 0x%x len 0x%x (returns 0x%x)" ec CM_TRACE_GFSYNC, "Gn_fsync vp 0x%lx flags 0x%x (returns 0x%x)" - ec CM_TRACE_GFTRUNC, "Gn_ftrunc vp 0x%lx flags 0x%x len 0x%x (returns 0x%x)" + ec CM_TRACE_GFTRUNC, "Gn_ftrunc vp 0x%lx flags 0x%x len (0x%x, 0x%x) (returns 0x%x)" ec CM_TRACE_GRDWR, "Gn_rdwr vp 0x%lx flags 0x%x op 0x%x (returns 0x%x)" ec CM_TRACE_GLOCKCTL, "Gn_locktl vp 0x%lx cmd 0x%x (returns 0x%x)" ec CM_TRACE_GIOCTL, "Gn_ioctl vp 0x%lx cmd 0x%x (returns 0x%x)" @@ -56,6 +56,7 @@ error_table 2 ZCM ec CM_TRACE_STUFFVCACHE, "StuffVcache 0x%lx callback host 0x%lx expires %u (in %u secs)" ec CM_TRACE_GETDCACHE1, "Getdcache vp 0x%lx failed to find chunk 0x%x" ec CM_TRACE_GETDCACHE2, "GetdCache vp 0x%lx dcache 0x%lx dcache low-version 0x%x, vcache low-version 0x%x" + ec CM_TRACE_GETDCACHE3, "GetdCache tlen 0x%x size 0x%x abyte (0x%x, 0x%x) Position (0x%x, 0x%x)" ec CM_TRACE_STOREMINI, "storemini vp 0x%lx length 0x%x" ec CM_TRACE_STOREDCACHE, "StoreDCache vp 0x%lx chunk 0x%x length 0x%x at position 0x%x" ec CM_TRACE_STOREDCACHEDONE, "StoreDCache Done for vp 0x%lx (returns 0x%x)" @@ -81,12 +82,12 @@ error_table 2 ZCM ec CM_TRACE_SETPAG, "Setpag returns 0x%x" ec CM_TRACE_OPEN, "Open 0x%x flags 0x%x" ec CM_TRACE_CLOSE, "Close 0x%lx flags 0x%x" - ec CM_TRACE_WRITE, "Write vp 0x%lx off 0x%x resid 0x%x file length 0x%x" - ec CM_TRACE_READ, "Read vp 0x%lx off 0x%x resid 0x%x file length 0x%x" - ec CM_TRACE_PARTIALWRITE, "Partial write vp 0x%lx length 0x%x" - ec CM_TRACE_GETATTR, "Getattr vp 0x%lx len 0x%x" - ec CM_TRACE_SETATTR, "Setattr vp 0x%lx len 0x%x" - ec CM_TRACE_ACCESS, "Access vp 0x%lx mode 0x%x len 0x%x" + ec CM_TRACE_WRITE, "Write vp 0x%lx off (0x%x, 0x%x) resid (0x%x, 0x%x) file length (0x%x, 0x%x)" + ec CM_TRACE_READ, "Read vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)" + ec CM_TRACE_PARTIALWRITE, "Partial write vp 0x%lx length (0x%x, 0x%x)" + ec CM_TRACE_GETATTR, "Getattr vp 0x%lx len (0x%x, 0x%x)" + ec CM_TRACE_SETATTR, "Setattr vp 0x%lx len (0x%x, 0x%x)" + ec CM_TRACE_ACCESS, "Access vp 0x%lx mode 0x%x len (0x%x, 0x%x)" ec CM_TRACE_LOOKUP, "Lookup adp 0x%lx name %s fid (%d:%d.%d.%d), code=%d" ec CM_TRACE_LOOKUP1, "Mount point is to vp 0x%lx fid (%d:%d.%d.%d)" ec CM_TRACE_CREATE, "create file in vp 0x%lx name %s mode 0x%x" @@ -122,12 +123,35 @@ error_table 2 ZCM ec CM_TRACE_NFS3IN1, "Nfs3 Root fid client 0x%lx fid (%x:%d.%d.%d)" ec CM_TRACE_VGET, "Vget vp 0x%lx uid %x fid (%x:%d.%d.%d)" ec CM_TRACE_VFSROOT, "vfs root vp 0x%lx, code %d" - ec CM_TRACE_READOP, "Iread ip 0x%lx pos 0x%x count 0x%x code %x" - ec CM_TRACE_WRITEOP, "Iwrite ip 0x%lx pos 0x%x count 0x%x code %x" + ec CM_TRACE_READOP, "Iread ip x%lx pos (0x%x, 0x%x) count 0x%x code %x" + ec CM_TRACE_WRITEOP, "Iwrite ip 0x%lx pos (0x%x, 0x%x) count 0x%x code %x" ec CM_TRACE_READPAGE, "Ireadpage ip 0x%lx pp 0x%x count 0x%x code %x" ec CM_TRACE_UPDATEPAGE, "Iupdatepage ip 0x%lx pp 0x%x count 0x%x code %d" ec CM_TRACE_VM_CLOSE, "VMclose ip 0x%lx mapcnt %d opens %d XoW %d" - ec CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)" - ec CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)" + ec CM_TRACE_FETCH64, "FetchProc for vp = 0x%lx oldserver was %d, found length (0x%x, 0x%x)" + ec CM_TRACE_UFSLINK, "UFSHandleLink: vp = 0x%lx, tdc 0 0x%lx, len (0x%x, 0x%x)" + ec CM_TRACE_VMRDWR, "afs_vm_rdwr: vp = 0x%lx, xfrSize 0x%lx, toffset 0x%x" + ec CM_TRACE_READFAST, "ReadFast vp 0x%lx off (0x%x, 0x%x) resid 0x%x file length (0x%x, 0x%x)" + ec CM_TRACE_FETCH64CODE, "StartRX_FetchData64 for vp 0x%x returned %d" + ec CM_TRACE_FETCH64LENG, "FetchData64 for vp 0x%x code = %d, length = (0x%x, 0x%x)" + ec CM_TRACE_FETCH64READ, "FetchData64 for vp 0x%x code = %d, length = 0x%x" + ec CM_TRACE_VMWRITE, "afs_vm_rdwr: vp 0x%x offset (0x%x, 0x%x) length 0x%x" + ec CM_TRACE_VMWRITE2, "afs_vm_rdwr: vp 0x%x first page 0x%x pages %d" + ec CM_TRACE_VMSTOREALL, "osi_VM_StoreAllSegments for vp 0x%x call %d" + ec CM_TRACE_PARTIALWRITE0, "Partial write currDirty %d maxDirty %d" + ec CM_TRACE_DIRECTRDWR, "direct_rdwr: vp 0x%x offset (0x%x, 0x%x) resid 0x%x" + ec CM_TRACE_GOPRDWR, "gop_rdwr: offset (0x%x, 0x%x) len 0x%x resid 0x%x code %d" + ec CM_TRACE_GRDWR1, "Gn_rdwr error vp 0x%lx returns %d" + ec CM_TRACE_READTDC, "UFSRead: vp 0x%lx tdc 0x%x at %d refcount 0x%x" + ec CM_TRACE_MEMFETCH, "MemFetch: vp 0x%x mceP 0x%x offset (0x%x, 0x%x) length 0x%x" + ec CM_TRACE_VMWRITE3, "afs_vm_rdwr: vp 0x%x code %d" + ec CM_TRACE_STOREALL2, "StoreAll 2 vp 0x%x chunk 0x%x index %d inode %d" + ec CM_TRACE_MEMOPEN, "MemOpen blkno %d mceP 0x%x data 0x%x = %s" + ec CM_TRACE_VCACHE2INODE, "vcache2inode: avc 0x%x event %d" + ec CM_TRACE_STOREDATA64, "StoreData64: fid (%d:%d.%d.%d) offs (0x%x, 0x%x) len (0x%x, 0x%x) file length (0x%x, 0x%x)" + ec CM_TRACE_RESIDCMD, "ResidencyCmd tvc 0x%x command %d fid (%d:%d.%d.%d)" + ec CM_TRACE_PREFETCHCMD, "PrefetchCmd tvc 0x%x tfid (%d:%d.%d.%d) fid (%d:%d.%d.%d)" + ec CM_TRACE_STOREPROC2, "StoreProc got 0x%x" + ec CM_TRACE_ADJUSTSIZE, "AdjustSize index %d oldSize %d newSize %d blocksUsed %d" end diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 205feff..76863b0 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -1251,6 +1251,7 @@ afs_SimpleVStat(avc, astat, areq) struct vrequest *areq; { /*afs_SimpleVStat*/ + afs_size_t length; AFS_STATCNT(afs_SimpleVStat); #ifdef AFS_SGI_ENV @@ -1261,16 +1262,21 @@ afs_SimpleVStat(avc, astat, areq) #endif { +#ifdef AFS_64BIT_ClIENT + FillInt64(length, astat->Length_hi, astat->Length); +#else /* AFS_64BIT_CLIENT */ + length = astat->Length; +#endif /* AFS_64BIT_CLIENT */ #if defined(AFS_SGI_ENV) osi_Assert((valusema(&avc->vc_rwlock) <= 0) && (OSI_GET_LOCKID() == avc->vc_rwlockid)); - if (astat->Length < avc->m.Length) { + if (length < avc->m.Length) { vnode_t *vp = (vnode_t *)avc; osi_Assert(WriteLocked(&avc->lock)); ReleaseWriteLock(&avc->lock); AFS_GUNLOCK(); - PTOSSVP(vp, (off_t)astat->Length, (off_t)MAXLONG); + PTOSSVP(vp, (off_t)length, (off_t)MAXLONG); AFS_GLOCK(); ObtainWriteLock(&avc->lock,67); } @@ -1278,9 +1284,9 @@ afs_SimpleVStat(avc, astat, areq) /* if writing the file, don't fetch over this value */ afs_Trace3(afs_iclSetp, CM_TRACE_SIMPLEVSTAT, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, - ICL_TYPE_INT32, astat->Length); - avc->m.Length = astat->Length; + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length)); + avc->m.Length = length; avc->m.Date = astat->ClientModTime; } avc->m.Owner = astat->Owner; @@ -1359,7 +1365,7 @@ afs_WriteVCache(avc, astatus, areq) AFS_STATCNT(afs_WriteVCache); afs_Trace2(afs_iclSetp, CM_TRACE_WVCACHE, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length)); do { tc = afs_Conn(&avc->fid, areq, SHARED_LOCK); @@ -1434,8 +1440,14 @@ afs_ProcessFS(avc, astat, areq) { /*afs_ProcessFS*/ register int i; + afs_size_t length; AFS_STATCNT(afs_ProcessFS); +#ifdef AFS_64BIT_CLIENT + FillInt64(length, astat->Length_hi, astat->Length); +#else /* AFS_64BIT_CLIENT */ + length = astat->Length; +#endif /* AFS_64BIT_CLIENT */ /* WARNING: afs_DoBulkStat uses the Length field to store a sequence * number for each bulk status request. Under no circumstances * should afs_DoBulkStat store a sequence number if the new @@ -1453,9 +1465,9 @@ afs_ProcessFS(avc, astat, areq) * values. */ afs_Trace3(afs_iclSetp, CM_TRACE_PROCESSFS, ICL_TYPE_POINTER, avc, - ICL_TYPE_INT32, avc->m.Length, - ICL_TYPE_INT32, astat->Length); - avc->m.Length = astat->Length; + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(length)); + avc->m.Length = length; avc->m.Date = astat->ClientModTime; } hset64(avc->m.DataVersion, astat->dataVersionHigh, astat->DataVersion); diff --git a/src/config/icl.h b/src/config/icl.h index 743bcf3..f75bd95 100644 --- a/src/config/icl.h +++ b/src/config/icl.h @@ -154,7 +154,7 @@ extern int afs_icl_sizeofLong; MACRO_BEGIN \ if ((t1) == ICL_TYPE_STRING) { \ tsize = (int)((unsigned)(strlen((char *)(p1)) + 4) >> 2); \ - } else if ((t1) == ICL_TYPE_HYPER) \ + } else if ((t1) == ICL_TYPE_HYPER || (t1) == ICL_TYPE_INT64) \ tsize = 2; \ else if ((t1) == ICL_TYPE_FID) \ tsize = 4; \ @@ -199,6 +199,15 @@ extern int afs_icl_sizeofLong; #define ICL_TYPE_STRING 4 #define ICL_TYPE_FID 5 #define ICL_TYPE_UNIXDATE 6 +#define ICL_TYPE_INT64 8 + +#ifdef AFS_64BIT_CLIENT +#define ICL_TYPE_OFFSET ICL_TYPE_INT64 +#define ICL_HANDLE_OFFSET(x) (&x) +#else /* AFS_64BIT_CLIENT */ +#define ICL_TYPE_OFFSET ICL_TYPE_INT64 +#define ICL_HANDLE_OFFSET(x) (x) +#endif /* AFS_64BIT_CLIENT */ /* max # of words put in the printf buffer per parameter */ #define ICL_MAXEXPANSION 4 diff --git a/src/config/param.i386_linux24.h b/src/config/param.i386_linux24.h index 2fcf247..e4ddc6a 100644 --- a/src/config/param.i386_linux24.h +++ b/src/config/param.i386_linux24.h @@ -20,6 +20,8 @@ #define AFS_SYSCALL 137 #define AFS_64BIT_IOPS_ENV 1 #define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 #if defined(__KERNEL__) && !defined(KDUMP_KERNEL) #include diff --git a/src/config/param.rs_aix42.h b/src/config/param.rs_aix42.h index f25ec5d..3ed8e27 100644 --- a/src/config/param.rs_aix42.h +++ b/src/config/param.rs_aix42.h @@ -15,6 +15,9 @@ #define AFS_AIX41_ENV 1 #define AFS_AIX42_ENV 1 +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 + #include /* Global lock in AFS part of client. */ diff --git a/src/config/param.rs_aix42_usr.h b/src/config/param.rs_aix42_usr.h index 67397cb..f375544 100644 --- a/src/config/param.rs_aix42_usr.h +++ b/src/config/param.rs_aix42_usr.h @@ -10,6 +10,9 @@ #ifndef AFS_PARAM_H #define AFS_PARAM_H +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_CLIENT 1 + #define AFS_VFS_ENV 1 /* Used only in vfsck code; is it needed any more???? */ #define RXK_LISTENER_ENV 1 diff --git a/src/dir/dir.c b/src/dir/dir.c index d9b1b6d..91271a3 100644 --- a/src/dir/dir.c +++ b/src/dir/dir.c @@ -80,6 +80,7 @@ RCSID("$Header$"); #include "../h/mbuf.h" #endif #else /* !defined(UKERNEL) */ +#include "../afs/stds.h" #include "../afs/sysincludes.h" #endif /* !defined(UKERNEL) */ #include "../afs/afs_osi.h" diff --git a/src/fsint/afscbint.xg b/src/fsint/afscbint.xg index a8ce0c1..83ee3f0 100644 --- a/src/fsint/afscbint.xg +++ b/src/fsint/afscbint.xg @@ -94,5 +94,25 @@ proc GetCacheConfig( OUT afs_uint32 *serverVersion, OUT afs_uint32 *configCount, OUT cacheConfig *config -) = 218; +) = 218; + +#ifdef RESIDENCY +/* Used in MR-AFS for third party move of data between remioserver and "fs" */ +proc FetchData(IN struct AFSFid *Fid, + afs_int32 Filesdescriptor, + afs_int64 Position, + afs_int64 Length, + OUT afs_int64 *TotalLength) split = 65536; + +proc StoreData(IN struct AFSFid *Fid, + afs_int32 Filesdescriptor, + afs_int64 Position, + afs_int64 Length, + OUT afs_int64 *TotalLength) split = 65537; +#endif /* RESIDENCY */ + +proc GetCE64( + IN afs_int32 index, + OUT AFSDBCacheEntry64 *ce +) = 65538; diff --git a/src/fsint/afsint.xg b/src/fsint/afsint.xg index aa210a8..329991d 100644 --- a/src/fsint/afsint.xg +++ b/src/fsint/afsint.xg @@ -44,8 +44,8 @@ typedef afs_int32 ViceDataType; %#define Directory 2 %#define SymbolicLink 3 -%#ifdef KERNEL -%#define xdr_array(a,b,c,d,e,f) xdr_arrayN(a,b,c,d,e,f) +%#ifdef KERNEL +%#define xdr_array(a,b,c,d,e,f) xdr_arrayN(a,b,c,d,e,f) %#endif struct BD { @@ -95,14 +95,14 @@ struct AFSFetchStatus { afs_uint32 UnixModeBits; afs_uint32 ParentVnode; afs_uint32 ParentUnique; - afs_uint32 SegSize; + afs_uint32 ResidencyMask; afs_uint32 ClientModTime; afs_uint32 ServerModTime; afs_uint32 Group; afs_uint32 SyncCounter; afs_uint32 dataVersionHigh; /* For AFS/DFS translator, hi bits of dvn */ afs_uint32 lockCount; - afs_uint32 spare3; + afs_uint32 Length_hi; afs_uint32 errorCode; }; @@ -294,13 +294,104 @@ typedef afs_int32 ViceOfflineType; %#include "../afs/longc_procs.h" %#endif -const FLUSHMAX = 10; -typedef afs_int32 ViceIds; -typedef afs_int32 IPAddrs; +%#define MAXCMDINT64S 3 +%#define MAXCMDINT32S 200 +%#define MAXCMDCHARS 256 +%#define CMD_GETRESIDENCIES 1 +%#define CMD_CHANGERESIDENCIES 2 +%#define CMD_IMPORTRESIDENCIES 3 +%#define CMD_GETEXTVOLATTR 4 +%#define CMD_SETEXTVOLATTR 5 +%#define CMD_GETACCESSHISTORY 6 +%#define CMD_MIGRATEFILE 7 +%#define CMD_CHECKHSMMETADATA 8 +%#define CMD_FETCHSTATUS 9 + +%#define VOLATTR_DESIREDRESIDENCYMASK 1 +%#define VOLATTR_UNDESIREDRESIDENCYMASK 2 +%#define VOLATTR_SETSPECIALACCESSFLAG 4 +struct ExtendedVolAttrInputs { + afs_uint32 Mask; + afs_uint32 Volume; + afs_uint32 DesiredResidencyMask; + afs_uint32 Spare1[10]; + afs_uint32 UnDesiredResidencyMask; + afs_uint32 Spare2[9]; + afs_uint32 SpecialAccessFlag; +}; -%#define MAXCMDINT64S 3 -%#define MAXCMDINT32S 200 -%#define MAXCMDCHARS 256 +struct ExtendedVolAttrOutputs { + afs_uint32 DesiredResidencyMask; + afs_uint32 Spare1[10]; + afs_uint32 UnDesiredResidencyMask; + afs_uint32 Spare2[9]; + afs_uint32 SpecialAccessFlag; +}; + +struct TagsArray { + afs_uint32 TagsArray_len; + afs_uint32 TagsArray_val[184]; +}; + +struct AccessHistory { + afs_uint64 Size; + afs_uint32 ModTime; + afs_uint32 NonSpoolingFetches; + afs_uint32 UserSpoolingFetches; + afs_uint32 MigratorSpoolingFetches; + afs_uint32 LastUserMigrationEvent; + afs_uint32 MigrateMe; + afs_uint32 Time0; + afs_uint32 Type0; + afs_uint32 LocalAccess0; + afs_uint32 Residency0; + afs_uint32 Time1; + afs_uint32 Type1; + afs_uint32 LocalAccess1; + afs_uint32 Residency1; + afs_uint32 Time2; + afs_uint32 Type2; + afs_uint32 LocalAccess2; + afs_uint32 Residency2; + afs_uint32 Time3; + afs_uint32 Type3; + afs_uint32 LocalAccess3; + afs_uint32 Residency3; + afs_uint32 Time4; + afs_uint32 Type4; + afs_uint32 LocalAccess4; + afs_uint32 Residency4; +}; + +struct AccessHistoryOld { + afs_uint32 Size; + afs_uint32 ModTime; + afs_uint32 NonSpoolingFetches; + afs_uint32 UserSpoolingFetches; + afs_uint32 MigratorSpoolingFetches; + afs_uint32 LastUserMigrationEvent; + afs_uint32 MigrateMe; + afs_uint32 Time0; + afs_uint32 Type0; + afs_uint32 LocalAccess0; + afs_uint32 Residency0; + afs_uint32 Time1; + afs_uint32 Type1; + afs_uint32 LocalAccess1; + afs_uint32 Residency1; + afs_uint32 Time2; + afs_uint32 Type2; + afs_uint32 LocalAccess2; + afs_uint32 Residency2; + afs_uint32 Time3; + afs_uint32 Type3; + afs_uint32 LocalAccess3; + afs_uint32 Residency3; + afs_uint32 Time4; + afs_uint32 Type4; + afs_uint32 LocalAccess4; + afs_uint32 Residency4; +}; struct ResidencyCmdInputs { afs_int32 command; @@ -316,137 +407,141 @@ struct ResidencyCmdOutputs { afs_int64 int64s[MAXCMDINT64S]; afs_uint32 int32s[MAXCMDINT32S]; char chars[MAXCMDCHARS]; -}; +}; + +const FLUSHMAX = 10; +typedef afs_int32 ViceIds; +typedef afs_int32 IPAddrs; package RXAFS_ prefix S statindex 7 FetchData( - IN AFSFid *Fid, - afs_int32 Pos, - afs_int32 Length, - OUT AFSFetchStatus *OutStatus, - AFSCallBack *CallBack, + IN AFSFid *Fid, + afs_int32 Pos, + afs_int32 Length, + OUT AFSFetchStatus *OutStatus, + AFSCallBack *CallBack, AFSVolSync *Sync ) split = 130; FetchACL( - IN AFSFid *Fid, - OUT AFSOpaque *AccessList, - AFSFetchStatus *OutStatus, + IN AFSFid *Fid, + OUT AFSOpaque *AccessList, + AFSFetchStatus *OutStatus, AFSVolSync *Sync ) = 131; FetchStatus( - IN AFSFid *Fid, - OUT AFSFetchStatus *OutStatus, - AFSCallBack *CallBack, + IN AFSFid *Fid, + OUT AFSFetchStatus *OutStatus, + AFSCallBack *CallBack, AFSVolSync *Sync ) = 132; StoreData( - IN AFSFid *Fid, - AFSStoreStatus *InStatus, - afs_int32 Pos, - afs_int32 Length, - afs_int32 FileLength, - OUT AFSFetchStatus *OutStatus, + IN AFSFid *Fid, + AFSStoreStatus *InStatus, + afs_int32 Pos, + afs_int32 Length, + afs_int32 FileLength, + OUT AFSFetchStatus *OutStatus, AFSVolSync *Sync ) split = 133; StoreACL( - IN AFSFid *Fid, - AFSOpaque *AccessList, - OUT AFSFetchStatus *OutStatus, + IN AFSFid *Fid, + AFSOpaque *AccessList, + OUT AFSFetchStatus *OutStatus, AFSVolSync *Sync ) = 134; StoreStatus( - IN AFSFid *Fid, - AFSStoreStatus *InStatus, - OUT AFSFetchStatus *OutStatus, + IN AFSFid *Fid, + AFSStoreStatus *InStatus, + OUT AFSFetchStatus *OutStatus, AFSVolSync *Sync ) = 135; RemoveFile( - IN AFSFid *DirFid, - string Name, - OUT AFSFetchStatus *OutStatus, + IN AFSFid *DirFid, + string Name, + OUT AFSFetchStatus *OutStatus, AFSVolSync *Sync ) = 136; CreateFile( - IN AFSFid *DirFid, - string Name, - AFSStoreStatus *InStatus, - OUT AFSFid *OutFid, - AFSFetchStatus *OutFidStatus, - AFSFetchStatus *OutDirStatus, - AFSCallBack *CallBack, + IN AFSFid *DirFid, + string Name, + AFSStoreStatus *InStatus, + OUT AFSFid *OutFid, + AFSFetchStatus *OutFidStatus, + AFSFetchStatus *OutDirStatus, + AFSCallBack *CallBack, AFSVolSync *Sync) = 137; Rename( - IN AFSFid *OldDirFid, - string OldName, - AFSFid *NewDirFid, - string NewName, - OUT AFSFetchStatus *OutOldDirStatus, - AFSFetchStatus *OutNewDirStatus, + IN AFSFid *OldDirFid, + string OldName, + AFSFid *NewDirFid, + string NewName, + OUT AFSFetchStatus *OutOldDirStatus, + AFSFetchStatus *OutNewDirStatus, AFSVolSync *Sync ) = 138; Symlink( - IN AFSFid *DirFid, - string Name, - string LinkContents, - AFSStoreStatus *InStatus, - OUT AFSFid *OutFid, - AFSFetchStatus *OutFidStatus, - AFSFetchStatus *OutDirStatus, + IN AFSFid *DirFid, + string Name, + string LinkContents, + AFSStoreStatus *InStatus, + OUT AFSFid *OutFid, + AFSFetchStatus *OutFidStatus, + AFSFetchStatus *OutDirStatus, AFSVolSync *Sync ) = 139; Link( - IN AFSFid *DirFid, - string Name, - AFSFid *ExistingFid, - OUT AFSFetchStatus *OutFidStatus, - AFSFetchStatus *OutDirStatus, + IN AFSFid *DirFid, + string Name, + AFSFid *ExistingFid, + OUT AFSFetchStatus *OutFidStatus, + AFSFetchStatus *OutDirStatus, AFSVolSync *Sync ) = 140; MakeDir( - IN AFSFid *DirFid, - string Name, - AFSStoreStatus *InStatus, - OUT AFSFid *OutFid, - AFSFetchStatus *OutFidStatus, - AFSFetchStatus *OutDirStatus, - AFSCallBack *CallBack, + IN AFSFid *DirFid, + string Name, + AFSStoreStatus *InStatus, + OUT AFSFid *OutFid, + AFSFetchStatus *OutFidStatus, + AFSFetchStatus *OutDirStatus, + AFSCallBack *CallBack, AFSVolSync *Sync ) = 141; RemoveDir( - IN AFSFid *DirFid, - string Name, - OUT AFSFetchStatus *OutDirStatus, + IN AFSFid *DirFid, + string Name, + OUT AFSFetchStatus *OutDirStatus, AFSVolSync *Sync ) = 142; OldSetLock( - IN AFSFid *Fid, - ViceLockType Type, + IN AFSFid *Fid, + ViceLockType Type, AFSVolSync *Sync ) = 143; OldExtendLock( - IN AFSFid *Fid, + IN AFSFid *Fid, AFSVolSync *Sync ) = 144; OldReleaseLock( - IN AFSFid *Fid, + IN AFSFid *Fid, AFSVolSync *Sync ) = 145; @@ -460,20 +555,20 @@ GiveUpCallBacks( ) = 147; GetVolumeInfo( - IN string VolumeName, + IN string VolumeName, OUT VolumeInfo *Volumeinfo ) = 148; GetVolumeStatus( - IN afs_int32 Volumeid, - OUT AFSFetchVolumeStatus *Volumestatus, + IN afs_int32 Volumeid, + OUT AFSFetchVolumeStatus *Volumestatus, string Name, - string OfflineMsg, + string OfflineMsg, string Motd ) = 149; SetVolumeStatus( - IN afs_int32 Volumeid, + IN afs_int32 Volumeid, AFSStoreVolumeStatus *Volumestatus, string Name, string OfflineMsg, @@ -485,12 +580,12 @@ GetRootVolume( ) = 151; CheckToken( - IN afs_int32 ViceId, + IN afs_int32 ViceId, AFSOpaque *token ) = 152; GetTime( - OUT afs_uint32 *Seconds, + OUT afs_uint32 *Seconds, afs_uint32 *USeconds ) = 153; @@ -507,18 +602,18 @@ BulkStatus( ) = 155; SetLock( - IN AFSFid *Fid, - ViceLockType Type, + IN AFSFid *Fid, + ViceLockType Type, OUT AFSVolSync *Sync ) = 156; ExtendLock( - IN AFSFid *Fid, + IN AFSFid *Fid, OUT AFSVolSync *Sync ) = 157; ReleaseLock( - IN AFSFid *Fid, + IN AFSFid *Fid, OUT AFSVolSync *Sync ) = 158; @@ -554,13 +649,13 @@ FlushCPS( ) = 162; DFSSymlink( - IN AFSFid *DirFid, - string Name, - string LinkContents, - AFSStoreStatus *InStatus, - OUT AFSFid *OutFid, - AFSFetchStatus *OutFidStatus, - AFSFetchStatus *OutDirStatus, + IN AFSFid *DirFid, + string Name, + string LinkContents, + AFSStoreStatus *InStatus, + OUT AFSFid *OutFid, + AFSFetchStatus *OutFidStatus, + AFSFetchStatus *OutDirStatus, AFSCallBack *CallBack, AFSVolSync *Sync ) = 163; @@ -569,7 +664,26 @@ ResidencyCmd( IN AFSFid *Fid, IN struct ResidencyCmdInputs *Inputs, OUT struct ResidencyCmdOutputs *Outputs -) = 220; +) = 220; + +FetchData64( + IN AFSFid *Fid, + afs_int64 Pos, + afs_int64 Length, + OUT AFSFetchStatus *OutStatus, + AFSCallBack *CallBack, + AFSVolSync *Sync +) split = 231; + +StoreData64( + IN AFSFid *Fid, + AFSStoreStatus *InStatus, + afs_int64 Pos, + afs_int64 Length, + afs_int64 FileLength, + OUT AFSFetchStatus *OutStatus, + AFSVolSync *Sync +) split = 233; InlineBulkStatus( IN AFSCBFids *FidsArray, diff --git a/src/fsint/common.xg b/src/fsint/common.xg index c658b6d..6e644c2 100644 --- a/src/fsint/common.xg +++ b/src/fsint/common.xg @@ -9,8 +9,8 @@ /* * common.xg: - * Common values and structures used in the AFS File Server - * and Cache Manager interfaces. + * Common values and structures used in the AFS File Server + * and Cache Manager interfaces. */ %#ifndef FSINT_COMMON_XG @@ -54,6 +54,22 @@ struct AFSDBCacheEntry { char states; }; +struct AFSDBCacheEntry64 { + afs_int32 addr; + afs_int32 cell; /*Cell part of the fid*/ + AFSFid netFid; /*Network part of the fid*/ + afs_int64 Length; + afs_int32 DataVersion; + struct AFSDBLockDesc lock; + afs_int32 callback; + afs_int32 cbExpires; + short refCount; + short opens; + short writers; + char mvstat; + char states; +}; + struct AFSDBLock { char name[16]; struct AFSDBLockDesc lock; diff --git a/src/fsprobe/fsprobe_callback.c b/src/fsprobe/fsprobe_callback.c index fd9ef0f..8303158 100644 --- a/src/fsprobe/fsprobe_callback.c +++ b/src/fsprobe/fsprobe_callback.c @@ -210,7 +210,7 @@ afs_int32 SRXAFSCB_Probe(rxcall) /*------------------------------------------------------------------------ - * SRXAFSCB_GetCE + * SRXAFSCB_GetCE64 * * Description: * Respond minimally to a request for returning the contents of @@ -230,6 +230,29 @@ afs_int32 SRXAFSCB_Probe(rxcall) * As advertised. *------------------------------------------------------------------------*/ +afs_int32 SRXAFSCB_GetCE64(rxcall) + struct rx_call *rxcall; + +{ /*SRXAFSCB_GetCE64*/ + +#if XSTAT_FS_CALLBACK_VERBOSE + static char rn[] = "SRXAFSCB_GetCE64"; /*Routine name*/ + char hostName[256]; /*Host name buffer*/ + char *hostNameResult; /*Ptr to static*/ + + if (rxcall != (struct rx_call *)0) { + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); + } /*Valid rxcall param*/ +#endif /* XSTAT_FS_CALLBACK_VERBOSE */ + + return(0); + +} /*SRXAFSCB_GetCE64*/ + afs_int32 SRXAFSCB_GetCE(rxcall) struct rx_call *rxcall; diff --git a/src/sys/afssyscalls.h b/src/sys/afssyscalls.h index 5a6b3b2..e259063 100644 --- a/src/sys/afssyscalls.h +++ b/src/sys/afssyscalls.h @@ -13,30 +13,24 @@ #ifndef AFS_NT40_ENV /* Declare Inode type. */ -#ifdef AFS_64BIT_IOPS_ENV -#ifdef AFS_SGI62_ENV -typedef uint64_t Inode; -#else +#include #ifdef AFS_NAMEI_ENV -#include -#ifdef AFS_NEC_SX92_ENV -typedef unsigned long Inode; -#else /* AFS_NEC_SX92_ENV */ -#ifdef AFS_64BIT_ENV -typedef afs_uint64 Inode; -#else -typedef u_int64_t Inode; -#endif -#endif /* AFS_NEC_SX92_ENV */ -#else -error Need 64 bit Inode defined. -#endif /* AFS_NAMEI_ENV */ -#endif /* AFS_SGI62_ENV */ -#else /* AFS_64BIT_IOPS_ENV */ -typedef unsigned int Inode; -#endif - -#ifndef AFS_NAMEI_ENV + #include + #if AFS_64BIT_ENV + typedef afs_uint64 Inode; + #else + typedef u_int64_t Inode; + #endif +#else /* AFS_NAMEI_ENV */ + #ifdef AFS_64BIT_IOPS_ENV + #ifdef AFS_SGI62_ENV + typedef uint64_t Inode; + #else + error Need 64 bit Inode defined. + #endif /* AFS_SGI62_ENV */ + #else /* AFS_64BIT_IOPS_ENV */ + typedef unsigned int Inode; + #endif #ifdef AFS_DEBUG_IOPS extern FILE *inode_debug_log; diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index 83855d2..0cd73f6 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -310,6 +310,7 @@ static DisplayRecord(outFilep, alp, rsize) printfParms[pfpix++] = alp[pix]; break; case ICL_TYPE_HYPER: + case ICL_TYPE_INT64: printfTypes[pftix++] = 0; printfParms[pfpix++] = alp[pix]; printfTypes[pftix++] = 0; @@ -472,6 +473,7 @@ static DisplayRecord(outFilep, alp, rsize) #endif /* AFS_SGI61_ENV */ break; case ICL_TYPE_HYPER: + case ICL_TYPE_INT64: fprintf(outFilep, "p%d:%x.%x ", i, alp[pix], alp[pix+1]); break; case ICL_TYPE_FID: diff --git a/src/venus/kdump.c b/src/venus/kdump.c index 3518150..70a2b81 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -35,6 +35,7 @@ RCSID("$Header$"); #define _LINUX_CODA_FS_I #define _LINUX_NTFS_FS_SB_H #define _LINUX_NTFS_FS_I_H +#define _NCP_FS_SB struct sysv_sb_info {}; struct affs_sb_info {}; struct ufs_sb_info {}; @@ -46,6 +47,7 @@ struct affs_inode_info {}; struct nfs_lock_info {}; struct ntfs_sb_info{}; struct ntfs_inode_info{}; +struct ncp_sb_info{}; #include #define u32 unsigned int #define s32 int @@ -196,11 +198,11 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t; #include /* inet_ntoa() */ #if defined(AFS_SGI_ENV) || defined(AFS_OSF_ENV) -#ifdef AFS_SGI_ENV +#ifdef AFS_SGI_ENV #include #endif /* AFS_SGI_ENV */ #else -#ifdef AFS_MACH_ENV +#ifdef AFS_MACH_ENV #include #include #include @@ -249,12 +251,10 @@ struct timezone { int a,b; }; #ifndef AFS_ALPHA_LINUX20_ENV -#ifndef AFS_LINUX24_ENV typedef struct timeval { int tv_sec; int tv_usec; } timeval_t; /* Needed here since KERNEL defined. */ -#endif #endif /*AFS_ALPHA_LINUX20_ENV*/ #if defined(AFSBIG_ENDIAN) #define _LINUX_BYTEORDER_BIG_ENDIAN_H @@ -266,17 +266,17 @@ typedef struct timeval { #include #else /* AFS_LINUX20_ENV */ #ifdef AFS_HPUX110_ENV -#define KERNEL -#define _KERNEL 1 +#define KERNEL +#define _KERNEL 1 /* Declare following so sys/vnode.h will compile with KERNEL defined */ #define FILE FILe typedef enum _spustate { /* FROM /etc/conf/h/_types.h */ - SPUSTATE_NONE = 0, /* must be 0 for proper initialization */ - SPUSTATE_IDLE, /* spu is idle */ - SPUSTATE_USER, /* spu is in user mode */ - SPUSTATE_SYSTEM, /* spu is in system mode */ - SPUSTATE_UNKNOWN, /* utility code for NEW_INTERVAL() */ - SPUSTATE_NOCHANGE /* utility code for NEW_INTERVAL() */ + SPUSTATE_NONE = 0, /* must be 0 for proper initialization */ + SPUSTATE_IDLE, /* spu is idle */ + SPUSTATE_USER, /* spu is in user mode */ + SPUSTATE_SYSTEM, /* spu is in system mode */ + SPUSTATE_UNKNOWN, /* utility code for NEW_INTERVAL() */ + SPUSTATE_NOCHANGE /* utility code for NEW_INTERVAL() */ } spustate_t; #define k_off_t off_t #include "sys/vnode.h" @@ -2471,14 +2471,14 @@ void print_vnode(kmem, vep, ptr, pnt) printf("\ti_ino=%d, i_mode=%x, i_nlink=%d, i_uid=%d, i_gid=%d, i_size=%d\n", vep->i_ino, vep->i_mode, vep->i_nlink, vep->i_uid, vep->i_gid, vep->i_size); -#ifndef AFS_LINUX24_ENV +#ifdef AFS_LINUX24_ENV printf("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n", vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version, - vep->i_nrpages); + vep->i_data.nrpages); #else - printf("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u\n", - vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version - ); + printf("\ti_atime=%u, i_mtime=%u, i_ctime=%u, i_version=%u, i_nrpages=%u\n", + vep->i_atime, vep->i_mtime, vep->i_ctime, vep->i_version, + vep->i_nrpages); #endif printf("\ti_op=0x%x, i_dev=0x%x, i_rdev=0x%x, i_sb=0x%x\n", vep->i_op, vep->i_dev, vep->i_rdev, vep->i_sb); @@ -2522,9 +2522,16 @@ void print_vcache(kmem, vep, ptr, pnt) ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique, vep->flushDV.high, vep->flushDV.low, vep->mapDV.high, vep->mapDV.low); +#ifdef AFS_64BIT_CLIENT + printf("truncPos=(0x%x, 0x%x),\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ", + (int) vep->truncPos >> 32, (int) vep->truncPos & 0xffffffff, + vep->callback, vep->cbExpires, vep->opens, + vep->execsOrWriters); +#else /* AFS_64BIT_CLIENT */ printf("truncPos=%d,\n\tcallb=x%lx, cbE=%d, opens=%d, XoW=%d, ", vep->truncPos, vep->callback, vep->cbExpires, vep->opens, vep->execsOrWriters); +#endif /* AFS_64BIT_CLIENT */ printf("flcnt=%d, mvstat=%d\n", vep->flockCount, vep->mvstat); printf("\tstates=x%x, ", vep->states); @@ -2532,6 +2539,17 @@ void print_vcache(kmem, vep, ptr, pnt) printf("vstates=x%x, ", vep->vstates); #endif /* AFS_SUN5_ENV */ printf("dchint=%x, anyA=0x%x\n", vep->h1.dchint, vep->anyAccess); +#ifdef AFS_64BIT_CLIENT + printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=(0x%x, 0x%x)]\n", + vep->quick.dc, vep->quick.stamp, vep->quick.f, + vep->quick.minLoc, + (int)vep->quick.len >> 32, (int)vep->quick.len & 0xffffffff); + printf("\tmstat[len=(0x%x, 0x%x), DV=%d.%d, Date=%d, Owner=%d, Group=%d, Mode=0%o, linkc=%d]\n", + (int) vep->m.Length >> 32, (int) vep->m.Length & 0xffffffff, + vep->m.DataVersion.high, + vep->m.DataVersion.low, vep->m.Date, vep->m.Owner, + vep->m.Group, vep->m.Mode, vep->m.LinkCount); +#else /* AFS_64BIT_CLIENT */ printf("\tquick[dc=%x, stamp=%x, f=%x, min=%d, len=%d]\n", vep->quick.dc, vep->quick.stamp, vep->quick.f, vep->quick.minLoc, vep->quick.len); @@ -2539,6 +2557,7 @@ void print_vcache(kmem, vep, ptr, pnt) vep->m.Length, vep->m.DataVersion.high, vep->m.DataVersion.low, vep->m.Date, vep->m.Owner, vep->m.Group, vep->m.Mode, vep->m.LinkCount); +#endif /* AFS_64BIT_CLIENT */ #else /* AFS33 */ printf("%x: refC=%d, pv=%d, pu=%d, flushDv=%d, mapDV=%d, truncPos=%d\n", ptr, vep->vrefCount, vep->parentVnode, vep->parentUnique, vep->flushDV, diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 20dcc67..262888b 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -444,6 +444,51 @@ SRXAFS_FetchData (tcon, Fid, Pos, Len, OutStatus, CallBack, Sync) struct AFSVolSync *Sync; /* synchronization info */ { + int code; + + code = common_FetchData (tcon, Fid, Pos, Len, OutStatus, + CallBack, Sync, 0); + return code; +} + +SRXAFS_FetchData64 (tcon, Fid, Pos, Len, OutStatus, CallBack, Sync) + struct rx_connection *tcon; /* Rx connection handle */ + struct AFSFid *Fid; /* Fid of file to fetch */ + afs_int64 Pos, Len; /* Not implemented yet */ + struct AFSFetchStatus *OutStatus; /* Returned status for Fid */ + struct AFSCallBack *CallBack; /* If r/w return CB for Fid */ + struct AFSVolSync *Sync; /* synchronization info */ +{ + int code; + afs_int32 tPos, tLen; + +#ifdef AFS_64BIT_ENV + if (Pos + Len > 0x7fffffff) + return E2BIG; + tPos = Pos; + tLen = Len; +#else /* AFS_64BIT_ENV */ + if (Pos.high || Len.high) + return E2BIG; + tPos = Pos.low; + tLen = Len.low; +#endif /* AFS_64BIT_ENV */ + + code = common_FetchData (tcon, Fid, tPos, tLen, OutStatus, + CallBack, Sync, 0); + return code; +} + +common_FetchData (tcon, Fid, Pos, Len, OutStatus, CallBack, Sync, type) + struct rx_connection *tcon; /* Rx connection handle */ + struct AFSFid *Fid; /* Fid of file to fetch */ + afs_int32 Pos, Len; /* Not implemented yet */ + struct AFSFetchStatus *OutStatus; /* Returned status for Fid */ + struct AFSCallBack *CallBack; /* If r/w return CB for Fid */ + struct AFSVolSync *Sync; /* synchronization info */ + int type; /* 32 bit or 64 bit call */ + +{ Vnode * targetptr = 0; /* pointer to vnode to fetch */ Vnode * parentwhentargetnotdir = 0; /* parent vnode if vptr is a file */ Vnode tparentwhentargetnotdir; /* parent vnode for GetStatus */ @@ -549,10 +594,10 @@ SRXAFS_FetchData (tcon, Fid, Pos, Len, OutStatus, CallBack, Sync) /* actually do the data transfer */ #if FS_STATS_DETAILED - errorCode = FetchData_RXStyle(volptr, targetptr, tcall, Pos, Len, + errorCode = FetchData_RXStyle(volptr, targetptr, tcall, Pos, Len, type &bytesToXfer, &bytesXferred); #else - if (errorCode = FetchData_RXStyle(volptr, targetptr, tcall, Pos, Len)) + if (errorCode = FetchData_RXStyle(volptr, targetptr, tcall, Pos, Len, type)) goto Bad_FetchData; #endif /* FS_STATS_DETAILED */ @@ -1437,6 +1482,38 @@ Bad_StoreData: } /*SRXAFS_StoreData*/ +SRXAFS_StoreData64 (tcon, Fid, InStatus, Pos, Length, FileLength, OutStatus, Sync) + struct AFSVolSync *Sync; + struct rx_connection *tcon; /* Rx connection Handle */ + struct AFSFid *Fid; /* Fid of taret file */ + struct AFSStoreStatus *InStatus; /* Input Status for Fid */ + afs_int64 Pos; /* Not implemented yet */ afs_int64 Length; /* Length of data to store */ + afs_int64 FileLength; /* Length of file after store */ + struct AFSFetchStatus *OutStatus; /* Returned status for target fid */ +{ + int code; + afs_int32 tPos; + afs_int32 tLength; + afs_int32 tFileLength; + +#ifdef AFS_64BIT_ENV + if (FileLength > 0x7fffffff) + return E2BIG; + tPos = Pos; + tLength = Length; + tFileLength = FileLength; +#else /* AFS_64BIT_ENV */ + if (FileLength.high) + return E2BIG; + tPos = Pos.low; + tLength = Length.low; + tFileLength = FileLength.low; +#endif /* AFS_64BIT_ENV */ + + code = SRXAFS_StoreData (tcon, Fid, InStatus, tPos, tLength, tFileLength, + OutStatus, Sync); + return code; +} SRXAFS_StoreACL (tcon, Fid, AccessList, OutStatus, Sync) struct AFSVolSync *Sync; @@ -4964,15 +5041,16 @@ PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr, volptr) # the File Server. */ -FetchData_RXStyle(volptr, targetptr, Call, Pos, Len, a_bytesToFetchP, a_bytesFetchedP) +FetchData_RXStyle(volptr, targetptr, Call, Pos, Len, Int64Mode, a_bytesToFetchP, a_bytesFetchedP) #else -FetchData_RXStyle(volptr, targetptr, Call, Pos, Len) +FetchData_RXStyle(volptr, targetptr, Call, Pos, Len, Int64Mode) #endif /* FS_STATS_DETAILED */ Volume * volptr; Vnode * targetptr; register struct rx_call * Call; afs_int32 Pos; afs_int32 Len; +afs_int32 Int64Mode; #if FS_STATS_DETAILED afs_int32 *a_bytesToFetchP; afs_int32 *a_bytesFetchedP; @@ -5010,6 +5088,8 @@ afs_int32 *a_bytesFetchedP; * back to make the cache manager happy... */ tlen = htonl(0); + if (Int64Mode) + rx_Write(Call, &tlen, sizeof(afs_int32)); /* send 0-length */ rx_Write(Call, &tlen, sizeof(afs_int32)); /* send 0-length */ return (0); } @@ -5027,6 +5107,10 @@ afs_int32 *a_bytesFetchedP; if (Pos + Len > tlen) Len = tlen - Pos; /* get length we should send */ FDH_SEEK(fdP, Pos, 0); tlen = htonl(Len); + if (Int64Mode) { + afs_int32 zero = 0; + rx_Write(Call, &zero, sizeof(afs_int32)); /* High order bits */ + } rx_Write(Call, &tlen, sizeof(afs_int32)); /* send length on fetch */ #if FS_STATS_DETAILED (*a_bytesToFetchP) = Len; @@ -6373,7 +6457,8 @@ void GetStatus(targetptr, status, rights, anyrights, parentptr) /* initialize return status from a vnode */ status->InterfaceVersion = 1; status->SyncCounter = status->dataVersionHigh = status->lockCount = - status->spare3 = status->errorCode = 0; + status->errorCode = 0; + status->ResidencyMask = 1; /* means for MR-AFS: file in /vicepr-partition */ if (targetptr->disk.type == vFile) status->FileType = File; else if (targetptr->disk.type == vDirectory) @@ -6393,7 +6478,6 @@ void GetStatus(targetptr, status, rights, anyrights, parentptr) status->ClientModTime = targetptr->disk.unixModifyTime; /* This might need rework */ status->ParentVnode = (status->FileType == Directory ? targetptr->vnodeNumber : parentptr->vnodeNumber); status->ParentUnique = (status->FileType == Directory ? targetptr->disk.uniquifier : parentptr->disk.uniquifier); - status->SegSize = 0; status->ServerModTime = targetptr->disk.serverModifyTime; status->Group = targetptr->disk.group; status->lockCount = targetptr->disk.lock.lockCount; diff --git a/src/xstat/xstat_fs_callback.c b/src/xstat/xstat_fs_callback.c index a66e30b..634691b 100644 --- a/src/xstat/xstat_fs_callback.c +++ b/src/xstat/xstat_fs_callback.c @@ -217,7 +217,7 @@ afs_int32 SRXAFSCB_Probe(rxcall) /*------------------------------------------------------------------------ - * SRXAFSCB_GetCE + * SRXAFSCB_GetCE64 * * Description: * Respond minimally to a request for returning the contents of @@ -237,13 +237,36 @@ afs_int32 SRXAFSCB_Probe(rxcall) * As advertised. *------------------------------------------------------------------------*/ +afs_int32 SRXAFSCB_GetCE64(rxcall) + struct rx_call *rxcall; + +{ /*SRXAFSCB_GetCE64*/ + +#if XSTAT_FS_CALLBACK_VERBOSE + static char rn[] = "SRXAFSCB_GetCE64"; /*Routine name*/ + char hostName[256]; /*Host name buffer*/ + char *hostNameResult; /*Ptr to static*/ + + if (rxcall != (struct rx_call *)0) { + hostNameResult = + hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host)); + strcpy(hostName, hostNameResult); + fprintf(stderr, "[%s:%s] Called from host %s, port %d\n", + mn, rn, hostName, rxcall->conn->peer->port); + } /*Valid rxcall param*/ +#endif /* XSTAT_FS_CALLBACK_VERBOSE */ + + return(0); + +} /*SRXAFSCB_GetCE64*/ + afs_int32 SRXAFSCB_GetCE(rxcall) struct rx_call *rxcall; { /*SRXAFSCB_GetCE*/ #if XSTAT_FS_CALLBACK_VERBOSE - static char rn[] = "SRXAFSCB_GetCE"; /*Routine name*/ + static char rn[] = "SRXAFSCB_GetCE"; /*Routine name*/ char hostName[256]; /*Host name buffer*/ char *hostNameResult; /*Ptr to static*/ -- 1.9.4