From 165dba5575bbe0f87eb39f34db8d20f2afe346f9 Mon Sep 17 00:00:00 2001 From: David Rhodus Date: Mon, 6 Jun 2005 15:09:38 +0000 Subject: [PATCH] Replace spl with critical sections. --- sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c | 8 ++---- sys/vfs/gnu/ext2fs/ext2_vnops.c | 11 ++++--- sys/vfs/gnu/ext2fs/fs.h | 12 ++++---- sys/vfs/mfs/mfs_vfsops.c | 13 +++++---- sys/vfs/mfs/mfs_vnops.c | 13 +++++---- sys/vfs/nfs/nfs_bio.c | 10 +++---- sys/vfs/nfs/nfs_nqlease.c | 23 ++++++++------- sys/vfs/nfs/nfs_serv.c | 33 ++++++++++----------- sys/vfs/nfs/nfs_socket.c | 40 ++++++++++++-------------- sys/vfs/nfs/nfs_subs.c | 7 ++--- sys/vfs/nfs/nfs_syscalls.c | 33 ++++++++++----------- sys/vfs/nfs/nfs_vfsops.c | 11 +++---- sys/vfs/nfs/nfs_vnops.c | 33 +++++++++++---------- sys/vfs/nwfs/nwfs_io.c | 9 +++--- sys/vfs/portal/portal_vnops.c | 11 +++---- sys/vfs/smbfs/smbfs_io.c | 9 +++--- sys/vfs/specfs/spec_vnops.c | 10 ++++--- sys/vfs/ufs/ffs_rawread.c | 28 +++++++++--------- sys/vfs/ufs/ffs_softdep.c | 18 ++++++------ 19 files changed, 166 insertions(+), 166 deletions(-) diff --git a/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c b/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c index 1b32f104df..a2aaef5e7a 100644 --- a/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c +++ b/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c @@ -5,7 +5,7 @@ * University of Utah, Department of Computer Science * * $FreeBSD: src/sys/gnu/ext2fs/ext2_linux_ialloc.c,v 1.13.2.2 2001/08/14 18:03:19 gallatin Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c,v 1.4 2003/08/07 21:17:41 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_linux_ialloc.c,v 1.5 2005/06/06 15:09:37 drhodus Exp $ */ /* * linux/fs/ext2/ialloc.c @@ -59,11 +59,9 @@ */ void mark_buffer_dirty(struct buf *bh) { - int s; - - s = splbio(); + crit_enter(); bh->b_flags |= B_DIRTY; - splx(s); + crit_exit(); } struct ext2_group_desc * get_group_desc (struct mount * mp, diff --git a/sys/vfs/gnu/ext2fs/ext2_vnops.c b/sys/vfs/gnu/ext2fs/ext2_vnops.c index c3b39da3a2..4985837a26 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vnops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vnops.c @@ -44,7 +44,7 @@ * @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95 * @(#)ext2_vnops.c 8.7 (Berkeley) 2/3/94 * $FreeBSD: src/sys/gnu/ext2fs/ext2_vnops.c,v 1.51.2.2 2003/01/02 17:26:18 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.20 2005/04/15 19:08:16 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/ext2_vnops.c,v 1.21 2005/06/06 15:09:37 drhodus Exp $ */ #include "opt_quota.h" @@ -182,7 +182,6 @@ static int ext2_fsync_bp(struct buf *bp, void *data); struct ext2_fsync_bp_info { struct vnode *vp; int waitfor; - int s; }; static int @@ -201,7 +200,7 @@ ext2_fsync(struct vop_fsync_args *ap) */ ext2_discard_prealloc(VTOI(vp)); - info.s = splbio(); + crit_enter(); info.vp = vp; loop: info.waitfor = ap->a_waitfor; @@ -222,7 +221,7 @@ loop: } #endif } - splx(info.s); + crit_exit(); return (UFS_UPDATE(ap->a_vp, ap->a_waitfor == MNT_WAIT)); } @@ -236,7 +235,7 @@ ext2_fsync_bp(struct buf *bp, void *data) if ((bp->b_flags & B_DELWRI) == 0) panic("ext2_fsync: not dirty"); bremfree(bp); - splx(info->s); + crit_exit(); /* * Wait for I/O associated with indirect blocks to complete, @@ -246,7 +245,7 @@ ext2_fsync_bp(struct buf *bp, void *data) (void) bawrite(bp); else (void) bwrite(bp); - info->s = splbio(); + crit_enter(); return(1); } diff --git a/sys/vfs/gnu/ext2fs/fs.h b/sys/vfs/gnu/ext2fs/fs.h index d709011a01..aca2144661 100644 --- a/sys/vfs/gnu/ext2fs/fs.h +++ b/sys/vfs/gnu/ext2fs/fs.h @@ -38,7 +38,7 @@ * * @(#)fs.h 8.7 (Berkeley) 4/19/94 * $FreeBSD: src/sys/gnu/ext2fs/fs.h,v 1.5.2.1 2000/11/11 13:12:45 bde Exp $ - * $DragonFly: src/sys/vfs/gnu/ext2fs/fs.h,v 1.5 2004/10/12 19:20:55 dillon Exp $ + * $DragonFly: src/sys/vfs/gnu/ext2fs/fs.h,v 1.6 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -162,22 +162,20 @@ extern u_char *fragtbl[]; * reset the B_LOCKED flag and brelse() the buffer back on the LRU list */ #define LCK_BUF(bp) { \ - int s; \ - s = splbio(); \ + crit_enter(); \ (bp)->b_flags |= B_LOCKED; \ - splx(s); \ + crit_exit(); \ brelse(bp); \ } #define ULCK_BUF(bp) { \ long flags; \ - int s; \ - s = splbio(); \ + crit_enter(); \ flags = (bp)->b_flags; \ (bp)->b_flags &= ~(B_DIRTY | B_LOCKED); \ BUF_LOCK(bp, LK_EXCLUSIVE); \ bremfree(bp); \ - splx(s); \ + crit_exit(); \ if (flags & B_DIRTY) \ bwrite(bp); \ else \ diff --git a/sys/vfs/mfs/mfs_vfsops.c b/sys/vfs/mfs/mfs_vfsops.c index ab38341a14..f17222d796 100644 --- a/sys/vfs/mfs/mfs_vfsops.c +++ b/sys/vfs/mfs/mfs_vfsops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vfsops.c,v 1.81.2.3 2001/07/04 17:35:21 tegge Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vfsops.c,v 1.21 2005/02/02 21:34:18 joerg Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vfsops.c,v 1.22 2005/06/06 15:09:38 drhodus Exp $ */ @@ -53,6 +53,8 @@ #include +#include + #include #include #include @@ -376,19 +378,18 @@ mfs_start(struct mount *mp, int flags, struct thread *td) PHOLD(curproc); while (mfsp->mfs_active) { - int s; - s = splbio(); + crit_enter(); while ((bp = bufq_first(&mfsp->buf_queue)) != NULL) { bufq_remove(&mfsp->buf_queue, bp); - splx(s); + crit_exit(); mfs_doio(bp, mfsp); wakeup((caddr_t)bp); - s = splbio(); + crit_enter(); } - splx(s); + crit_exit(); /* * If a non-ignored signal is received, try to unmount. diff --git a/sys/vfs/mfs/mfs_vnops.c b/sys/vfs/mfs/mfs_vnops.c index 91cfe7e0bc..1b32fd7256 100644 --- a/sys/vfs/mfs/mfs_vnops.c +++ b/sys/vfs/mfs/mfs_vnops.c @@ -32,7 +32,7 @@ * * @(#)mfs_vnops.c 8.11 (Berkeley) 5/22/95 * $FreeBSD: src/sys/ufs/mfs/mfs_vnops.c,v 1.47.2.1 2001/05/22 02:06:43 bp Exp $ - * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.17 2005/02/15 08:32:18 joerg Exp $ + * $DragonFly: src/sys/vfs/mfs/mfs_vnops.c,v 1.18 2005/06/06 15:09:38 drhodus Exp $ */ #include @@ -48,6 +48,8 @@ #include +#include + #include "mfsnode.h" #include "mfs_extern.h" @@ -166,7 +168,6 @@ mfs_strategy(struct vop_strategy_args *ap) struct buf *bp = ap->a_bp; struct mfsnode *mfsp; struct thread *td = curthread; /* XXX */ - int s; bp->b_dev = ap->a_vp->v_rdev; mfsp = bp->b_dev->si_drv1; @@ -182,7 +183,7 @@ mfs_strategy(struct vop_strategy_args *ap) * BPs from bio interrupts (?). It may not be necessary. */ - s = splbio(); + crit_enter(); if (mfsp->mfs_td == NULL) { /* @@ -203,9 +204,9 @@ mfs_strategy(struct vop_strategy_args *ap) /* * VOP to self */ - splx(s); + crit_exit(); mfs_doio(bp, mfsp); - s = splbio(); + crit_enter(); } else { /* * VOP from some other process, queue to MFS process and @@ -214,7 +215,7 @@ mfs_strategy(struct vop_strategy_args *ap) bufq_insert_tail(&mfsp->buf_queue, bp); wakeup((caddr_t)mfsp); } - splx(s); + crit_exit(); return (0); } diff --git a/sys/vfs/nfs/nfs_bio.c b/sys/vfs/nfs/nfs_bio.c index 78b7a2197a..d352b7df44 100644 --- a/sys/vfs/nfs/nfs_bio.c +++ b/sys/vfs/nfs/nfs_bio.c @@ -35,7 +35,7 @@ * * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 * $FreeBSD: /repoman/r/ncvs/src/sys/nfsclient/nfs_bio.c,v 1.130 2004/04/14 23:23:55 peadar Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_bio.c,v 1.22 2005/04/15 19:08:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_bio.c,v 1.23 2005/06/06 15:09:38 drhodus Exp $ */ @@ -58,6 +58,8 @@ #include #include +#include + #include "rpcv2.h" #include "nfsproto.h" #include "nfs.h" @@ -1524,9 +1526,7 @@ nfs_doio(struct buf *bp, struct thread *td) */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - - s = splbio(); + crit_enter(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_PAGING) == 0) { bdirty(bp); @@ -1534,7 +1534,7 @@ nfs_doio(struct buf *bp, struct thread *td) } if (error && (bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); + crit_exit(); } else { if (error) { bp->b_flags |= B_ERROR; diff --git a/sys/vfs/nfs/nfs_nqlease.c b/sys/vfs/nfs/nfs_nqlease.c index 6cc5b42e9b..9689e2fd4a 100644 --- a/sys/vfs/nfs/nfs_nqlease.c +++ b/sys/vfs/nfs/nfs_nqlease.c @@ -35,7 +35,7 @@ * * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_nqlease.c,v 1.50 2000/02/13 03:32:05 peter Exp $ - * $DragonFly: src/sys/vfs/nfs/Attic/nfs_nqlease.c,v 1.25 2005/04/19 17:54:48 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/Attic/nfs_nqlease.c,v 1.26 2005/06/06 15:09:38 drhodus Exp $ */ @@ -76,6 +76,8 @@ #include "nfsmount.h" #include "nfsnode.h" +#include + static MALLOC_DEFINE(M_NQMHOST, "NQNFS Host", "Nqnfs host address table"); time_t nqnfsstarttime = (time_t)0; @@ -181,7 +183,7 @@ nqsrv_getlease(struct vnode *vp, u_int32_t *duration, int flags, struct nqm **lphp; struct vattr vattr; fhandle_t fh; - int i, ok, error, s; + int i, ok, error; if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK) return (0); @@ -191,7 +193,7 @@ nqsrv_getlease(struct vnode *vp, u_int32_t *duration, int flags, if (error) return (error); *frev = vattr.va_filerev; - s = splsoftclock(); + crit_enter(); tlp = vp->v_lease; if ((flags & ND_CHECK) == 0) nfsstats.srvnqnfs_getleases++; @@ -202,7 +204,7 @@ nqsrv_getlease(struct vnode *vp, u_int32_t *duration, int flags, fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(vp, &fh.fh_fid); if (error) { - splx(s); + crit_exit(); return (error); } lpp = NQFHHASH(fh.fh_fid.fid_data); @@ -281,10 +283,10 @@ doreply: if (flags & ND_WRITE) lp->lc_flag |= LC_WRITTEN; } - splx(s); + crit_exit(); return (0); } - splx(s); + crit_exit(); if (flags & ND_CHECK) return (0); @@ -312,9 +314,9 @@ doreply: panic("nfs_nqlease.c: Phoney lpp"); LIST_INSERT_HEAD(lpp, lp, lc_hash); vp->v_lease = lp; - s = splsoftclock(); + crit_enter(); nqsrv_instimeq(lp, *duration); - splx(s); + crit_exit(); *cachablep = 1; if (++nfsstats.srvnqnfs_leases > nfsstats.srvnqnfs_maxleases) nfsstats.srvnqnfs_maxleases = nfsstats.srvnqnfs_leases; @@ -1144,15 +1146,14 @@ void nqnfs_lease_updatetime(int deltat) { struct nqlease *lp; - int s; if (nqnfsstarttime != 0) nqnfsstarttime += deltat; - s = splsoftclock(); + crit_enter(); for (lp = nqtimerhead.cqh_first; lp != (void *)&nqtimerhead; lp = lp->lc_timer.cqe_next) lp->lc_expiry += deltat; - splx(s); + crit_exit(); /* * Search the mount list for all nqnfs mounts and do their timer diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 318f5cfaec..297b19775c 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -35,7 +35,7 @@ * * @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95 * $FreeBSD: src/sys/nfs/nfs_serv.c,v 1.93.2.6 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.23 2005/05/29 10:08:36 hsu Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_serv.c,v 1.24 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -88,6 +88,8 @@ #include +#include + #include "nfsproto.h" #include "rpcv2.h" #include "nfs.h" @@ -1190,7 +1192,7 @@ nfsrv_writegather(struct nfsrv_descript **ndp, struct nfssvc_sock *slp, int32_t t1; caddr_t bpos, dpos; int error = 0, rdonly, cache, len, forat_ret = 1; - int ioflags, aftat_ret = 1, s, adjust, v3, zeroing; + int ioflags, aftat_ret = 1, adjust, v3, zeroing; char *cp2; struct mbuf *mb, *mb2, *mreq, *mrep, *md; struct vnode *vp = NULL; @@ -1279,7 +1281,7 @@ nfsmout: /* * Add this entry to the hash and time queues. */ - s = splsoftclock(); + crit_enter(); owp = NULL; wp = slp->ns_tq.lh_first; while (wp && wp->nd_time < nfsd->nd_time) { @@ -1322,7 +1324,7 @@ nfsmout: LIST_INSERT_HEAD(wpp, nfsd, nd_hash); } } - splx(s); + crit_exit(); } /* @@ -1331,7 +1333,7 @@ nfsmout: */ loop1: cur_usec = nfs_curusec(); - s = splsoftclock(); + crit_enter(); for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = owp) { owp = nfsd->nd_tq.le_next; if (nfsd->nd_time > cur_usec) @@ -1341,7 +1343,7 @@ loop1: NFS_DPF(WG, ("P%03x", nfsd->nd_retxid & 0xfff)); LIST_REMOVE(nfsd, nd_tq); LIST_REMOVE(nfsd, nd_hash); - splx(s); + crit_exit(); mrep = nfsd->nd_mrep; nfsd->nd_mrep = NULL; cred = &nfsd->nd_cr; @@ -1454,7 +1456,7 @@ loop1: * Done. Put it at the head of the timer queue so that * the final phase can return the reply. */ - s = splsoftclock(); + crit_enter(); if (nfsd != swp) { nfsd->nd_time = 0; LIST_INSERT_HEAD(&slp->ns_tq, nfsd, nd_tq); @@ -1463,20 +1465,20 @@ loop1: if (nfsd) { LIST_REMOVE(nfsd, nd_tq); } - splx(s); + crit_exit(); } while (nfsd); - s = splsoftclock(); + crit_enter(); swp->nd_time = 0; LIST_INSERT_HEAD(&slp->ns_tq, swp, nd_tq); - splx(s); + crit_exit(); goto loop1; } - splx(s); + crit_exit(); /* * Search for a reply to return. */ - s = splsoftclock(); + crit_enter(); for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = nfsd->nd_tq.le_next) if (nfsd->nd_mreq) { NFS_DPF(WG, ("X%03x", nfsd->nd_retxid & 0xfff)); @@ -1485,7 +1487,7 @@ loop1: *ndp = nfsd; break; } - splx(s); + crit_exit(); return (0); } @@ -3496,7 +3498,6 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, */ int iosize = vp->v_mount->mnt_stat.f_iosize; int iomask = iosize - 1; - int s; daddr_t lblkno; /* @@ -3517,7 +3518,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, vm_object_page_clean(vp->v_object, off / PAGE_SIZE, (cnt + PAGE_MASK) / PAGE_SIZE, OBJPC_SYNC); } - s = splbio(); + crit_enter(); while (cnt > 0) { struct buf *bp; @@ -3542,7 +3543,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, cnt -= iosize; ++lblkno; } - splx(s); + crit_exit(); } aft_ret = VOP_GETATTR(vp, &aft, td); diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index c0cb85f48f..722789d046 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -35,7 +35,7 @@ * * @(#)nfs_socket.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_socket.c,v 1.60.2.6 2003/03/26 01:44:46 alfred Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.27 2005/05/29 10:08:36 hsu Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_socket.c,v 1.28 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -205,7 +205,7 @@ int nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) { struct socket *so; - int s, error, rcvreserve, sndreserve; + int error, rcvreserve, sndreserve; int pktscale; struct sockaddr *saddr; struct sockaddr_in *sin; @@ -278,7 +278,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) * connect system call but with the wait timing out so * that interruptible mounts don't hang here for a long time. */ - s = splnet(); + crit_enter(); while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { (void) tsleep((caddr_t)&so->so_timeo, 0, "nfscon", 2 * hz); @@ -286,17 +286,17 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) so->so_error == 0 && rep && (error = nfs_sigintr(nmp, rep, rep->r_td)) != 0){ so->so_state &= ~SS_ISCONNECTING; - splx(s); + crit_exit(); goto bad; } } if (so->so_error) { error = so->so_error; so->so_error = 0; - splx(s); + crit_exit(); goto bad; } - splx(s); + crit_exit(); } so->so_rcv.sb_timeo = (5 * hz); so->so_snd.sb_timeo = (5 * hz); @@ -935,7 +935,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum, char nickv[RPCX_NICKVERF]; time_t reqtime, waituntil; caddr_t dpos, cp2; - int t1, nqlflag, cachable, s, error = 0, mrest_len, auth_len, auth_type; + int t1, nqlflag, cachable, error = 0, mrest_len, auth_len, auth_type; int trylater_delay = NQ_TRYLATERDEL, trylater_cnt = 0, failed_auth = 0; int verf_len, verf_type; u_int32_t xid; @@ -1034,7 +1034,7 @@ tryagain: * it below. splsoftclock() primarily protects nm_sent. Note * that we may block in this code so there is no atomicy guarentee. */ - s = splsoftclock(); + crit_enter(); TAILQ_INSERT_TAIL(&nfs_reqq, rep, r_chain); /* Get send time for nqnfs */ @@ -1069,14 +1069,14 @@ tryagain: * wait for the reply from our send or the timer's. */ rep->r_flags &= ~R_MASKTIMER; - splx(s); + crit_exit(); if (!error || error == EPIPE) error = nfs_reply(rep); /* * RPC done, unlink the request. */ - s = splsoftclock(); + crit_enter(); TAILQ_REMOVE(&nfs_reqq, rep, r_chain); /* @@ -1086,7 +1086,7 @@ tryagain: rep->r_flags &= ~R_SENT; nmp->nm_sent -= NFS_CWNDSCALE; } - splx(s); + crit_exit(); /* * If there was a successful reply and a tprintf msg. @@ -1373,7 +1373,7 @@ nfs_timer(void *arg /* never used */) struct socket *so; struct nfsmount *nmp; int timeo; - int s, error; + int error; #ifndef NFS_NOSERVER static long lasttime = 0; struct nfssvc_sock *slp; @@ -1381,7 +1381,7 @@ nfs_timer(void *arg /* never used */) #endif /* NFS_NOSERVER */ struct thread *td = &thread0; /* XXX for credentials, will break if sleep */ - s = splnet(); + crit_enter(); TAILQ_FOREACH(rep, &nfs_reqq, r_chain) { nmp = rep->r_nmp; if (rep->r_mrep || (rep->r_flags & (R_SOFTTERM|R_MASKTIMER))) @@ -1487,7 +1487,7 @@ nfs_timer(void *arg /* never used */) nfsrv_wakenfsd(slp, 1); } #endif /* NFS_NOSERVER */ - splx(s); + crit_exit(); callout_reset(&nfs_timer_handle, nfs_ticks, nfs_timer, NULL); } @@ -1500,26 +1500,24 @@ int nfs_nmcancelreqs(struct nfsmount *nmp) { struct nfsreq *req; - int i, s1, s2; + int i; - s1 = splnet(); - s2 = splsoftclock(); + crit_enter(); TAILQ_FOREACH(req, &nfs_reqq, r_chain) { if (nmp != req->r_nmp || req->r_mrep != NULL || (req->r_flags & R_SOFTTERM)) continue; nfs_softterm(req); } - splx(s2); - splx(s1); + crit_exit(); for (i = 0; i < 30; i++) { - int s = splnet(); + crit_enter(); TAILQ_FOREACH(req, &nfs_reqq, r_chain) { if (nmp == req->r_nmp) break; } - splx(s); + crit_exit(); if (req == NULL) return (0); tsleep(&lbolt, 0, "nfscancel", 0); diff --git a/sys/vfs/nfs/nfs_subs.c b/sys/vfs/nfs/nfs_subs.c index 758c2bf064..3c9b523294 100644 --- a/sys/vfs/nfs/nfs_subs.c +++ b/sys/vfs/nfs/nfs_subs.c @@ -35,7 +35,7 @@ * * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95 * $FreeBSD: /repoman/r/ncvs/src/sys/nfsclient/nfs_subs.c,v 1.128 2004/04/14 23:23:55 peadar Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.30 2005/05/29 10:08:36 hsu Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_subs.c,v 1.31 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -2066,16 +2066,15 @@ nfs_clearcommit(struct mount *mp) { struct vnode *vp, *nvp; lwkt_tokref ilock; - int s; lwkt_gettoken(&ilock, &mntvnode_token); - s = splbio(); + crit_enter(); for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp; vp = nvp) { nvp = TAILQ_NEXT(vp, v_nmntvnodes); /* ZZZ */ RB_SCAN(buf_rb_tree, &vp->v_rbdirty_tree, NULL, nfs_clearcommit_bp, NULL); } - splx(s); + crit_exit(); lwkt_reltoken(&ilock); } diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index bb34a8a529..578803490f 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -35,7 +35,7 @@ * * @(#)nfs_syscalls.c 8.5 (Berkeley) 3/30/95 * $FreeBSD: src/sys/nfs/nfs_syscalls.c,v 1.58.2.1 2000/11/26 02:30:06 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.20 2005/03/27 23:51:42 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_syscalls.c,v 1.21 2005/06/06 15:09:38 drhodus Exp $ */ #include @@ -72,6 +72,8 @@ #include "nqnfs.h" #include "nfsrtt.h" +#include + static MALLOC_DEFINE(M_NFSSVC, "NFS srvsock", "Nfs server structure"); /* Global defs. */ @@ -326,7 +328,7 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) int siz; struct nfssvc_sock *slp; struct socket *so; - int error, s; + int error; so = (struct socket *)fp->f_data; #if 0 @@ -414,13 +416,13 @@ nfssvc_addsock(struct file *fp, struct sockaddr *mynam, struct thread *td) slp->ns_nam = mynam; fp->f_count++; slp->ns_fp = fp; - s = splnet(); + crit_enter(); so->so_upcallarg = (caddr_t)slp; so->so_upcall = nfsrv_rcv; so->so_rcv.sb_flags |= SB_UPCALL; slp->ns_flag = (SLP_VALID | SLP_NEEDQ); nfsrv_wakenfsd(slp, 1); - splx(s); + crit_exit(); return (0); } @@ -436,7 +438,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) struct nfsd *nfsd = nsd->nsd_nfsd; struct nfsrv_descript *nd = NULL; struct mbuf *m, *mreq; - int error = 0, cacherep, s, sotype, writes_todo; + int error = 0, cacherep, sotype, writes_todo; int procrastinate; u_quad_t cur_usec; @@ -448,12 +450,12 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) nsd->nsd_nfsd = nfsd = (struct nfsd *) malloc(sizeof (struct nfsd), M_NFSD, M_WAITOK); bzero((caddr_t)nfsd, sizeof (struct nfsd)); - s = splnet(); + crit_enter(); nfsd->nfsd_td = td; TAILQ_INSERT_TAIL(&nfsd_head, nfsd, nfsd_chain); nfs_numnfsd++; } else - s = splnet(); + crit_enter(); /* * Loop getting rpc requests until SIGKILL. @@ -520,7 +522,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) nfsrv_slpderef(slp); continue; } - splx(s); + crit_exit(); sotype = slp->ns_so->so_type; if (nd) { getmicrotime(&nd->nd_starttime); @@ -670,7 +672,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) if (error == EINTR || error == ERESTART) { free((caddr_t)nd, M_NFSRVDESC); nfsrv_slpderef(slp); - s = splnet(); + crit_enter(); goto done; } break; @@ -692,16 +694,16 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) * need to be serviced. */ cur_usec = nfs_curusec(); - s = splsoftclock(); + crit_enter(); if (slp->ns_tq.lh_first && slp->ns_tq.lh_first->nd_time <= cur_usec) { cacherep = RC_DOIT; writes_todo = 1; } else writes_todo = 0; - splx(s); + crit_exit(); } while (writes_todo); - s = splnet(); + crit_enter(); if (nfsrv_dorec(slp, nfsd, &nd)) { nfsd->nfsd_flag &= ~NFSD_REQINPROG; nfsd->nfsd_slp = NULL; @@ -710,7 +712,7 @@ nfssvc_nfsd(struct nfsd_srvargs *nsd, caddr_t argp, struct thread *td) } done: TAILQ_REMOVE(&nfsd_head, nfsd, nfsd_chain); - splx(s); + crit_exit(); free((caddr_t)nfsd, M_NFSD); nsd->nsd_nfsd = (struct nfsd *)0; if (--nfs_numnfsd == 0) @@ -733,7 +735,6 @@ nfsrv_zapsock(struct nfssvc_sock *slp) struct socket *so; struct file *fp; struct nfsrv_rec *rec; - int s; slp->ns_flag &= ~SLP_ALLFLAGS; fp = slp->ns_fp; @@ -764,14 +765,14 @@ nfsrv_zapsock(struct nfssvc_sock *slp) FREE(nuidp->nu_nam, M_SONAME); free((caddr_t)nuidp, M_NFSUID); } - s = splsoftclock(); + crit_enter(); for (nwp = slp->ns_tq.lh_first; nwp; nwp = nnwp) { nnwp = nwp->nd_tq.le_next; LIST_REMOVE(nwp, nd_tq); free((caddr_t)nwp, M_NFSRVDESC); } LIST_INIT(&slp->ns_tq); - splx(s); + crit_exit(); } } diff --git a/sys/vfs/nfs/nfs_vfsops.c b/sys/vfs/nfs/nfs_vfsops.c index 76b2e3012b..66b38f9330 100644 --- a/sys/vfs/nfs/nfs_vfsops.c +++ b/sys/vfs/nfs/nfs_vfsops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95 * $FreeBSD: src/sys/nfs/nfs_vfsops.c,v 1.91.2.7 2003/01/27 20:04:08 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.26 2005/04/15 19:08:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vfsops.c,v 1.27 2005/06/06 15:09:38 drhodus Exp $ */ #include "opt_bootp.h" @@ -61,6 +61,8 @@ #include #include +#include + #include "rpcv2.h" #include "nfsproto.h" #include "nfs.h" @@ -456,7 +458,7 @@ nfs_mountroot(mp) /* * XXX splnet, so networks will receive... */ - splnet(); + crit_enter(); #ifdef notyet /* Set up swap credentials. */ @@ -633,11 +635,10 @@ nfs_decode_args(nmp, argp) struct nfsmount *nmp; struct nfs_args *argp; { - int s; int adjsock; int maxio; - s = splnet(); + crit_enter(); /* * Silently clear NFSMNT_NOCONN if it's a TCP mount, it makes * no sense in that context. @@ -658,7 +659,7 @@ nfs_decode_args(nmp, argp) /* Update flags atomically. Don't change the lock bits. */ nmp->nm_flag = argp->flags | nmp->nm_flag; - splx(s); + crit_exit(); if ((argp->flags & NFSMNT_TIMEO) && argp->timeo > 0) { nmp->nm_timeo = (argp->timeo * NFS_HZ + 5) / 10; diff --git a/sys/vfs/nfs/nfs_vnops.c b/sys/vfs/nfs/nfs_vnops.c index 83791cf52c..5d1abc9977 100644 --- a/sys/vfs/nfs/nfs_vnops.c +++ b/sys/vfs/nfs/nfs_vnops.c @@ -35,7 +35,7 @@ * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 * $FreeBSD: src/sys/nfs/nfs_vnops.c,v 1.150.2.5 2001/12/20 19:56:28 dillon Exp $ - * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.40 2005/04/15 19:08:21 dillon Exp $ + * $DragonFly: src/sys/vfs/nfs/nfs_vnops.c,v 1.41 2005/06/06 15:09:38 drhodus Exp $ */ @@ -86,6 +86,8 @@ #include #include +#include + /* Defs */ #define TRUE 1 #define FALSE 0 @@ -3016,12 +3018,11 @@ nfs_flush_bp(struct buf *bp, void *data) struct nfs_flush_info *info = data; off_t toff; int error; - int s; error = 0; switch(info->mode) { case NFI_FLUSHNEW: - s = splbio(); + crit_enter(); if (info->loops && info->waitfor == MNT_WAIT) { error = BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT); if (error) { @@ -3038,16 +3039,16 @@ nfs_flush_bp(struct buf *bp, void *data) panic("nfs_fsync: not dirty"); if (bp->b_flags & B_NEEDCOMMIT) { BUF_UNLOCK(bp); - splx(s); + crit_exit(); break; } bremfree(bp); bp->b_flags |= B_ASYNC; - splx(s); + crit_exit(); VOP_BWRITE(bp->b_vp, bp); } else { - splx(s); + crit_exit(); error = 0; } break; @@ -3058,11 +3059,11 @@ nfs_flush_bp(struct buf *bp, void *data) * committed, but the normal flush loop will block on the * same buffer so we shouldn't get into an endless loop. */ - s = splbio(); + crit_enter(); if ((bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) != (B_DELWRI | B_NEEDCOMMIT) || BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - splx(s); + crit_exit(); break; } @@ -3091,7 +3092,7 @@ nfs_flush_bp(struct buf *bp, void *data) error = nfs_flush_docommit(info, 0); KKASSERT(info->bvsize == 0); } - splx(s); + crit_exit(); } return (error); } @@ -3105,7 +3106,6 @@ nfs_flush_docommit(struct nfs_flush_info *info, int error) off_t bytes; int retv; int i; - int s; vp = info->vp; @@ -3149,13 +3149,13 @@ nfs_flush_docommit(struct nfs_flush_info *info, int error) * specific. We should probably move that * into bundirty(). XXX */ - s = splbio(); + crit_enter(); vp->v_numoutput++; bp->b_flags |= B_ASYNC; bundirty(bp); bp->b_flags &= ~(B_READ|B_DONE|B_ERROR); bp->b_dirtyoff = bp->b_dirtyend = 0; - splx(s); + crit_exit(); biodone(bp); } } @@ -3223,7 +3223,6 @@ nfs_bwrite(struct vop_bwrite_args *ap) int nfs_writebp(struct buf *bp, int force, struct thread *td) { - int s; int oldflags = bp->b_flags; #if 0 int retv = 1; @@ -3244,12 +3243,12 @@ nfs_writebp(struct buf *bp, int force, struct thread *td) * Undirty the bp. We will redirty it later if the I/O fails. */ - s = splbio(); + crit_enter(); bundirty(bp); bp->b_flags &= ~(B_READ|B_DONE|B_ERROR); bp->b_vp->v_numoutput++; - splx(s); + crit_exit(); /* * Note: to avoid loopback deadlocks, we do not @@ -3264,9 +3263,9 @@ nfs_writebp(struct buf *bp, int force, struct thread *td) int rtval = biowait(bp); if (oldflags & B_DELWRI) { - s = splbio(); + crit_enter(); reassignbuf(bp, bp->b_vp); - splx(s); + crit_exit(); } brelse(bp); diff --git a/sys/vfs/nwfs/nwfs_io.c b/sys/vfs/nwfs/nwfs_io.c index 122745e7eb..ec7699fd58 100644 --- a/sys/vfs/nwfs/nwfs_io.c +++ b/sys/vfs/nwfs/nwfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_io.c,v 1.6.2.1 2000/10/25 02:11:10 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.15 2005/04/15 19:08:24 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.16 2005/06/06 15:09:38 drhodus Exp $ * */ #include @@ -57,6 +57,8 @@ #include #include +#include + #include "nwfs.h" #include "nwfs_node.h" #include "nwfs_subr.h" @@ -332,9 +334,8 @@ nwfs_doio(struct buf *bp, struct ucred *cr, struct thread *td) */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - s = splbio(); + crit_enter(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; @@ -344,7 +345,7 @@ nwfs_doio(struct buf *bp, struct ucred *cr, struct thread *td) } if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); + crit_exit(); } else { if (error) { bp->b_flags |= B_ERROR; diff --git a/sys/vfs/portal/portal_vnops.c b/sys/vfs/portal/portal_vnops.c index 4151c6008f..7c568aa360 100644 --- a/sys/vfs/portal/portal_vnops.c +++ b/sys/vfs/portal/portal_vnops.c @@ -36,7 +36,7 @@ * @(#)portal_vnops.c 8.14 (Berkeley) 5/21/95 * * $FreeBSD: src/sys/miscfs/portal/portal_vnops.c,v 1.38 1999/12/21 06:29:00 chris Exp $ - * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.20 2005/04/20 19:38:22 hsu Exp $ + * $DragonFly: src/sys/vfs/portal/portal_vnops.c,v 1.21 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -65,6 +65,8 @@ #include #include "portal.h" +#include + static int portal_fileid = PORTAL_ROOTFILEID+1; static int portal_badop (void); @@ -208,7 +210,6 @@ portal_open(struct vop_open_args *ap) struct portalnode *pt; struct thread *td = ap->a_td; struct vnode *vp = ap->a_vp; - int s; struct uio auio; struct iovec aiov[2]; int res; @@ -276,16 +277,16 @@ portal_open(struct vop_open_args *ap) * will happen if the server dies. Sleep for 5 second intervals * and keep polling the reference count. XXX. */ - s = splnet(); + crit_enter(); while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { if (fmp->pm_server->f_count == 1) { error = ECONNREFUSED; - splx(s); + crit_exit(); goto bad; } (void) tsleep((caddr_t) &so->so_timeo, 0, "portalcon", 5 * hz); } - splx(s); + crit_exit(); if (so->so_error) { error = so->so_error; diff --git a/sys/vfs/smbfs/smbfs_io.c b/sys/vfs/smbfs/smbfs_io.c index bd66354b2a..603ee6dbac 100644 --- a/sys/vfs/smbfs/smbfs_io.c +++ b/sys/vfs/smbfs/smbfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_io.c,v 1.3.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.16 2005/04/15 19:08:26 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.17 2005/06/06 15:09:38 drhodus Exp $ * */ #include @@ -65,6 +65,8 @@ #include +#include + /*#define SMBFS_RWGENERIC*/ extern int smbfs_pbuf_freecnt; @@ -360,9 +362,8 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td) */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - int s; - s = splbio(); + crit_enter(); bp->b_flags &= ~(B_INVAL|B_NOCACHE); if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; @@ -372,7 +373,7 @@ smbfs_doio(struct buf *bp, struct ucred *cr, struct thread *td) } if ((bp->b_flags & B_ASYNC) == 0) bp->b_flags |= B_EINTR; - splx(s); + crit_exit(); } else { if (error) { bp->b_flags |= B_ERROR; diff --git a/sys/vfs/specfs/spec_vnops.c b/sys/vfs/specfs/spec_vnops.c index b69efb53d4..eaf75e7d32 100644 --- a/sys/vfs/specfs/spec_vnops.c +++ b/sys/vfs/specfs/spec_vnops.c @@ -32,7 +32,7 @@ * * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95 * $FreeBSD: src/sys/miscfs/specfs/spec_vnops.c,v 1.131.2.4 2001/02/26 04:23:20 jlemon Exp $ - * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.24 2005/04/15 19:08:29 dillon Exp $ + * $DragonFly: src/sys/vfs/specfs/spec_vnops.c,v 1.25 2005/06/06 15:09:38 drhodus Exp $ */ #include @@ -56,6 +56,8 @@ #include +#include + static int spec_advlock (struct vop_advlock_args *); static int spec_bmap (struct vop_bmap_args *); static int spec_close (struct vop_close_args *); @@ -632,7 +634,7 @@ spec_getpages(struct vop_getpages_args *ap) { vm_offset_t kva; int error; - int i, pcount, size, s; + int i, pcount, size; daddr_t blkno; struct buf *bp; vm_page_t m; @@ -711,14 +713,14 @@ spec_getpages(struct vop_getpages_args *ap) /* Do the input. */ VOP_STRATEGY(bp->b_vp, bp); - s = splbio(); + crit_enter(); /* We definitely need to be at splbio here. */ while ((bp->b_flags & B_DONE) == 0) { tsleep(bp, 0, "spread", 0); } - splx(s); + crit_exit(); if ((bp->b_flags & B_ERROR) != 0) { if (bp->b_error) diff --git a/sys/vfs/ufs/ffs_rawread.c b/sys/vfs/ufs/ffs_rawread.c index 85cce83f67..2a719067cd 100644 --- a/sys/vfs/ufs/ffs_rawread.c +++ b/sys/vfs/ufs/ffs_rawread.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/ufs/ffs/ffs_rawread.c,v 1.3.2.2 2003/05/29 06:15:35 alc Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_rawread.c,v 1.10 2005/04/15 19:08:32 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_rawread.c,v 1.11 2005/06/06 15:09:38 drhodus Exp $ */ #include @@ -91,16 +91,15 @@ ffs_rawread_setup(void) static int ffs_rawread_sync(struct vnode *vp, struct thread *td) { - int spl; int error; int upgraded; /* Check for dirty mmap, pending writes and dirty buffers */ - spl = splbio(); + crit_enter(); if (vp->v_numoutput > 0 || !RB_EMPTY(&vp->v_rbdirty_tree) || (vp->v_flag & VOBJDIRTY) != 0) { - splx(spl); + crit_exit(); if (VOP_ISLOCKED(vp, td) != LK_EXCLUSIVE) { upgraded = 1; @@ -117,13 +116,13 @@ ffs_rawread_sync(struct vnode *vp, struct thread *td) } /* Wait for pending writes to complete */ - spl = splbio(); + crit_enter(); while (vp->v_numoutput) { vp->v_flag |= VBWAIT; error = tsleep((caddr_t)&vp->v_numoutput, 0, "rawrdfls", 0); if (error != 0) { - splx(spl); + crit_exit(); if (upgraded != 0) VOP_LOCK(vp, LK_DOWNGRADE, td); return (error); @@ -131,22 +130,22 @@ ffs_rawread_sync(struct vnode *vp, struct thread *td) } /* Flush dirty buffers */ if (!RB_EMPTY(&vp->v_rbdirty_tree)) { - splx(spl); + crit_exit(); if ((error = VOP_FSYNC(vp, MNT_WAIT, td)) != 0) { if (upgraded != 0) VOP_LOCK(vp, LK_DOWNGRADE, td); return (error); } - spl = splbio(); + crit_enter(); if (vp->v_numoutput > 0 || !RB_EMPTY(&vp->v_rbdirty_tree)) panic("ffs_rawread_sync: dirty bufs"); } - splx(spl); + crit_exit(); if (upgraded != 0) VOP_LOCK(vp, LK_DOWNGRADE, td); } else { - splx(spl); + crit_exit(); } return 0; } @@ -237,7 +236,6 @@ ffs_rawread_main(struct vnode *vp, struct uio *uio) struct buf *bp, *nbp, *tbp; caddr_t sa, nsa, tsa; uint iolen; - int spl; int baseticks = ticks; caddr_t udata; long resid; @@ -300,11 +298,11 @@ ffs_rawread_main(struct vnode *vp, struct uio *uio) } } - spl = splbio(); + crit_enter(); while ((bp->b_flags & B_DONE) == 0) { tsleep((caddr_t)bp, 0, "rawrd", 0); } - splx(spl); + crit_exit(); vunmapbuf(bp); @@ -367,11 +365,11 @@ ffs_rawread_main(struct vnode *vp, struct uio *uio) if (bp != NULL) relpbuf(bp, &ffsrawbufcnt); if (nbp != NULL) { /* Run down readahead buffer */ - spl = splbio(); + crit_enter(); while ((nbp->b_flags & B_DONE) == 0) { tsleep((caddr_t)nbp, 0, "rawrd", 0); } - splx(spl); + crit_exit(); vunmapbuf(nbp); relpbuf(nbp, &ffsrawbufcnt); } diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index a1f443d5c0..002d699fd9 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -37,7 +37,7 @@ * * from: @(#)ffs_softdep.c 9.59 (McKusick) 6/21/00 * $FreeBSD: src/sys/ufs/ffs/ffs_softdep.c,v 1.57.2.11 2002/02/05 18:46:53 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.23 2005/04/19 17:54:50 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ffs_softdep.c,v 1.24 2005/06/06 15:09:38 drhodus Exp $ */ /* @@ -70,6 +70,8 @@ #include "ffs_extern.h" #include "ufs_extern.h" +#include + /* * These definitions need to be adapted to the system to which * this file is being ported. @@ -230,10 +232,9 @@ static struct bio_ops softdep_bioops = { */ #ifndef /* NOT */ DEBUG static struct lockit { - int lkt_spl; } lk = { 0 }; -#define ACQUIRE_LOCK(lk) (lk)->lkt_spl = splbio() -#define FREE_LOCK(lk) splx((lk)->lkt_spl) +#define ACQUIRE_LOCK(lk) crit_enter(); +#define FREE_LOCK(lk) crit_exit(); #else /* DEBUG */ #define NOHOLDER ((struct thread *)-1) @@ -265,7 +266,7 @@ acquire_lock(lk) else panic("softdep_lock: lock held by %p", holder); } - lk->lkt_spl = splbio(); + crit_enter(); lk->lkt_held = curthread; lockcnt++; } @@ -278,7 +279,7 @@ free_lock(lk) if (lk->lkt_held == NOHOLDER) panic("softdep_unlock: lock not held"); lk->lkt_held = NOHOLDER; - splx(lk->lkt_spl); + crit_exit(); } /* @@ -4617,7 +4618,6 @@ request_cleanup(resource, islocked) int islocked; { struct thread *td = curthread; /* XXX */ - int s; /* * We never hold up the filesystem syncer process. @@ -4677,7 +4677,7 @@ request_cleanup(resource, islocked) */ if (islocked == 0) ACQUIRE_LOCK(&lk); - s = splsoftclock(); + crit_enter(); proc_waiting += 1; if (!callout_active(&handle)) callout_reset(&handle, tickdelay > 2 ? tickdelay : 2, @@ -4685,7 +4685,7 @@ request_cleanup(resource, islocked) interlocked_sleep(&lk, SLEEP, (caddr_t)&proc_waiting, 0, "softupdate", 0); proc_waiting -= 1; - splx(s); + crit_exit(); if (islocked == 0) FREE_LOCK(&lk); return (1); -- 2.41.0