diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-02-21 23:24:33 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-02-21 23:24:33 +0000 |
commit | 33e6fbe33f4ec84f10016e81c87c7be89171378b (patch) | |
tree | 122cb8b58569496544bc77d618dec5e995a23b94 /sys/kern | |
parent | d0a302227eeedfb62540337fcbc0741756591d7c (diff) |
Latest soft updates from FreeBSD/Kirk McKusick
Snapshot-related code has been commented out.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_malloc.c | 9 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 16 | ||||
-rw-r--r-- | sys/kern/vfs_cluster.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 16 | ||||
-rw-r--r-- | sys/kern/vfs_sync.c | 35 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 9 |
6 files changed, 50 insertions, 41 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index d52ea29ef5e..6c2c7f3c046 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.23 2001/02/20 23:35:35 csapuntz Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.24 2001/02/21 23:24:29 csapuntz Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -135,11 +135,8 @@ malloc(size, type, flags) #endif #ifdef MALLOC_DEBUG - if (debug_malloc(size, type, flags, (void **)&va)) { - if ((flags & M_ZERO) && va != NULL) - bzero(va, size); + if (debug_malloc(size, type, flags, (void **)&va)) return ((void *) va); - } #endif indx = BUCKETINDX(size); @@ -312,8 +309,6 @@ out: out: #endif splx(s); - if ((flags & M_ZERO) && va != NULL) - bzero(va, size); return ((void *) va); } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 3021d4bbd0d..eae71abafb5 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.28 2001/02/13 19:51:49 art Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.29 2001/02/21 23:24:30 csapuntz Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -475,9 +475,9 @@ brelse(bp) * If it's invalid or empty, dissociate it from its vnode * and put on the head of the appropriate queue. */ - if (LIST_FIRST(&bp->b_dep) != NULL && bioops.io_deallocate) { - (*bioops.io_deallocate)(bp); - } + if (LIST_FIRST(&bp->b_dep) != NULL) + buf_deallocate(bp); + CLR(bp->b_flags, B_DELWRI); if (bp->b_vp) { reassignbuf(bp, bp->b_vp); @@ -787,8 +787,8 @@ start: splx(s); - if (LIST_FIRST(&bp->b_dep) != NULL && bioops.io_deallocate) - (*bioops.io_deallocate)(bp); + if (LIST_FIRST(&bp->b_dep) != NULL) + buf_deallocate(bp); /* clear out various other fields */ bp->b_flags = B_BUSY; @@ -866,8 +866,8 @@ biodone(bp) panic("biodone already"); SET(bp->b_flags, B_DONE); /* note that it's done */ - if (LIST_FIRST(&bp->b_dep) != NULL && bioops.io_complete) - (*bioops.io_complete)(bp); + if (LIST_FIRST(&bp->b_dep) != NULL) + buf_complete(bp); if (!ISSET(bp->b_flags, B_READ)) /* wake up reader */ vwakeup(bp); diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 0c433c72b83..1839e585f0f 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_cluster.c,v 1.17 2000/06/23 02:14:38 mickey Exp $ */ +/* $OpenBSD: vfs_cluster.c,v 1.18 2001/02/21 23:24:30 csapuntz Exp $ */ /* $NetBSD: vfs_cluster.c,v 1.12 1996/04/22 01:39:05 christos Exp $ */ /*- @@ -703,8 +703,8 @@ redo: tbp->b_flags &= ~(B_READ | B_DONE | B_ERROR | B_DELWRI); tbp->b_flags |= (B_ASYNC | B_AGE); - if (LIST_FIRST(&tbp->b_dep) != NULL && bioops.io_start) - (*bioops.io_start)(tbp); + if (LIST_FIRST(&tbp->b_dep) != NULL) + buf_start(tbp); pagemove(tbp->b_data, cp, size); bp->b_bcount += size; diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 0cb3e61cc4b..bee6b56c1ae 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.48 2001/02/08 00:32:11 mickey Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.49 2001/02/21 23:24:30 csapuntz Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -2209,3 +2209,17 @@ vfs_unregister(vfs) return 0; } + +/* + * Check if vnode represents a disk device + */ +int +vn_isdisk(vp, errp) + struct vnode *vp; + int *errp; +{ + if (vp->v_type != VBLK && vp->v_type != VCHR) + return (0); + + return (1); +} diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index 128866b8f69..d5c9fddf418 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.12 2000/03/23 15:57:33 art Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.13 2001/02/21 23:24:30 csapuntz Exp $ */ /* * Portions of this code are: @@ -55,6 +55,10 @@ #include <sys/kernel.h> +#ifdef FFS_SOFTUPDATES +int softdep_process_worklist __P((struct mount *)); +#endif + /* * The workitem queue. */ @@ -67,7 +71,7 @@ int rushjob = 0; /* number of slots to run ASAP */ int stat_rush_requests = 0; /* number of rush requests */ static int syncer_delayno = 0; -static long syncer_last; +static long syncer_mask; LIST_HEAD(synclist, vnode); static struct synclist *syncer_workitem_pending; @@ -105,16 +109,9 @@ void vn_initialize_syncerd() { - int i; - - syncer_last = SYNCER_MAXDELAY + 2; - - syncer_workitem_pending = - malloc(syncer_last * sizeof(struct synclist), - M_VNODE, M_WAITOK); - - for (i = 0; i < syncer_last; i++) - LIST_INIT(&syncer_workitem_pending[i]); + syncer_workitem_pending = hashinit(syncer_maxdelay, M_VNODE, M_WAITOK, + &syncer_mask); + syncer_maxdelay = syncer_mask + 1; } /* @@ -132,9 +129,10 @@ vn_syncer_add_to_worklist(vp, delay) if (vp->v_flag & VONSYNCLIST) LIST_REMOVE(vp, v_synclist); - if (delay > syncer_maxdelay) - delay = syncer_maxdelay; - slot = (syncer_delayno + delay) % syncer_last; + if (delay > syncer_maxdelay - 2) + delay = syncer_maxdelay - 2; + slot = (syncer_delayno + delay) & syncer_mask; + LIST_INSERT_HEAD(&syncer_workitem_pending[slot], vp, v_synclist); vp->v_flag |= VONSYNCLIST; splx(s); @@ -164,7 +162,7 @@ sched_sync(p) s = splbio(); slp = &syncer_workitem_pending[syncer_delayno]; syncer_delayno += 1; - if (syncer_delayno >= syncer_last) + if (syncer_delayno == syncer_maxdelay) syncer_delayno = 0; splx(s); while ((vp = LIST_FIRST(slp)) != NULL) { @@ -182,11 +180,12 @@ sched_sync(p) } } +#ifdef FFS_SOFTUPDATES /* * Do soft update processing. */ - if (bioops.io_sync) - (*bioops.io_sync)(NULL); + softdep_process_worklist(NULL); +#endif /* * The variable rushjob allows the kernel to speed up the diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index ec0f6bf9597..f74993737ae 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.67 2001/02/20 01:50:09 assar Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.68 2001/02/21 23:24:30 csapuntz Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -2280,9 +2280,10 @@ sys_fsync(p, v, retval) vp = (struct vnode *)fp->f_data; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); error = VOP_FSYNC(vp, fp->f_cred, MNT_WAIT, p); - if (error == 0 && bioops.io_fsync != NULL && - vp->v_mount && (vp->v_mount->mnt_flag & MNT_SOFTDEP)) - error = (*bioops.io_fsync)(vp); +#ifdef FFS_SOFTUPDATES + if (error == 0 && vp->v_mount && (vp->v_mount->mnt_flag & MNT_SOFTDEP)) + error = softdep_fsync(vp); +#endif VOP_UNLOCK(vp, 0, p); return (error); |