summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-01-09 16:06:02 +0000
committerdg <dg@FreeBSD.org>1995-01-09 16:06:02 +0000
commit1707d41102ca7d645ec2db9e442a27857337d7e9 (patch)
treeafd2f1c13b93c3fff08b58c44153df0d13479824 /sys/ufs
parent08ff911ba0fc8f893be057ca25d8b941f6d0f276 (diff)
downloadFreeBSD-src-1707d41102ca7d645ec2db9e442a27857337d7e9.zip
FreeBSD-src-1707d41102ca7d645ec2db9e442a27857337d7e9.tar.gz
These changes embody the support of the fully coherent merged VM buffer cache,
much higher filesystem I/O performance, and much better paging performance. It represents the culmination of over 6 months of R&D. The majority of the merged VM/cache work is by John Dyson. The following highlights the most significant changes. Additionally, there are (mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to support the new VM/buffer scheme. vfs_bio.c: Significant rewrite of most of vfs_bio to support the merged VM buffer cache scheme. The scheme is almost fully compatible with the old filesystem interface. Significant improvement in the number of opportunities for write clustering. vfs_cluster.c, vfs_subr.c Upgrade and performance enhancements in vfs layer code to support merged VM/buffer cache. Fixup of vfs_cluster to eliminate the bogus pagemove stuff. vm_object.c: Yet more improvements in the collapse code. Elimination of some windows that can cause list corruption. vm_pageout.c: Fixed it, it really works better now. Somehow in 2.0, some "enhancements" broke the code. This code has been reworked from the ground-up. vm_fault.c, vm_page.c, pmap.c, vm_object.c Support for small-block filesystems with merged VM/buffer cache scheme. pmap.c vm_map.c Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of kernel PTs. vm_glue.c Much simpler and more effective swapping code. No more gratuitous swapping. proc.h Fixed the problem that the p_lock flag was not being cleared on a fork. swap_pager.c, vnode_pager.c Removal of old vfs_bio cruft to support the past pseudo-coherency. Now the code doesn't need it anymore. machdep.c Changes to better support the parameter values for the merged VM/buffer cache scheme. machdep.c, kern_exec.c, vm_glue.c Implemented a seperate submap for temporary exec string space and another one to contain process upages. This eliminates all map fragmentation problems that previously existed. ffs_inode.c, ufs_inode.c, ufs_readwrite.c Changes for merged VM/buffer cache. Add "bypass" support for sneaking in on busy buffers. Submitted by: John Dyson and David Greenman
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c8
-rw-r--r--sys/ufs/ffs/ffs_inode.c11
-rw-r--r--sys/ufs/ffs/ffs_vnops.c25
-rw-r--r--sys/ufs/lfs/lfs_balloc.c3
-rw-r--r--sys/ufs/lfs/lfs_inode.c4
-rw-r--r--sys/ufs/lfs/lfs_segment.c3
-rw-r--r--sys/ufs/lfs/lfs_subr.c7
-rw-r--r--sys/ufs/lfs/lfs_syscalls.c6
-rw-r--r--sys/ufs/ufs/ufs_bmap.c9
-rw-r--r--sys/ufs/ufs/ufs_readwrite.c24
-rw-r--r--sys/ufs/ufs/ufs_vnops.c6
11 files changed, 64 insertions, 42 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 9830e4f..7feaa51 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_alloc.c 8.8 (Berkeley) 2/21/94
- * $Id: ffs_alloc.c,v 1.4 1994/09/20 05:53:24 bde Exp $
+ * $Id: ffs_alloc.c,v 1.5 1994/10/10 01:04:34 phk Exp $
*/
#include <sys/param.h>
@@ -210,7 +210,7 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
panic("bad blockno");
ip->i_blocks += btodb(nsize - osize);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- allocbuf(bp, nsize);
+ allocbuf(bp, nsize, 0);
bp->b_flags |= B_DONE;
bzero((char *)bp->b_data + osize, (u_int)nsize - osize);
*bpp = bp;
@@ -268,14 +268,14 @@ ffs_realloccg(ip, lbprev, bpref, osize, nsize, cred, bpp)
(u_long (*)())ffs_alloccg);
if (bno > 0) {
bp->b_blkno = fsbtodb(fs, bno);
- (void) vnode_pager_uncache(ITOV(ip));
+ /* (void) vnode_pager_uncache(ITOV(ip)); */
ffs_blkfree(ip, bprev, (long)osize);
if (nsize < request)
ffs_blkfree(ip, bno + numfrags(fs, nsize),
(long)(request - nsize));
ip->i_blocks += btodb(nsize - osize);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- allocbuf(bp, nsize);
+ allocbuf(bp, nsize, 0);
bp->b_flags |= B_DONE;
bzero((char *)bp->b_data + osize, (u_int)nsize - osize);
*bpp = bp;
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 0058d9b..8ba128c 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_inode.c 8.5 (Berkeley) 12/30/93
- * $Id: ffs_inode.c,v 1.9 1994/10/22 02:27:32 davidg Exp $
+ * $Id: ffs_inode.c,v 1.10 1994/12/27 14:44:42 bde Exp $
*/
#include <sys/param.h>
@@ -204,7 +204,6 @@ ffs_truncate(ap)
if (error)
return (error);
#endif
- vnode_pager_setsize(ovp, (u_long)length);
osize = oip->i_size;
/*
* Lengthen the size of the file. We must ensure that the
@@ -226,6 +225,7 @@ ffs_truncate(ap)
bwrite(bp);
else
bawrite(bp);
+ vnode_pager_setsize(ovp, (u_long)length);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (VOP_UPDATE(ovp, &tv, &tv, 1));
}
@@ -250,7 +250,7 @@ ffs_truncate(ap)
oip->i_size = length;
size = blksize(fs, oip, lbn);
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
- allocbuf(bp, size);
+ allocbuf(bp, size, 0);
if (aflags & IO_SYNC)
bwrite(bp);
else
@@ -386,6 +386,7 @@ done:
if (oip->i_blocks < 0) /* sanity */
oip->i_blocks = 0;
oip->i_flag |= IN_CHANGE;
+ vnode_pager_setsize(ovp, (u_long)length);
#ifdef QUOTA
(void) chkdq(oip, -blocksreleased, NOCRED, 0);
#endif
@@ -441,7 +442,8 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
*/
vp = ITOV(ip);
bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0);
- if (bp->b_flags & (B_DONE | B_DELWRI)) {
+ /* if (bp->b_flags & (B_DONE | B_DELWRI)) { */
+ if (bp->b_flags & B_CACHE) {
/* Braces must be here in case trace evaluates to nothing. */
trace(TR_BREADHIT, pack(vp, fs->fs_bsize), lbn);
} else {
@@ -451,6 +453,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
if (bp->b_bcount > bp->b_bufsize)
panic("ffs_indirtrunc: bad buffer size");
bp->b_blkno = dbn;
+ vfs_busy_pages(bp, 0);
VOP_STRATEGY(bp);
error = biowait(bp);
}
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 35c9057..be78eaf 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vnops.c 8.7 (Berkeley) 2/3/94
- * $Id: ffs_vnops.c,v 1.6 1994/10/06 21:06:59 davidg Exp $
+ * $Id: ffs_vnops.c,v 1.7 1994/10/10 01:04:40 phk Exp $
*/
#include <sys/param.h>
@@ -261,19 +261,27 @@ loop:
continue;
if ((bp->b_flags & B_DELWRI) == 0)
panic("ffs_fsync: not dirty");
- bremfree(bp);
- bp->b_flags |= B_BUSY;
- splx(s);
+
+ if (bp->b_vp != vp && ap->a_waitfor != MNT_NOWAIT) {
+
+ bremfree(bp);
+ bp->b_flags |= B_BUSY;
+ splx(s);
/*
* Wait for I/O associated with indirect blocks to complete,
* since there is no way to quickly wait for them below.
*/
- if (bp->b_vp == vp || ap->a_waitfor == MNT_NOWAIT)
- (void) bawrite(bp);
- else
- (void) bwrite(bp);
+ if (bp->b_vp == vp || ap->a_waitfor == MNT_NOWAIT)
+ (void) bawrite(bp);
+ else
+ (void) bwrite(bp);
+ } else {
+ vfs_bio_awrite(bp);
+ splx(s);
+ }
goto loop;
}
+
if (ap->a_waitfor == MNT_WAIT) {
while (vp->v_numoutput) {
vp->v_flag |= VBWAIT;
@@ -287,6 +295,7 @@ loop:
#endif
}
splx(s);
+
tv = time;
return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
}
diff --git a/sys/ufs/lfs/lfs_balloc.c b/sys/ufs/lfs/lfs_balloc.c
index b7cf755..f8063c8 100644
--- a/sys/ufs/lfs/lfs_balloc.c
+++ b/sys/ufs/lfs/lfs_balloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_balloc.c 8.1 (Berkeley) 6/11/93
- * $Id$
+ * $Id: lfs_balloc.c,v 1.2 1994/08/02 07:54:30 davidg Exp $
*/
#include <sys/param.h>
#include <sys/buf.h>
@@ -129,6 +129,7 @@ lfs_balloc(vp, iosize, lbn, bpp)
else {
bp->b_blkno = daddr;
bp->b_flags |= B_READ;
+ vfs_busy_pages(bp, 0);
VOP_STRATEGY(bp);
return(biowait(bp));
}
diff --git a/sys/ufs/lfs/lfs_inode.c b/sys/ufs/lfs/lfs_inode.c
index 4e23016..68169a3 100644
--- a/sys/ufs/lfs/lfs_inode.c
+++ b/sys/ufs/lfs/lfs_inode.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_inode.c 8.5 (Berkeley) 12/30/93
- * $Id: lfs_inode.c,v 1.4 1994/10/10 01:04:50 phk Exp $
+ * $Id: lfs_inode.c,v 1.5 1995/01/04 23:46:31 gibbs Exp $
*/
#include <sys/param.h>
@@ -235,7 +235,7 @@ lfs_truncate(ap)
ip->i_size = length;
size = blksize(fs);
bzero((char *)bp->b_data + offset, (u_int)(size - offset));
- allocbuf(bp, size);
+ allocbuf(bp, size, 0);
if (e1 = VOP_BWRITE(bp))
return (e1);
}
diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c
index d19de2d..d393713 100644
--- a/sys/ufs/lfs/lfs_segment.c
+++ b/sys/ufs/lfs/lfs_segment.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_segment.c 8.5 (Berkeley) 1/4/94
- * $Id: lfs_segment.c,v 1.5 1994/11/17 01:30:49 gibbs Exp $
+ * $Id: lfs_segment.c,v 1.6 1995/01/04 23:46:32 gibbs Exp $
*/
#include <sys/param.h>
@@ -1091,7 +1091,6 @@ lfs_newbuf(vp, daddr, size)
bp = getpbuf();
if (nbytes)
bp->b_data = lfs_alloc_buffer( nbytes);
- bgetvp(vp, bp);
bp->b_bufsize = size;
bp->b_bcount = size;
bp->b_lblkno = daddr;
diff --git a/sys/ufs/lfs/lfs_subr.c b/sys/ufs/lfs/lfs_subr.c
index 82e8068..52d1574 100644
--- a/sys/ufs/lfs/lfs_subr.c
+++ b/sys/ufs/lfs/lfs_subr.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_subr.c 8.2 (Berkeley) 9/21/93
- * $Id: lfs_subr.c,v 1.4 1994/11/17 01:30:51 gibbs Exp $
+ * $Id: lfs_subr.c,v 1.5 1995/01/04 23:46:32 gibbs Exp $
*/
#include <sys/param.h>
@@ -147,11 +147,8 @@ lfs_segunlock(fs)
if (sp->bpp != sp->cbpp) {
/* Free allocated segment summary */
fs->lfs_offset -= LFS_SUMMARY_SIZE / DEV_BSIZE;
-/* free((*sp->bpp)->b_data, M_SEGMENT); */
- lfs_free_buffer((*sp->bpp)->b_data, roundup( (*sp->bpp)->b_bufsize, DEV_BSIZE));
- /* free(*sp->bpp, M_SEGMENT); */
+ lfs_free_buffer((*sp->bpp)->b_data, roundup((*sp->bpp)->b_bufsize, DEV_BSIZE));
relpbuf(*sp->bpp);
-
} else
printf ("unlock to 0 with no summary");
free(sp->bpp, M_SEGMENT);
diff --git a/sys/ufs/lfs/lfs_syscalls.c b/sys/ufs/lfs/lfs_syscalls.c
index 71ac5e9..73c5045 100644
--- a/sys/ufs/lfs/lfs_syscalls.c
+++ b/sys/ufs/lfs/lfs_syscalls.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_syscalls.c 8.5 (Berkeley) 4/20/94
- * $Id: lfs_syscalls.c,v 1.4 1994/11/17 01:30:52 gibbs Exp $
+ * $Id: lfs_syscalls.c,v 1.5 1995/01/04 23:46:33 gibbs Exp $
*/
#include <sys/param.h>
@@ -238,10 +238,6 @@ err2: lfs_vunref(vp);
/* Free up fakebuffers */
for (bpp = --sp->cbpp; bpp >= sp->bpp; --bpp)
if ((*bpp)->b_flags & B_CALL) {
- brelvp(*bpp);
-/*
- free(*bpp, M_SEGMENT);
-*/
relpbuf(*bpp);
} else
brelse(*bpp);
diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c
index f3009bd..108a5aa 100644
--- a/sys/ufs/ufs/ufs_bmap.c
+++ b/sys/ufs/ufs/ufs_bmap.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_bmap.c 8.6 (Berkeley) 1/21/94
- * $Id: ufs_bmap.c,v 1.3 1994/08/02 07:54:52 davidg Exp $
+ * $Id: ufs_bmap.c,v 1.4 1994/10/08 06:57:21 phk Exp $
*/
#include <sys/param.h>
@@ -128,12 +128,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
if (runp) {
/*
* XXX
- * If MAXBSIZE is the largest transfer the disks can handle,
+ * If MAXPHYS is the largest transfer the disks can handle,
* we probably want maxrun to be 1 block less so that we
* don't create a block larger than the device can handle.
*/
*runp = 0;
- maxrun = MAXBSIZE / mp->mnt_stat.f_iosize - 1;
+ maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1;
}
xap = ap == NULL ? a : ap;
@@ -179,7 +179,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
xap->in_exists = 1;
bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0);
- if (bp->b_flags & (B_DONE | B_DELWRI)) {
+ if (bp->b_flags & B_CACHE) {
trace(TR_BREADHIT, pack(vp, size), metalbn);
}
#ifdef DIAGNOSTIC
@@ -190,6 +190,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp)
trace(TR_BREADMISS, pack(vp, size), metalbn);
bp->b_blkno = blkptrtodb(ump, daddr);
bp->b_flags |= B_READ;
+ vfs_busy_pages(bp, 0);
VOP_STRATEGY(bp);
curproc->p_stats->p_ru.ru_inblock++; /* XXX */
error = biowait(bp);
diff --git a/sys/ufs/ufs/ufs_readwrite.c b/sys/ufs/ufs/ufs_readwrite.c
index 058af53..04956e9 100644
--- a/sys/ufs/ufs/ufs_readwrite.c
+++ b/sys/ufs/ufs/ufs_readwrite.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_readwrite.c 8.7 (Berkeley) 1/21/94
- * $Id: ufs_readwrite.c,v 1.4 1994/08/08 09:11:44 davidg Exp $
+ * $Id: ufs_readwrite.c,v 1.5 1994/10/10 01:04:55 phk Exp $
*/
#ifdef LFS_READWRITE
@@ -101,6 +101,9 @@ READ(ap)
if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0)
break;
lbn = lblkno(fs, uio->uio_offset);
+ xfersize = vfs_read_bypass( vp, uio, bytesinfile, lbn);
+ if( xfersize != 0)
+ continue;
nextlbn = lbn + 1;
size = BLKSIZE(fs, ip, lbn);
blkoffset = blkoff(fs, uio->uio_offset);
@@ -231,6 +234,10 @@ WRITE(ap)
xfersize = fs->fs_bsize - blkoffset;
if (uio->uio_resid < xfersize)
xfersize = uio->uio_resid;
+
+ if (uio->uio_offset + xfersize > ip->i_size)
+ vnode_pager_setsize(vp, (u_long)uio->uio_offset + xfersize);
+
#ifdef LFS_READWRITE
(void)lfs_check(vp, lbn);
error = lfs_balloc(vp, xfersize, lbn, &bp);
@@ -245,11 +252,13 @@ WRITE(ap)
#endif
if (error)
break;
+
if (uio->uio_offset + xfersize > ip->i_size) {
ip->i_size = uio->uio_offset + xfersize;
- vnode_pager_setsize(vp, (u_long)ip->i_size);
}
+/*
(void)vnode_pager_uncache(vp);
+*/
size = BLKSIZE(fs, ip, lbn) - bp->b_resid;
if (size < xfersize)
@@ -262,14 +271,17 @@ WRITE(ap)
#else
if (ioflag & IO_SYNC)
(void)bwrite(bp);
- else if (xfersize + blkoffset == fs->fs_bsize)
- if (doclusterwrite)
+ else if (xfersize + blkoffset == fs->fs_bsize) {
+ if (doclusterwrite) {
+ bp->b_flags |= B_CLUSTEROK;
cluster_write(bp, ip->i_size);
- else {
+ } else {
bawrite(bp);
}
- else
+ } else {
+ bp->b_flags |= B_CLUSTEROK;
bdwrite(bp);
+ }
#endif
if (error || xfersize == 0)
break;
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 7a65de4..b21d6a3 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94
- * $Id: ufs_vnops.c,v 1.12 1994/10/21 01:19:25 wollman Exp $
+ * $Id: ufs_vnops.c,v 1.13 1994/11/26 19:38:30 bde Exp $
*/
#include <sys/param.h>
@@ -441,8 +441,10 @@ ufs_chmod(vp, mode, cred, p)
ip->i_mode &= ~ALLPERMS;
ip->i_mode |= (mode & ALLPERMS);
ip->i_flag |= IN_CHANGE;
+/*
if ((vp->v_flag & VTEXT) && (ip->i_mode & S_ISTXT) == 0)
(void) vnode_pager_uncache(vp);
+*/
return (0);
}
@@ -647,6 +649,8 @@ ufs_remove(ap)
if ((error = ufs_dirremove(dvp, ap->a_cnp)) == 0) {
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
+ if( (ip->i_nlink == 0) && vp->v_vmdata)
+ ((vm_object_t)vp->v_vmdata)->flags |= OBJ_INTERNAL;
}
out:
if (dvp == vp)
OpenPOWER on IntegriCloud