Page MenuHomeFreeBSD

D62343.1796546304.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62343.1796546304.diff

diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -151,6 +151,11 @@
&ffs_enxio_enable, 0,
"enable mapping of other disk I/O errors to ENXIO");
+static int ffs_sync_rounds = 10;
+SYSCTL_INT(_vfs_ffs, OID_AUTO, sync_rounds, CTLFLAG_RWTUN,
+ &ffs_sync_rounds, 0,
+ "Max async flush rounds before a suspending sync (0 disables)");
+
/*
* Return buffer with the contents of block "offset" from the beginning of
* directory "ip". If "res" is non-zero, fill it in with a pointer to the
@@ -1557,6 +1562,36 @@
return (allerror);
}
+static void
+ffs_sync_wait(struct mount *mp)
+{
+ struct vnode *vp, *mvp;
+ struct bufobj *bo;
+
+ MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
+ if (vp->v_type == VNON) {
+ VI_UNLOCK(vp);
+ continue;
+ }
+ bo = &vp->v_bufobj;
+
+ if (bo->bo_numoutput > 0) {
+ vholdl(vp);
+ VI_UNLOCK(vp);
+ BO_LOCK(bo);
+ bufobj_wwait(bo, 0, 0);
+ BO_UNLOCK(bo);
+ vdrop(vp);
+ } else {
+ VI_UNLOCK(vp);
+ }
+ }
+ bo = &VFSTOUFS(mp)->um_devvp->v_bufobj;
+ BO_LOCK(bo);
+ bufobj_wwait(bo, 0, 0);
+ BO_UNLOCK(bo);
+}
+
/*
* Go through the disk queues to initiate sandbagged IO;
* go through the inodes to write those that have been modified;
@@ -1581,6 +1616,9 @@
int softdep_deps;
int softdep_accdeps;
struct bufobj *bo;
+ int cur;
+ int prev;
+ int rounds;
suspend = 0;
suspended = 0;
@@ -1606,6 +1644,21 @@
if (waitfor == MNT_WAIT)
lockreq = LK_EXCLUSIVE;
lockreq |= LK_INTERLOCK;
+ if (suspend && MOUNTEDSOFTDEP(mp)) {
+ /*
+ * Push out dirty data in rounds without waiting on each
+ * vnode, so the MNT_WAIT pass below finds little to do.
+ */
+ softdep_get_depcounts(mp, &prev, &softdep_accdeps);
+ for (rounds = 0; rounds < ffs_sync_rounds; rounds++) {
+ ffs_sync(mp, MNT_NOWAIT);
+ ffs_sync_wait(mp);
+ softdep_get_depcounts(mp, &cur, &softdep_accdeps);
+ if (cur == 0 || cur >= prev)
+ break;
+ prev = cur;
+ }
+ }
loop:
/* Grab snapshot of secondary write counts */
MNT_ILOCK(mp);

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 6, 8:38 AM (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42203902
Default Alt Text
D62343.1796546304.diff (2 KB)

Event Timeline