more-64bit-file-size-support-20011031

further 64bit file size support for client
This commit is contained in:
Hartmut Reuter 2001-11-01 04:39:08 +00:00 committed by Derrick Brashear
parent 971b18bc42
commit c5b1a3775f
8 changed files with 69 additions and 58 deletions

View File

@ -170,11 +170,8 @@ enum seg_rw rw;
struct AFS_UCRED *acred;
{
register afs_int32 code = 0;
#if defined(AFS_SUN56_ENV)
u_offset_t toff = (u_offset_t)off;
#endif
AFS_STATCNT(afs_getpage);
#ifdef AFS_SUN5_ENV
if (vp->v_flag & VNOMAP) /* File doesn't allow mapping */
return (ENOSYS);
@ -184,7 +181,7 @@ struct AFS_UCRED *acred;
#if defined(AFS_SUN56_ENV)
if (len <= PAGESIZE)
code = afs_GetOnePage((struct vnode *) vp, toff, len, protp, pl, plsz,
code = afs_GetOnePage((struct vnode *) vp, off, len, protp, pl, plsz,
seg, addr, rw, acred);
#else
#ifdef AFS_SUN5_ENV
@ -206,7 +203,7 @@ struct AFS_UCRED *acred;
#endif
afs_BozonLock(&vcp->pvnLock, vcp);
#if defined(AFS_SUN56_ENV)
code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, toff,
code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, off,
len, protp, pl, plsz, seg, addr, rw, acred);
#else
code = pvn_getpages(afs_GetOnePage, (struct vnode *) vp, (u_int)off,
@ -256,7 +253,8 @@ struct AFS_UCRED *acred;
register struct vcache *avc;
register struct dcache *tdc;
int i, s, pexists;
int slot, offset, nlen;
int slot;
afs_size_t offset, nlen;
struct vrequest treq;
afs_int32 mapForRead = 0, Code=0;
#if defined(AFS_SUN56_ENV)
@ -326,9 +324,9 @@ struct AFS_UCRED *acred;
retry:
#ifdef AFS_SUN5_ENV
if (rw == S_WRITE || rw == S_CREATE)
tdc = afs_GetDCache(avc, (afs_int32)off, &treq, &offset, &nlen, 5);
tdc = afs_GetDCache(avc, (afs_offs_t)off, &treq, &offset, &nlen, 5);
else
tdc = afs_GetDCache(avc, (afs_int32)off, &treq, &offset, &nlen, 1);
tdc = afs_GetDCache(avc, (afs_offs_t)off, &treq, &offset, &nlen, 1);
if (!tdc) return EINVAL;
#endif
code = afs_VerifyVCache(avc, &treq);
@ -343,8 +341,9 @@ retry:
ObtainReadLock(&avc->lock);
afs_Trace4(afs_iclSetp, CM_TRACE_PAGEIN, ICL_TYPE_POINTER, (afs_int32) vp,
ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len,
ICL_TYPE_LONG, (int) rw);
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(off),
ICL_TYPE_LONG, len,
ICL_TYPE_LONG, (int) rw);
tlen = len;
slot = 0;
@ -586,8 +585,9 @@ int afs_putpage(vp, off, len, flags, cred)
*/
AFS_GLOCK();
afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUT, ICL_TYPE_POINTER, (afs_int32) vp,
ICL_TYPE_LONG, (afs_int32) off, ICL_TYPE_LONG, (afs_int32) len,
ICL_TYPE_LONG, (int) flags);
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(off),
ICL_TYPE_INT32, (afs_int32) len,
ICL_TYPE_LONG, (int) flags);
avc = (struct vcache *) vp;
afs_BozonLock(&avc->pvnLock, avc);
ObtainWriteLock(&avc->lock,247);
@ -654,7 +654,8 @@ int afs_putapage(struct vnode *vp, struct page *pages,
struct buf *tbuf;
struct vcache *avc = (struct vcache *)vp;
afs_int32 code = 0;
u_int toff, tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE;
afs_offs_t toff;
u_int tlen = PAGESIZE, off = (pages->p_offset/PAGESIZE)*PAGESIZE;
u_int poff = pages->p_offset;
/*
@ -663,7 +664,7 @@ int afs_putapage(struct vnode *vp, struct page *pages,
* adjust the i/o if the file space is less than a while page. XXX
*/
toff = off;
if (tlen+toff > avc->m.Length) {
if (toff + tlen > avc->m.Length) {
tlen = avc->m.Length - toff;
}
/* can't call mapout with 0 length buffers (rmfree panics) */
@ -681,8 +682,10 @@ int afs_putapage(struct vnode *vp, struct page *pages,
tbuf->b_blkno = btodb(pages->p_offset);
bp_mapin(tbuf);
AFS_GLOCK();
afs_Trace4(afs_iclSetp, CM_TRACE_PAGEOUTONE, ICL_TYPE_LONG, avc, ICL_TYPE_LONG, pages,
ICL_TYPE_LONG, tlen, ICL_TYPE_LONG, toff);
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));
code = afs_ustrategy(tbuf, credp); /* unlocks page */
AFS_GUNLOCK();
bp_mapout(tbuf);
@ -826,11 +829,11 @@ struct AFS_UCRED *acred;
afs_int32 mode, sflags;
register char *data;
struct dcache *dcp, *dcp_newpage;
afs_int32 fileBase, size;
afs_int32 pageBase;
afs_size_t fileBase, size;
afs_size_t pageBase;
register afs_int32 tsize;
register afs_int32 pageOffset, extraResid=0;
register long origLength; /* length when reading/writing started */
register afs_size_t origLength; /* length when reading/writing started */
register long appendLength; /* length when this call will finish */
int created; /* created pages instead of faulting them */
int lockCode;
@ -849,11 +852,13 @@ struct AFS_UCRED *acred;
afs_Trace4(afs_iclSetp, CM_TRACE_VMRW, ICL_TYPE_POINTER, (afs_int32)avc,
ICL_TYPE_LONG, (arw==UIO_WRITE? 1 : 0),
ICL_TYPE_LONG, auio->uio_offset,
ICL_TYPE_LONG, auio->uio_resid);
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(auio->uio_offset),
ICL_TYPE_OFFSET, ICL_HANDLE_OFFSET(auio->uio_resid));
#ifndef AFS_64BIT_CLIENT
if ( AfsLargeFileUio(auio) ) /* file is larger than 2 GB */
return (EFBIG);
#endif
#ifdef AFS_SUN5_ENV
if (!acred) osi_Panic("rdwr: !acred");
@ -898,12 +903,14 @@ struct AFS_UCRED *acred;
return EINVAL;
}
#ifndef AFS_64BIT_CLIENT
/* file is larger than 2GB */
if ( AfsLargeFileSize(auio->uio_offset, auio->uio_resid) ) {
ReleaseWriteLock(&avc->lock);
afs_BozonUnlock(&avc->pvnLock, avc);
return EFBIG;
}
#endif
didFakeOpen=0; /* keep track of open so we can do close */
if (arw == UIO_WRITE) {
@ -996,7 +1003,7 @@ struct AFS_UCRED *acred;
eof = 0; /* flag telling us if we hit the EOF on the read */
if (arw == UIO_READ) { /* we're doing a read operation */
/* don't read past EOF */
if (tsize + fileBase > origLength) {
if (fileBase + tsize > origLength) {
tsize = origLength - fileBase;
eof = 1; /* we did hit the EOF */
if (tsize < 0) tsize = 0; /* better safe than sorry */
@ -1054,7 +1061,7 @@ struct AFS_UCRED *acred;
}
ReleaseWriteLock(&avc->vlock);
{
int toff, tlen;
afs_size_t toff, tlen;
dcp = afs_GetDCache(avc, fileBase, &treq, &toff, &tlen, 2);
if (!dcp) {
code = ENOENT;
@ -1225,14 +1232,16 @@ struct AFS_UCRED *cred;
/* check for reasonableness on segment bounds; apparently len can be < 0 */
if ((int)off < 0 || (int)(off + len) < 0) {
if (off < 0 || off + len < 0) {
return (EINVAL);
}
#ifndef AFS_64BIT_CLIENT
if ( AfsLargeFileSize(off, len) ) /* file is larger than 2 GB */
{
code = EFBIG;
goto out;
}
#endif
#if defined(AFS_SUN5_ENV)
if (vp->v_flag & VNOMAP) /* File isn't allowed to be mapped */

View File

@ -103,7 +103,6 @@ afsremove(adp, tdc, tvc, aname, acred, treqp)
struct AFS_UCRED *acred; {
register afs_int32 code;
register struct conn *tc;
afs_int32 offset, len;
struct AFSFetchStatus OutDirStatus;
struct AFSVolSync tsync;
XSTATS_DECLS
@ -223,7 +222,7 @@ afs_remove(OSI_VC_ARG(adp), aname, acred)
struct VenusFid unlinkFid;
register afs_int32 code;
register struct vcache *tvc;
afs_int32 offset, len;
afs_size_t offset, len;
struct AFSFetchStatus OutDirStatus;
struct AFSVolSync tsync;
XSTATS_DECLS
@ -368,7 +367,7 @@ afs_remunlink(avc, doit)
struct vrequest treq;
struct VenusFid dirFid;
register struct dcache *tdc;
afs_int32 offset, len, code=0;
afs_int32 code=0;
if (NBObtainWriteLock(&avc->lock, 423))
return 0;

View File

@ -40,7 +40,7 @@ afsrename(aodp, aname1, andp, aname2, acred)
register afs_int32 code;
afs_int32 returnCode;
int oneDir, doLocally;
afs_int32 offset, len;
afs_size_t offset, len;
struct VenusFid unlinkFid, fileFid;
struct vcache *tvc;
struct dcache *tdc1, *tdc2;

View File

@ -76,10 +76,14 @@ afs_ustrategy(abp)
tuio.afsio_iov = tiovec;
tuio.afsio_iovcnt = 1;
#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV) || defined(AFS_FBSD_ENV)
#ifdef AFS_64BIT_CLIENT
tuio.afsio_offset = (afs_offs_t) dbtob(abp->b_blkno);
#else /* AFS_64BIT_CLIENT */
tuio.afsio_offset = (u_int) dbtob(abp->b_blkno);
#if defined(AFS_SUN5_ENV)
tuio._uio_offset._p._u = 0;
#endif
#endif /* AFS_64BIT_CLIENT */
#else
tuio.afsio_offset = DEV_BSIZE * abp->b_blkno;
#endif
@ -129,9 +133,15 @@ afs_ustrategy(abp)
tuio.afsio_iov = tiovec;
tuio.afsio_iovcnt = 1;
#if defined(AFS_SUN_ENV) || defined(AFS_ALPHA_ENV) || defined(AFS_SUN5_ENV)
#ifdef AFS_64BIT_CLIENT
tuio.afsio_offset = (afs_offs_t) dbtob(abp->b_blkno);
#else /* AFS_64BIT_CLIENT */
tuio.afsio_offset = (u_int) dbtob(abp->b_blkno);
#ifdef AFS_SUN5_ENV
tuio._uio_offset._p._u = 0;
#endif
#endif /* AFS_64BIT_CLIENT */
#ifdef AFS_SUN5_ENV
#ifdef AFS_SUN59_ENV
tuio.uio_limit = curproc->p_fsz_ctl.rlim_cur;
#else
@ -152,7 +162,7 @@ afs_ustrategy(abp)
*/
len = MIN(len, tvc->m.Length - dbtob(abp->b_blkno));
#endif
#ifdef AFS_ALPHA_ENV
#ifdef AFS_ALPHA_ENV
len = MIN(abp->b_bcount, ((struct vcache *)abp->b_vp)->m.Length - dbtob(abp->b_blkno));
#endif /* AFS_ALPHA_ENV */
tuio.afsio_resid = len;

View File

@ -782,8 +782,15 @@ 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 */
}
ReleaseWriteLock(&vcp->lock);
}

View File

@ -7,12 +7,12 @@
error_table 2 ZCM
ec CM_TRACE_NULL, "dummy"
ec CM_TRACE_PAGEIN, "getapage vp 0x%lx off 0x%x len 0x%x rw=0x%x"
ec CM_TRACE_PAGEIN, "getapage vp 0x%lx off (0x%x, 0x%x) len 0x%x rw=0x%x"
ec CM_TRACE_PAGEINDONE, "getapage done code 0x%x pg 0x%lx (0x%x)"
ec CM_TRACE_PAGEOUT, "putpage vp 0x%lx off 0x%x len 0x%x flags=0x%x"
ec CM_TRACE_PAGEOUT, "putpage vp 0x%lx off (0x%x, 0x%x) len 0x%x flags=0x%x"
ec CM_TRACE_PAGEOUTDONE, "putpage done code 0x%x #dirty 0x%x"
ec CM_TRACE_PAGEOUTONE, "putApage vp 0x%lx pag 0x%lx len 0x%x off 0x%x"
ec CM_TRACE_VMRW, "vmrw vp 0x%lx, write=0x%x, off=0x%x, len=0x%x"
ec CM_TRACE_PAGEOUTONE, "putApage vp 0x%lx pag 0x%lx len 0x%x off (0x%x, 0x%x)"
ec CM_TRACE_VMRW, "vmrw vp 0x%lx, write=0x%x, off=(0x%x, 0x%x), len=(0x%x, 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 index %d coff (0x%x, 0x%x)"

View File

@ -96,23 +96,8 @@ proc GetCacheConfig(
OUT cacheConfig *config
) = 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;
) = 65536;

View File

@ -666,6 +666,13 @@ ResidencyCmd(
OUT struct ResidencyCmdOutputs *Outputs
) = 220;
InlineBulkStatus(
IN AFSCBFids *FidsArray,
OUT AFSBulkStats *StatArray,
AFSCBs *CBArray,
AFSVolSync *Sync
) = 65536;
FetchData64(
IN AFSFid *Fid,
afs_int64 Pos,
@ -673,7 +680,7 @@ FetchData64(
OUT AFSFetchStatus *OutStatus,
AFSCallBack *CallBack,
AFSVolSync *Sync
) split = 231;
) split = 65537;
StoreData64(
IN AFSFid *Fid,
@ -683,11 +690,5 @@ StoreData64(
afs_int64 FileLength,
OUT AFSFetchStatus *OutStatus,
AFSVolSync *Sync
) split = 233;
) split = 65538;
InlineBulkStatus(
IN AFSCBFids *FidsArray,
OUT AFSBulkStats *StatArray,
AFSCBs *CBArray,
AFSVolSync *Sync
) = 65536;