From c9d01b536d105ece7e1e149c3aed24b3d83a4d15 Mon Sep 17 00:00:00 2001 From: Hartmut Reuter Date: Sat, 10 Nov 2001 23:00:55 +0000 Subject: [PATCH] more-64bit-client-fixes-20011110 some afs_offs_t still missing so obsolete code fixed and new trace for m.Length change --- src/afs/SOLARIS/osi_vnodeops.c | 29 +++++++++++++++----------- src/afs/VNOPS/afs_vnop_write.c | 21 ++++++++++++++----- src/afs/afs_daemons.c | 37 +++++++++------------------------- src/afs/afs_segments.c | 10 +++------ src/afs/afs_trace.et | 5 ++--- 5 files changed, 48 insertions(+), 54 deletions(-) diff --git a/src/afs/SOLARIS/osi_vnodeops.c b/src/afs/SOLARIS/osi_vnodeops.c index 4cd7bd4e54..bae355bcc9 100644 --- a/src/afs/SOLARIS/osi_vnodeops.c +++ b/src/afs/SOLARIS/osi_vnodeops.c @@ -569,7 +569,8 @@ int afs_putpage(vp, off, len, flags, cred) #else afs_int32 tlen; #endif - afs_int32 endPos, NPages=0; + afs_offs_t endPos; + afs_int32 NPages=0; #if defined(AFS_SUN56_ENV) u_offset_t toff = off; #else @@ -594,8 +595,8 @@ int afs_putpage(vp, off, len, flags, cred) /* Get a list of modified (or whatever) pages */ if (len) { - endPos = (int)off + len; /* position we're supposed to write up to */ - while ((afs_int32)toff < endPos && (afs_int32)toff < avc->m.Length) { + endPos = (afs_offs_t)off + len; /* position we're supposed to write up to */ + while ((afs_offs_t)toff < endPos && (afs_offs_t)toff < avc->m.Length) { /* If not invalidating pages use page_lookup_nowait to avoid reclaiming * them from the free list */ @@ -654,18 +655,16 @@ int afs_putapage(struct vnode *vp, struct page *pages, struct buf *tbuf; struct vcache *avc = (struct vcache *)vp; afs_int32 code = 0; - afs_offs_t toff; - u_int tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE; - u_int poff = pages->p_offset; + u_int tlen = PAGESIZE; + afs_offs_t off = (pages->p_offset/PAGESIZE)*PAGESIZE; /* * Now we've got the modified pages. All pages are locked and held * XXX Find a kluster that fits in one block (or page). We also * adjust the i/o if the file space is less than a while page. XXX */ - toff = off; - if (toff + tlen > avc->m.Length) { - tlen = avc->m.Length - toff; + if (off + tlen > avc->m.Length) { + tlen = avc->m.Length - off; } /* can't call mapout with 0 length buffers (rmfree panics) */ if (((tlen>>24)&0xff) == 0xff) { @@ -685,7 +684,7 @@ int afs_putapage(struct vnode *vp, struct page *pages, afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUTONE, ICL_TYPE_LONG, avc, ICL_TYPE_LONG, pages, ICL_TYPE_LONG, tlen, - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(toff)); + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(off)); code = afs_ustrategy(tbuf, credp); /* unlocks page */ AFS_GUNLOCK(); bp_mapout(tbuf); @@ -693,7 +692,7 @@ int afs_putapage(struct vnode *vp, struct page *pages, pvn_write_done(pages, ((code) ? B_ERROR:0) | B_WRITE | flags); if ((int)tlen > 0) pageio_done(tbuf); - if (offp) *offp = toff; + if (offp) *offp = off; if (lenp) *lenp = tlen; return code; } @@ -959,8 +958,14 @@ struct AFS_UCRED *acred; size = auio->afsio_resid + auio->afsio_offset; /* new file size */ appendLength = size; origLength = avc->m.Length; - if (size > avc->m.Length) + if (size > avc->m.Length) { + afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_LONG, __LINE__, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(size)); avc->m.Length = size; /* file grew */ + } avc->states |= CDirty; /* Set the dirty bit */ avc->m.Date = osi_Time(); /* Set file date (for ranlib) */ } else { diff --git a/src/afs/VNOPS/afs_vnop_write.c b/src/afs/VNOPS/afs_vnop_write.c index 62d7e5d5e4..021e236b33 100644 --- a/src/afs/VNOPS/afs_vnop_write.c +++ b/src/afs/VNOPS/afs_vnop_write.c @@ -269,8 +269,8 @@ afs_MemWrite(avc, auio, aio, acred, noLock) afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ if (offset + len > tdc->f.chunkBytes) { - afs_int32 toffset = offset+len; - afs_AdjustSize(tdc, toffset); + afs_int32 tlength = offset+len; + afs_AdjustSize(tdc, tlength); } totalLength -= len; transferLength += len; @@ -279,8 +279,14 @@ afs_MemWrite(avc, auio, aio, acred, noLock) /* afs_xwrite handles setting m.Length */ osi_Assert(filePos <= avc->m.Length); #else - if (filePos > avc->m.Length) + if (filePos > avc->m.Length) { + afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_LONG, __LINE__, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos)); avc->m.Length = filePos; + } #endif #ifndef AFS_VM_RDWR_ENV /* @@ -567,8 +573,8 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) afsio_skip(auio, tlen); /* advance auio over data written */ /* compute new file size */ if (offset + len > tdc->f.chunkBytes) { - afs_int32 toffset = offset+len; - afs_AdjustSize(tdc, toffset); + afs_int32 tlength = offset+len; + afs_AdjustSize(tdc, tlength); } totalLength -= len; transferLength += len; @@ -578,6 +584,11 @@ afs_UFSWrite(avc, auio, aio, acred, noLock) osi_Assert(filePos <= avc->m.Length); #else if (filePos > avc->m.Length) { + afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_LONG, __LINE__, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(filePos)); avc->m.Length = filePos; } #endif diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index 00e91c0cd8..4618039dfe 100644 --- a/src/afs/afs_daemons.c +++ b/src/afs/afs_daemons.c @@ -739,7 +739,6 @@ afs_BioDaemon (nbiods) } /* Ignore HUP signals... */ -#ifdef AFS_AIX41_ENV { sigset_t sigbits, osigbits; /* @@ -749,11 +748,6 @@ afs_BioDaemon (nbiods) SIGDELSET(sigbits, SIGHUP); /* except SIGHUP */ limit_sigs(&sigbits, &osigbits); /* and already masked */ } -#else - SIGDELSET(u.u_procp->p_sig, SIGHUP); - SIGADDSET(u.u_procp->p_sigignore, SIGHUP); - SIGDELSET(u.u_procp->p_sigcatch, SIGHUP); -#endif /* Main body starts here -- this is an intentional infinite loop, and * should NEVER exit * @@ -784,15 +778,16 @@ afs_BioDaemon (nbiods) if (bp->b_flags & B_PFSTORE) { /* XXXX */ ObtainWriteLock(&vcp->lock,404); if (vcp->v.v_gnode->gn_mwrcnt) { -#ifdef AFS_64BIT_CLIENT - if (vcp->m.Length < - (afs_offs_t)dbtob(bp->b_blkno) + bp->b_bcount) - vcp->m.Length = - (afs_offs_t)dbtob(bp->b_blkno) + bp->b_bcount; -#else /* AFS_64BIT_CLIENT */ - if (vcp->m.Length < bp->b_bcount + (u_int)dbtob(bp->b_blkno)) - vcp->m.Length = bp->b_bcount + (u_int)dbtob(bp->b_blkno); -#endif /* AFS_64BIT_CLIENT */ + afs_offs_t newlength = + (afs_offs_t) dbtob(bp->b_blkno) + bp->b_bcount; + if (vcp->m.Length < newlength) { + afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, + ICL_TYPE_STRING, __FILE__, + ICL_TYPE_LONG, __LINE__, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(vcp->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(newlength)); + vcp->m.Length = newlength; + } } ReleaseWriteLock(&vcp->lock); } @@ -1101,21 +1096,9 @@ afs_BioDaemon (nbiods) /* Ignore HUP signals... */ -#ifdef AFS_AIX41_ENV - { - sigset_t sigbits, osigbits; - /* - * add SIGHUP to the set of already masked signals - */ - SIGFILLSET(sigbits); /* allow all signals */ - SIGDELSET(sigbits, SIGHUP); /* except SIGHUP */ - limit_sigs(&sigbits, &osigbits); /* and already masked */ - } -#else SIGDELSET(u.u_procp->p_sig, SIGHUP); SIGADDSET(u.u_procp->p_sigignore, SIGHUP); SIGDELSET(u.u_procp->p_sigcatch, SIGHUP); -#endif /* Main body starts here -- this is an intentional infinite loop, and * should NEVER exit * diff --git a/src/afs/afs_segments.c b/src/afs/afs_segments.c index 481050b1ab..1178942dec 100644 --- a/src/afs/afs_segments.c +++ b/src/afs/afs_segments.c @@ -832,6 +832,9 @@ afs_TruncateAllSegments(avc, alen, areq, acred) AFS_STATCNT(afs_TruncateAllSegments); avc->m.Date = osi_Time(); + afs_Trace3(afs_iclSetp, CM_TRACE_TRUNCALL, ICL_TYPE_POINTER, avc, + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), + ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(alen)); if (alen >= avc->m.Length) { /* * Special speedup since Sun's vm extends the file this way; @@ -844,16 +847,9 @@ 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_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_OFFSET, ICL_HANDLE_OFFSET(avc->m.Length), - ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(alen)); - #if (defined(AFS_SUN5_ENV)) /* Zero unused portion of last page */ diff --git a/src/afs/afs_trace.et b/src/afs/afs_trace.et index f800141b50..f892079388 100644 --- a/src/afs/afs_trace.et +++ b/src/afs/afs_trace.et @@ -25,9 +25,7 @@ error_table 2 ZCM 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" - + ec CM_TRACE_TRUNCALL, "TruncAll vp 0x%lx old len (0x%x, 0x%x) new len (0x%x, 0x%x)" ec CM_TRACE_GNLINK, "Gn_link vp 0x%lx name %s (returns 0x%x)" ec CM_TRACE_GMKDIR, "Gn_mkdir vp 0x%lx name %s mode 0x%x (returns 0x%x)" ec CM_TRACE_GMKNOD, "Gn_mknod vp 0x%lx name %s mode 0x%x (returns 0x%x)" @@ -153,5 +151,6 @@ error_table 2 ZCM 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" + ec CM_TRACE_SETLENGTH, "%s line %d: m.Length was (0x%x, 0x%x), now (0x%x, 0x%x)" end