summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_inode.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-12-13 08:30:35 +0000
committermckusick <mckusick@FreeBSD.org>2000-12-13 08:30:35 +0000
commitf52f7b670a2fea7aa297cd0d973be65d217d1218 (patch)
tree7c307a919a8334c1a3af17184318fffe6df5c542 /sys/ufs/ffs/ffs_inode.c
parente6a971ff0f9fc44c8852bba5a0e47e207e0812da (diff)
downloadFreeBSD-src-f52f7b670a2fea7aa297cd0d973be65d217d1218.zip
FreeBSD-src-f52f7b670a2fea7aa297cd0d973be65d217d1218.tar.gz
Preventing runaway kernel soft updates memory, take three.
Previously, the syncer process was the only process in the system that could process the soft updates background work list. If enough other processes were adding requests to that list, it would eventually grow without bound. Because some of the work list requests require vnodes to be locked, it was not generally safe to let random processes process the work list while they already held vnodes locked. By adding a flag to the work list queue processing function to indicate whether the calling process could safely lock vnodes, it becomes possible to co-opt other processes into helping out with the work list. Now when the worklist gets too large, other processes can safely help out by picking off those work requests that can be handled without locking a vnode, leaving only the small number of requests requiring a vnode lock for the syncer process. With this change, it appears possible to keep even the nastiest workloads under control. Submitted by: Paul Saab <ps@yahoo-inc.com>
Diffstat (limited to 'sys/ufs/ffs/ffs_inode.c')
-rw-r--r--sys/ufs/ffs/ffs_inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index a8ae464..a01c02c 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -182,7 +182,7 @@ ffs_truncate(vp, length, flags, cred, p)
ffs_snapremove(ovp);
ovp->v_lasta = ovp->v_clen = ovp->v_cstart = ovp->v_lastw = 0;
if (DOINGSOFTDEP(ovp)) {
- if (length > 0) {
+ if (length > 0 || softdep_slowdown(ovp)) {
/*
* If a file is only partially truncated, then
* we have to clean up the data structures
@@ -290,7 +290,7 @@ ffs_truncate(vp, length, flags, cred, p)
for (i = NDADDR - 1; i > lastblock; i--)
oip->i_db[i] = 0;
oip->i_flag |= IN_CHANGE | IN_UPDATE;
- allerror = UFS_UPDATE(ovp, ((length > 0) ? 0 : 1));
+ allerror = UFS_UPDATE(ovp, 1);
/*
* Having written the new inode to disk, save its new configuration
OpenPOWER on IntegriCloud