summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2011-08-03 20:21:20 +0000
committerBob Beck <beck@cvs.openbsd.org>2011-08-03 20:21:20 +0000
commit23c538d69e8296158cf35591cd62de4b36d8f6da (patch)
tree2eaf603377085cd400e04bf25987d76890b660f0
parent6d6bd2ed27ecea3d7dedd611dd78d93decdcb02f (diff)
back out pedro diff for VOP_FSYNC of softdep when limit is reached.
The basic analysys is correct, however, the problem in this case is that by forcing softdept to synchornously flush everything across *all* softdep filesystems we cause a huge performance problem when we take a 3 second pause and slam everything synchronously. the right way to fix this is to fix the speedup_softdep code, not make the filesystem go synchronous when we hit a limit - if we are doing that we may as well not run softdep it will be faster. ok deraadt@
-rw-r--r--sys/ufs/ffs/ffs_inode.c23
-rw-r--r--sys/ufs/ffs/ffs_softdep.c10
-rw-r--r--sys/ufs/ffs/ffs_vnops.c25
3 files changed, 8 insertions, 50 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index c6f8caa5a81..3e47f0a98f3 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_inode.c,v 1.58 2011/07/04 04:30:41 tedu Exp $ */
+/* $OpenBSD: ffs_inode.c,v 1.59 2011/08/03 20:21:19 beck Exp $ */
/* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */
/*
@@ -164,10 +164,8 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
struct buf *bp;
int offset, size, level;
long count, nblocks, vflags, blocksreleased = 0;
- int i, aflags, error, allerror, indirect = 0;
+ int i, aflags, error, allerror;
off_t osize;
- extern int num_indirdep;
- extern int max_indirdep;
if (length < 0)
return (EINVAL);
@@ -243,8 +241,6 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
cred, aflags, &bp);
if (error)
return (error);
- if (bp->b_lblkno >= NDADDR)
- indirect = 1;
DIP_ASSIGN(oip, size, length);
uvm_vnp_setsize(ovp, length);
(void) uvm_vnp_uncache(ovp);
@@ -253,20 +249,7 @@ ffs_truncate(struct inode *oip, off_t length, int flags, struct ucred *cred)
else
bawrite(bp);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- error = UFS_UPDATE(oip, MNT_WAIT);
- if (DOINGSOFTDEP(ovp) && num_indirdep > max_indirdep)
- if (indirect) {
- /*
- * If the number of pending indirect block
- * dependencies is sufficiently close to the
- * maximum number of simultaneously mappable
- * buffers force a sync on the vnode to prevent
- * buffer cache exhaustion.
- */
- VOP_FSYNC(ovp, curproc->p_ucred, MNT_WAIT,
- curproc);
- }
- return (error);
+ return (UFS_UPDATE(oip, MNT_WAIT));
}
uvm_vnp_setsize(ovp, length);
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index 86618b22045..c42c64499bf 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_softdep.c,v 1.107 2011/07/04 20:35:35 deraadt Exp $ */
+/* $OpenBSD: ffs_softdep.c,v 1.108 2011/08/03 20:21:19 beck Exp $ */
/*
* Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -526,8 +526,6 @@ workitem_free(struct worklist *item)
STATIC struct workhead softdep_workitem_pending;
STATIC struct worklist *worklist_tail;
STATIC int num_on_worklist; /* number of worklist items to be processed */
-STATIC int num_indirdep; /* number of indirdep items to be processed */
-STATIC int max_indirdep; /* maximum number of indirdep items allowed */
STATIC int softdep_worklist_busy; /* 1 => trying to do unmount */
STATIC int softdep_worklist_req; /* serialized waiters */
STATIC int max_softdeps; /* maximum number of structs before slowdown */
@@ -1142,8 +1140,6 @@ top:
void
softdep_initialize(void)
{
- extern vsize_t bufkvm;
- max_indirdep = (int)bufkvm / MAXPHYS * 80 / 100;
bioops.io_start = softdep_disk_io_initiation;
bioops.io_complete = softdep_disk_write_complete;
@@ -1819,14 +1815,12 @@ setup_allocindir_phase2(struct buf *bp, struct inode *ip,
if (indirdep->ir_savebp != NULL)
brelse(newindirdep->ir_savebp);
WORKITEM_FREE(newindirdep, D_INDIRDEP);
- num_indirdep--;
}
if (indirdep)
break;
newindirdep = pool_get(&indirdep_pool, PR_WAITOK);
newindirdep->ir_list.wk_type = D_INDIRDEP;
newindirdep->ir_state = ATTACHED;
- num_indirdep++;
if (ip->i_ump->um_fstype == UM_UFS1)
newindirdep->ir_state |= UFS1FMT;
LIST_INIT(&newindirdep->ir_deplisthd);
@@ -2446,7 +2440,6 @@ indir_trunc(struct inode *ip, daddr64_t dbn, int level, daddr64_t lbn,
}
WORKLIST_REMOVE(wk);
WORKITEM_FREE(indirdep, D_INDIRDEP);
- num_indirdep--;
if (LIST_FIRST(&bp->b_dep) != NULL) {
FREE_LOCK(&lk);
panic("indir_trunc: dangling dep");
@@ -3288,7 +3281,6 @@ softdep_disk_io_initiation(struct buf *bp)
wk->wk_state &= ~ONWORKLIST;
LIST_REMOVE(wk, wk_list);
WORKITEM_FREE(indirdep, D_INDIRDEP);
- num_indirdep--;
FREE_LOCK(&lk);
brelse(sbp);
ACQUIRE_LOCK(&lk);
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 5465d05af64..94bd8788910 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vnops.c,v 1.65 2011/07/04 20:35:35 deraadt Exp $ */
+/* $OpenBSD: ffs_vnops.c,v 1.66 2011/08/03 20:21:19 beck Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */
/*
@@ -299,7 +299,6 @@ ffs_write(void *v)
daddr64_t lbn;
off_t osize;
int blkoffset, error, extended, flags, ioflag, resid, size, xfersize;
- extern int num_indirdep, max_indirdep;
extended = 0;
ioflag = ap->a_ioflag;
@@ -373,11 +372,7 @@ ffs_write(void *v)
if (uio->uio_offset + xfersize > DIP(ip, size)) {
DIP_ASSIGN(ip, size, uio->uio_offset + xfersize);
uvm_vnp_setsize(vp, DIP(ip, size));
- /* Are we extending into an indirect block? */
- if (bp->b_lblkno < NDADDR)
- extended = 1;
- else
- extended = 2;
+ extended = 1;
}
(void)uvm_vnp_uncache(vp);
@@ -421,20 +416,8 @@ ffs_write(void *v)
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
- } else if (resid > uio->uio_resid) {
- if (ioflag & IO_SYNC)
- error = UFS_UPDATE(ip, MNT_WAIT);
- if (DOINGSOFTDEP(vp) && num_indirdep > max_indirdep)
- if (extended > 1) {
- /*
- * If the number of pending indirect block
- * dependencies is sufficiently close to the
- * maximum number of simultaneously mappable
- * buffers force a sync on the vnode to prevent
- * buffer cache exhaustion.
- */
- VOP_FSYNC(vp, NULL, MNT_WAIT, p);
- }
+ } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) {
+ error = UFS_UPDATE(ip, MNT_WAIT);
}
return (error);
}