more-64bit-client-fixes-20011110

some afs_offs_t still missing
so obsolete code fixed
and new trace for m.Length change
This commit is contained in:
Hartmut Reuter 2001-11-10 23:00:55 +00:00 committed by Derrick Brashear
parent 4c9808b25b
commit c9d01b536d
5 changed files with 48 additions and 54 deletions

View File

@ -569,7 +569,8 @@ int afs_putpage(vp, off, len, flags, cred)
#else #else
afs_int32 tlen; afs_int32 tlen;
#endif #endif
afs_int32 endPos, NPages=0; afs_offs_t endPos;
afs_int32 NPages=0;
#if defined(AFS_SUN56_ENV) #if defined(AFS_SUN56_ENV)
u_offset_t toff = off; u_offset_t toff = off;
#else #else
@ -594,8 +595,8 @@ int afs_putpage(vp, off, len, flags, cred)
/* Get a list of modified (or whatever) pages */ /* Get a list of modified (or whatever) pages */
if (len) { if (len) {
endPos = (int)off + len; /* position we're supposed to write up to */ endPos = (afs_offs_t)off + len; /* position we're supposed to write up to */
while ((afs_int32)toff < endPos && (afs_int32)toff < avc->m.Length) { while ((afs_offs_t)toff < endPos && (afs_offs_t)toff < avc->m.Length) {
/* If not invalidating pages use page_lookup_nowait to avoid reclaiming /* If not invalidating pages use page_lookup_nowait to avoid reclaiming
* them from the free list * them from the free list
*/ */
@ -654,18 +655,16 @@ int afs_putapage(struct vnode *vp, struct page *pages,
struct buf *tbuf; struct buf *tbuf;
struct vcache *avc = (struct vcache *)vp; struct vcache *avc = (struct vcache *)vp;
afs_int32 code = 0; afs_int32 code = 0;
afs_offs_t toff; u_int tlen = PAGESIZE;
u_int tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE; afs_offs_t off = (pages->p_offset/PAGESIZE)*PAGESIZE;
u_int poff = pages->p_offset;
/* /*
* Now we've got the modified pages. All pages are locked and held * 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 * 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 * adjust the i/o if the file space is less than a while page. XXX
*/ */
toff = off; if (off + tlen > avc->m.Length) {
if (toff + tlen > avc->m.Length) { tlen = avc->m.Length - off;
tlen = avc->m.Length - toff;
} }
/* can't call mapout with 0 length buffers (rmfree panics) */ /* can't call mapout with 0 length buffers (rmfree panics) */
if (((tlen>>24)&0xff) == 0xff) { 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, afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUTONE, ICL_TYPE_LONG, avc,
ICL_TYPE_LONG, pages, ICL_TYPE_LONG, pages,
ICL_TYPE_LONG, tlen, 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 */ code = afs_ustrategy(tbuf, credp); /* unlocks page */
AFS_GUNLOCK(); AFS_GUNLOCK();
bp_mapout(tbuf); 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); pvn_write_done(pages, ((code) ? B_ERROR:0) | B_WRITE | flags);
if ((int)tlen > 0) if ((int)tlen > 0)
pageio_done(tbuf); pageio_done(tbuf);
if (offp) *offp = toff; if (offp) *offp = off;
if (lenp) *lenp = tlen; if (lenp) *lenp = tlen;
return code; return code;
} }
@ -959,8 +958,14 @@ struct AFS_UCRED *acred;
size = auio->afsio_resid + auio->afsio_offset; /* new file size */ size = auio->afsio_resid + auio->afsio_offset; /* new file size */
appendLength = size; appendLength = size;
origLength = avc->m.Length; 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->m.Length = size; /* file grew */
}
avc->states |= CDirty; /* Set the dirty bit */ avc->states |= CDirty; /* Set the dirty bit */
avc->m.Date = osi_Time(); /* Set file date (for ranlib) */ avc->m.Date = osi_Time(); /* Set file date (for ranlib) */
} else { } else {

View File

@ -269,8 +269,8 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
afsio_skip(auio, tlen); /* advance auio over data written */ afsio_skip(auio, tlen); /* advance auio over data written */
/* compute new file size */ /* compute new file size */
if (offset + len > tdc->f.chunkBytes) { if (offset + len > tdc->f.chunkBytes) {
afs_int32 toffset = offset+len; afs_int32 tlength = offset+len;
afs_AdjustSize(tdc, toffset); afs_AdjustSize(tdc, tlength);
} }
totalLength -= len; totalLength -= len;
transferLength += len; transferLength += len;
@ -279,8 +279,14 @@ afs_MemWrite(avc, auio, aio, acred, noLock)
/* afs_xwrite handles setting m.Length */ /* afs_xwrite handles setting m.Length */
osi_Assert(filePos <= avc->m.Length); osi_Assert(filePos <= avc->m.Length);
#else #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; avc->m.Length = filePos;
}
#endif #endif
#ifndef AFS_VM_RDWR_ENV #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 */ afsio_skip(auio, tlen); /* advance auio over data written */
/* compute new file size */ /* compute new file size */
if (offset + len > tdc->f.chunkBytes) { if (offset + len > tdc->f.chunkBytes) {
afs_int32 toffset = offset+len; afs_int32 tlength = offset+len;
afs_AdjustSize(tdc, toffset); afs_AdjustSize(tdc, tlength);
} }
totalLength -= len; totalLength -= len;
transferLength += len; transferLength += len;
@ -578,6 +584,11 @@ afs_UFSWrite(avc, auio, aio, acred, noLock)
osi_Assert(filePos <= avc->m.Length); osi_Assert(filePos <= avc->m.Length);
#else #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; avc->m.Length = filePos;
} }
#endif #endif

