summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1998-12-14 17:51:30 +0000
committerdt <dt@FreeBSD.org>1998-12-14 17:51:30 +0000
commit9c55aebaa438b30ec51f87c8753651909f0b2800 (patch)
tree93113ae9950ce54b91a287df8aa125f4bb04567d /sys/nfsclient
parented7c1066e1dd7f733363358ddd856667a87b91e9 (diff)
downloadFreeBSD-src-9c55aebaa438b30ec51f87c8753651909f0b2800.zip
FreeBSD-src-9c55aebaa438b30ec51f87c8753651909f0b2800.tar.gz
(Hopefully) fix support for "large" files. Mostly cast block numbers to off_t
before they multiplied to block sizes.
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_bio.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c
index fb92542..c973700 100644
--- a/sys/nfsclient/nfs_bio.c
+++ b/sys/nfsclient/nfs_bio.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95
- * $Id: nfs_bio.c,v 1.63 1998/11/09 07:00:14 peter Exp $
+ * $Id: nfs_bio.c,v 1.64 1998/12/07 21:58:43 archie Exp $
*/
@@ -277,7 +277,8 @@ nfs_bioread(vp, uio, ioflag, cred, getpages)
int getpages;
{
register struct nfsnode *np = VTONFS(vp);
- register int biosize, diff, i;
+ register int biosize, i;
+ off_t diff;
struct buf *bp = 0, *rabp;
struct vattr vattr;
struct proc *p;
@@ -432,7 +433,7 @@ again:
bufsize = biosize;
if ((off_t)(lbn + 1) * biosize > np->n_size &&
(off_t)(lbn + 1) * biosize - np->n_size < biosize) {
- bufsize = np->n_size - lbn * biosize;
+ bufsize = np->n_size - (off_t)lbn * biosize;
bufsize = (bufsize + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1);
}
bp = nfs_getcacheblk(vp, lbn, bufsize, p);
@@ -757,8 +758,8 @@ again:
vnode_pager_setsize(vp, np->n_size);
}
bufsize = biosize;
- if ((lbn + 1) * biosize > np->n_size) {
- bufsize = np->n_size - lbn * biosize;
+ if ((off_t)(lbn + 1) * biosize > np->n_size) {
+ bufsize = np->n_size - (off_t)lbn * biosize;
bufsize = (bufsize + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1);
}
bp = nfs_getcacheblk(vp, lbn, bufsize, p);
@@ -770,9 +771,8 @@ again:
}
np->n_flag |= NMODIFIED;
- if ((bp->b_blkno * DEV_BSIZE) + bp->b_dirtyend > np->n_size) {
- bp->b_dirtyend = np->n_size - (bp->b_blkno * DEV_BSIZE);
- }
+ if ((off_t)bp->b_blkno * DEV_BSIZE + bp->b_dirtyend > np->n_size)
+ bp->b_dirtyend = np->n_size - (off_t)bp->b_blkno * DEV_BSIZE;
/*
* If the new write will leave a contiguous dirty
@@ -903,10 +903,10 @@ nfs_getcacheblk(vp, bn, size, p)
} else
bp = getblk(vp, bn, size, 0, 0);
- if( vp->v_type == VREG) {
+ if (vp->v_type == VREG) {
int biosize;
biosize = mp->mnt_stat.f_iosize;
- bp->b_blkno = (bn * biosize) / DEV_BSIZE;
+ bp->b_blkno = bn * (biosize / DEV_BSIZE);
}
return (bp);
@@ -1216,13 +1216,13 @@ nfs_doio(bp, cr, p)
bp->b_error = error;
}
} else {
- if (((bp->b_blkno * DEV_BSIZE) + bp->b_dirtyend) > np->n_size)
- bp->b_dirtyend = np->n_size - (bp->b_blkno * DEV_BSIZE);
+ if ((off_t)bp->b_blkno * DEV_BSIZE + bp->b_dirtyend > np->n_size)
+ bp->b_dirtyend = np->n_size - (off_t)bp->b_blkno * DEV_BSIZE;
if (bp->b_dirtyend > bp->b_dirtyoff) {
io.iov_len = uiop->uio_resid = bp->b_dirtyend
- bp->b_dirtyoff;
- uiop->uio_offset = ((off_t)bp->b_blkno) * DEV_BSIZE
+ uiop->uio_offset = (off_t)bp->b_blkno * DEV_BSIZE
+ bp->b_dirtyoff;
io.iov_base = (char *)bp->b_data + bp->b_dirtyoff;
uiop->uio_rw = UIO_WRITE;
OpenPOWER on IntegriCloud