summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_cluster.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1998-03-16 01:56:03 +0000
committerdyson <dyson@FreeBSD.org>1998-03-16 01:56:03 +0000
commit6e92f5716b52dc57076b8d8fe6568e256fbafc11 (patch)
tree88ec82107a7d26a71c57f9317d392f8790eae1ba /sys/kern/vfs_cluster.c
parent0a68cc8a03772baf7c528d27885de401a80dbcfe (diff)
downloadFreeBSD-src-6e92f5716b52dc57076b8d8fe6568e256fbafc11.zip
FreeBSD-src-6e92f5716b52dc57076b8d8fe6568e256fbafc11.tar.gz
Some VM improvements, including elimination of alot of Sig-11
problems. Tor Egge and others have helped with various VM bugs lately, but don't blame him -- blame me!!! pmap.c: 1) Create an object for kernel page table allocations. This fixes a bogus allocation method previously used for such, by grabbing pages from the kernel object, using bogus pindexes. (This was a code cleanup, and perhaps a minor system stability issue.) pmap.c: 2) Pre-set the modify and accessed bits when prudent. This will decrease bus traffic under certain circumstances. vfs_bio.c, vfs_cluster.c: 3) Rather than calculating the beginning virtual byte offset multiple times, stick the offset into the buffer header, so that the calculated offset can be reused. (Long long multiplies are often expensive, and this is a probably unmeasurable performance improvement, and code cleanup.) vfs_bio.c: 4) Handle write recursion more intelligently (but not perfectly) so that it is less likely to cause a system panic, and is also much more robust. vfs_bio.c: 5) getblk incorrectly wrote out blocks that are incorrectly sized. The problem is fixed, and writes blocks out ONLY when B_DELWRI is true. vfs_bio.c: 6) Check that already constituted buffers have fully valid pages. If not, then make sure that the B_CACHE bit is not set. (This was a major source of Sig-11 type problems.) vfs_bio.c: 7) Fix a potential system deadlock due to an incorrectly specified sleep priority while waiting for a buffer write operation. The change that I made opens the system up to serious problems, and we need to examine the issue of process sleep priorities. vfs_cluster.c, vfs_bio.c: 8) Make clustered reads work more correctly (and more completely) when buffers are already constituted, but not fully valid. (This was another system reliability issue.) vfs_subr.c, ffs_inode.c: 9) Create a vtruncbuf function, which is used by filesystems that can truncate files. The vinvalbuf forced a file sync type operation, while vtruncbuf only invalidates the buffers past the new end of file, and also invalidates the appropriate pages. (This was a system reliabiliy and performance issue.) 10) Modify FFS to use vtruncbuf. vm_object.c: 11) Make the object rundown mechanism for OBJT_VNODE type objects work more correctly. Included in that fix, create pager entries for the OBJT_DEAD pager type, so that paging requests that might slip in during race conditions are properly handled. (This was a system reliability issue.) vm_page.c: 12) Make some of the page validation routines be a little less picky about arguments passed to them. Also, support page invalidation change the object generation count so that we handle generation counts a little more robustly. vm_pageout.c: 13) Further reduce pageout daemon activity when the system doesn't need help from it. There should be no additional performance decrease even when the pageout daemon is running. (This was a significant performance issue.) vnode_pager.c: 14) Teach the vnode pager to handle race conditions during vnode deallocations.
Diffstat (limited to 'sys/kern/vfs_cluster.c')
-rw-r--r--sys/kern/vfs_cluster.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index 0022ac9..f2c12d4 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_cluster.c 8.7 (Berkeley) 2/13/94
- * $Id: vfs_cluster.c,v 1.56 1998/03/07 21:35:28 dyson Exp $
+ * $Id: vfs_cluster.c,v 1.57 1998/03/08 09:57:09 julian Exp $
*/
#include "opt_debug_cluster.h"
@@ -165,8 +165,8 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
}
reqbp = bp = NULL;
} else {
- u_quad_t firstread;
- firstread = (u_quad_t) lblkno * size;
+ off_t firstread;
+ firstread = bp->b_offset;
if (firstread + totread > filesize)
totread = filesize - firstread;
if (totread > size) {
@@ -253,6 +253,7 @@ single_block_read:
curproc->p_stats->p_ru.ru_inblock++;
}
}
+
/*
* and if we have read-aheads, do them too
*/
@@ -346,6 +347,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
bp->b_iodone = cluster_callback;
bp->b_blkno = blkno;
bp->b_lblkno = lbn;
+ bp->b_offset = tbp->b_offset;
pbgetvp(vp, bp);
TAILQ_INIT(&bp->b_cluster.cluster_head);
@@ -363,8 +365,20 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
round_page(size) > vp->v_maxio)
break;
- if (incore(vp, lbn + i))
- break;
+ if (tbp = incore(vp, lbn + i)) {
+ if (tbp->b_flags & B_BUSY)
+ break;
+
+ for (j = 0; j < tbp->b_npages; j++)
+ if (tbp->b_pages[j]->valid)
+ break;
+
+ if (j != tbp->b_npages)
+ break;
+
+ if (tbp->b_bcount != size)
+ break;
+ }
tbp = getblk(vp, lbn + i, size, 0, 0);
@@ -374,18 +388,12 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
break;
}
- for (j=0;j<tbp->b_npages;j++) {
- if (tbp->b_pages[j]->valid) {
+ for (j = 0;j < tbp->b_npages; j++)
+ if (tbp->b_pages[j]->valid)
break;
- }
- }
if (j != tbp->b_npages) {
- /*
- * force buffer to be re-constituted later
- */
- tbp->b_flags |= B_RELBUF;
- brelse(tbp);
+ bqrelse(tbp);
break;
}
@@ -525,7 +533,7 @@ cluster_write(bp, filesize)
*/
cursize = vp->v_lastw - vp->v_cstart + 1;
#ifndef notyet_block_reallocation_enabled
- if (((u_quad_t)(lbn + 1) * lblocksize) != filesize ||
+ if (((u_quad_t) bp->b_offset + lblocksize) != filesize ||
lbn != vp->v_lastw + 1 ||
vp->v_clen <= cursize) {
if (!async)
@@ -576,7 +584,7 @@ cluster_write(bp, filesize)
* existing cluster.
*/
if ((vp->v_type == VREG) &&
- ((u_quad_t) (lbn + 1) * lblocksize) != filesize &&
+ ((u_quad_t) bp->b_offset + lblocksize) != filesize &&
(bp->b_blkno == bp->b_lblkno) &&
(VOP_BMAP(vp, lbn, NULL, &bp->b_blkno, &maxclen, NULL) ||
bp->b_blkno == -1)) {
@@ -682,6 +690,7 @@ cluster_wbuild(vp, size, start_lbn, len)
bp->b_blkno = tbp->b_blkno;
bp->b_lblkno = tbp->b_lblkno;
+ bp->b_offset = tbp->b_offset;
(vm_offset_t) bp->b_data |= ((vm_offset_t) tbp->b_data) & PAGE_MASK;
bp->b_flags |= B_CALL | B_BUSY | B_CLUSTER |
(tbp->b_flags & (B_VMIO|B_NEEDCOMMIT));
OpenPOWER on IntegriCloud