View File

@ -739,7 +739,6 @@ afs_BioDaemon (nbiods)
} }
/* Ignore HUP signals... */ /* Ignore HUP signals... */
#ifdef AFS_AIX41_ENV
{ {
sigset_t sigbits, osigbits; sigset_t sigbits, osigbits;
/* /*
@ -749,11 +748,6 @@ afs_BioDaemon (nbiods)
SIGDELSET(sigbits, SIGHUP); /* except SIGHUP */ SIGDELSET(sigbits, SIGHUP); /* except SIGHUP */
limit_sigs(&sigbits, &osigbits); /* and already masked */ 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 /* Main body starts here -- this is an intentional infinite loop, and
* should NEVER exit * should NEVER exit
* *
@ -784,15 +778,16 @@ afs_BioDaemon (nbiods)
if (bp->b_flags & B_PFSTORE) { /* XXXX */ if (bp->b_flags & B_PFSTORE) { /* XXXX */
ObtainWriteLock(&vcp->lock,404); ObtainWriteLock(&vcp->lock,404);
if (vcp->v.v_gnode->gn_mwrcnt) { if (vcp->v.v_gnode->gn_mwrcnt) {
#ifdef AFS_64BIT_CLIENT afs_offs_t newlength =
if (vcp->m.Length < (afs_offs_t) dbtob(bp->b_blkno) + bp->b_bcount;
(afs_offs_t)dbtob(bp->b_blkno) + bp->b_bcount) if (vcp->m.Length < newlength) {
vcp->m.Length = afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH,
(afs_offs_t)dbtob(bp->b_blkno) + bp->b_bcount; ICL_TYPE_STRING, __FILE__,
#else /* AFS_64BIT_CLIENT */ ICL_TYPE_LONG, __LINE__,
if (vcp->m.Length < bp->b_bcount + (u_int)dbtob(bp->b_blkno)) ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(vcp->m.Length),
vcp->m.Length = bp->b_bcount + (u_int)dbtob(bp->b_blkno); ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(newlength));
#endif /* AFS_64BIT_CLIENT */ vcp->m.Length = newlength;
}
} }
ReleaseWriteLock(&vcp->lock); ReleaseWriteLock(&vcp->lock);
} }
@ -1101,21 +1096,9 @@ afs_BioDaemon (nbiods)
/* Ignore HUP signals... */ /* 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); SIGDELSET(u.u_procp->p_sig, SIGHUP);
SIGADDSET(u.u_procp->p_sigignore, SIGHUP); SIGADDSET(u.u_procp->p_sigignore, SIGHUP);
SIGDELSET(u.u_procp->p_sigcatch, SIGHUP); SIGDELSET(u.u_procp->p_sigcatch, SIGHUP);
#endif
/* Main body starts here -- this is an intentional infinite loop, and /* Main body starts here -- this is an intentional infinite loop, and
* should NEVER exit * should NEVER exit
* *

View File

@ -832,6 +832,9 @@ afs_TruncateAllSegments(avc, alen, areq, acred)
AFS_STATCNT(afs_TruncateAllSegments); AFS_STATCNT(afs_TruncateAllSegments);
avc->m.Date = osi_Time(); 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) { if (alen >= avc->m.Length) {
/* /*
* Special speedup since Sun's vm extends the file this way; * 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->states |= CExtendedFile;
avc->m.Length = alen; 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; 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)) #if (defined(AFS_SUN5_ENV))
/* Zero unused portion of last page */ /* Zero unused portion of last page */

View File

@ -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_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_STOREALL, "StoreAll vp 0x%lx len (0x%x, 0x%x)"
ec CM_TRACE_INVALL, "InvalAll vp 0x%lx len 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_TRUNCALL, "TruncAll vp 0x%lx old len (0x%x, 0x%x) new len (0x%x, 0x%x)"
ec CM_TRACE_TRUNCALL2,"TruncAll vp 0x%lx vlen 0x%x len 0x%x"
ec CM_TRACE_GNLINK, "Gn_link vp 0x%lx name %s (returns 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_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)" 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_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_STOREPROC2, "StoreProc got 0x%x"
ec CM_TRACE_ADJUSTSIZE, "AdjustSize index %d oldSize %d newSize %d blocksUsed %d" 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 end