Remove now redundant calls to fstrans_start()/fstrans_done().

Add fstrans_start()/fstrans_done() to lfs_putpages().
This commit is contained in:
hannken 2017-03-30 09:10:08 +00:00
parent 3c404d2c80
commit 63ce83dc30
8 changed files with 62 additions and 98 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_pages.c,v 1.9 2016/10/04 16:46:20 christos Exp $ */
/* $NetBSD: lfs_pages.c,v 1.10 2017/03/30 09:10:08 hannken Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.9 2016/10/04 16:46:20 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.10 2017/03/30 09:10:08 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -466,6 +466,7 @@ lfs_putpages(void *v)
bool seglocked, sync, pagedaemon, reclaim;
struct vm_page *pg, *busypg;
UVMHIST_FUNC("lfs_putpages"); UVMHIST_CALLED(ubchist);
struct mount *trans_mp;
int oreclaim = 0;
int donewriting = 0;
#ifdef DEBUG
@ -478,6 +479,7 @@ lfs_putpages(void *v)
sync = (ap->a_flags & PGO_SYNCIO) != 0;
reclaim = (ap->a_flags & PGO_RECLAIM) != 0;
pagedaemon = (curlwp == uvm.pagedaemon_lwp);
trans_mp = NULL;
KASSERT(mutex_owned(vp->v_interlock));
@ -487,6 +489,7 @@ lfs_putpages(void *v)
return 0;
}
retry:
/*
* If there are no pages, don't do anything.
*/
@ -497,6 +500,8 @@ lfs_putpages(void *v)
vp->v_iflag &= ~VI_WRMAPDIRTY;
vn_syncer_remove_from_worklist(vp);
}
if (trans_mp)
fstrans_done(trans_mp);
mutex_exit(vp->v_interlock);
/* Remove us from paging queue, if we were on it */
@ -587,6 +592,33 @@ lfs_putpages(void *v)
return r;
}
if (trans_mp /* && (ap->a_flags & PGO_CLEANIT) != 0 */) {
if (pagedaemon) {
/* Pagedaemon must not sleep here. */
trans_mp = vp->v_mount;
error = fstrans_start_nowait(trans_mp, FSTRANS_SHARED);
if (error) {
mutex_exit(vp->v_interlock);
return error;
}
} else {
/*
* Cannot use vdeadcheck() here as this operation
* usually gets used from VOP_RECLAIM(). Test for
* change of v_mount instead and retry on change.
*/
mutex_exit(vp->v_interlock);
trans_mp = vp->v_mount;
fstrans_start(trans_mp, FSTRANS_SHARED);
if (vp->v_mount != trans_mp) {
fstrans_done(trans_mp);
trans_mp = NULL;
}
}
mutex_enter(vp->v_interlock);
goto retry;
}
/* Set PGO_BUSYFAIL to avoid deadlocks */
ap->a_flags |= PGO_BUSYFAIL;
@ -607,7 +639,8 @@ lfs_putpages(void *v)
if (r < 0) {
/* Pages are busy with another process */
mutex_exit(vp->v_interlock);
return EDEADLK;
error = EDEADLK;
goto out;
}
if (r > 0) /* Some pages are dirty */
break;
@ -624,7 +657,8 @@ lfs_putpages(void *v)
ip->i_lfs_iflags &= ~LFSI_NO_GOP_WRITE;
if (r != EDEADLK) {
KASSERT(!mutex_owned(vp->v_interlock));
return r;
error = r;
goto out;
}
/* One of the pages was busy. Start over. */
@ -662,7 +696,8 @@ lfs_putpages(void *v)
mutex_exit(&lfs_lock);
preempt();
KASSERT(!mutex_owned(vp->v_interlock));
return EWOULDBLOCK;
error = EWOULDBLOCK;
goto out;
}
/*
@ -724,7 +759,7 @@ lfs_putpages(void *v)
error = lfs_seglock(fs, SEGM_PROT | (sync ? SEGM_SYNC : 0));
if (error != 0) {
KASSERT(!mutex_owned(vp->v_interlock));
return error;
goto out;
}
mutex_enter(vp->v_interlock);
lfs_acquire_finfo(fs, ip->i_number, ip->i_gen);
@ -851,7 +886,7 @@ lfs_putpages(void *v)
*/
if (seglocked) {
KASSERT(!mutex_owned(vp->v_interlock));
return error;
goto out;
}
/* Clean up FIP and send it to disk. */
@ -892,6 +927,10 @@ lfs_putpages(void *v)
}
mutex_exit(vp->v_interlock);
}
out:;
if (trans_mp)
fstrans_done(trans_mp);
KASSERT(!mutex_owned(vp->v_interlock));
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vnops.c,v 1.306 2017/03/16 01:09:24 maya Exp $ */
/* $NetBSD: lfs_vnops.c,v 1.307 2017/03/30 09:10:08 hannken Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.306 2017/03/16 01:09:24 maya Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.307 2017/03/30 09:10:08 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -147,7 +147,6 @@ __KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.306 2017/03/16 01:09:24 maya Exp $")
#include <sys/signalvar.h>
#include <sys/kauth.h>
#include <sys/syslog.h>
#include <sys/fstrans.h>
#include <miscfs/fifofs/fifo.h>
#include <miscfs/genfs/genfs.h>
@ -721,7 +720,6 @@ lfs_symlink(void *v)
if (error)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
error = lfs_makeinode(ap->a_vap, dvp, ulr, vpp, ap->a_cnp);
if (error) {
goto out;
@ -757,8 +755,6 @@ lfs_symlink(void *v)
vrele(*vpp);
out:
fstrans_done(dvp->v_mount);
UNMARK_VNODE(dvp);
/* XXX: is it even possible for the symlink to get MARK'd? */
UNMARK_VNODE(*vpp);
@ -809,7 +805,6 @@ lfs_mknod(void *v)
if (error)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
error = lfs_makeinode(vap, dvp, ulr, vpp, ap->a_cnp);
/* Either way we're done with the dirop at this point */
@ -818,7 +813,6 @@ lfs_mknod(void *v)
lfs_unset_dirop(fs, dvp, "mknod");
if (error) {
fstrans_done(dvp->v_mount);
vrele(dvp);
*vpp = NULL;
return (error);
@ -843,7 +837,6 @@ lfs_mknod(void *v)
/* return (error); */
}
fstrans_done(dvp->v_mount);
vrele(dvp);
KASSERT(error == 0);
VOP_UNLOCK(*vpp);
@ -889,13 +882,10 @@ lfs_create(void *v)
if (error)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
error = lfs_makeinode(vap, dvp, ulr, vpp, ap->a_cnp);
if (error) {
fstrans_done(dvp->v_mount);
goto out;
}
fstrans_done(dvp->v_mount);
VN_KNOTE(dvp, NOTE_WRITE);
VOP_UNLOCK(*vpp);
@ -962,8 +952,6 @@ lfs_mkdir(void *v)
if (error)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
if ((nlink_t)dp->i_nlink >= LINK_MAX) {
error = EMLINK;
goto out;
@ -1066,8 +1054,6 @@ lfs_mkdir(void *v)
}
out:
fstrans_done(dvp->v_mount);
UNMARK_VNODE(dvp);
UNMARK_VNODE(*vpp);
if (error) {
@ -1207,7 +1193,6 @@ lfs_getattr(void *v)
struct vattr *vap = ap->a_vap;
struct lfs *fs = ip->i_lfs;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
/*
* Copy from inode table
*/
@ -1245,7 +1230,6 @@ lfs_getattr(void *v)
vap->va_bytes = lfs_fsbtob(fs, ip->i_lfs_effnblks);
vap->va_type = vp->v_type;
vap->va_filerev = ip->i_modrev;
fstrans_done(vp->v_mount);
return (0);
}
@ -1329,11 +1313,9 @@ lfs_close(void *v)
vp->v_mount->mnt_iflag & IMNT_UNMOUNT)
return 0;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (vp->v_usecount > 1 && vp != ip->i_lfs->lfs_ivnode) {
LFS_ITIMES(ip, NULL, NULL, NULL);
}
fstrans_done(vp->v_mount);
return (0);
}
@ -2266,9 +2248,7 @@ lfs_getextattr(void *v)
if (ump->um_fstype == ULFS1) {
#ifdef LFS_EXTATTR
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ulfs_getextattr(ap);
fstrans_done(vp->v_mount);
#else
error = EOPNOTSUPP;
#endif
@ -2298,9 +2278,7 @@ lfs_setextattr(void *v)
if (ump->um_fstype == ULFS1) {
#ifdef LFS_EXTATTR
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ulfs_setextattr(ap);
fstrans_done(vp->v_mount);
#else
error = EOPNOTSUPP;
#endif
@ -2330,9 +2308,7 @@ lfs_listextattr(void *v)
if (ump->um_fstype == ULFS1) {
#ifdef LFS_EXTATTR
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ulfs_listextattr(ap);
fstrans_done(vp->v_mount);
#else
error = EOPNOTSUPP;
#endif
@ -2360,9 +2336,7 @@ lfs_deleteextattr(void *v)
if (ump->um_fstype == ULFS1) {
#ifdef LFS_EXTATTR
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ulfs_deleteextattr(ap);
fstrans_done(vp->v_mount);
#else
error = EOPNOTSUPP;
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_bmap.c,v 1.8 2017/03/13 14:24:20 riastradh Exp $ */
/* $NetBSD: ulfs_bmap.c,v 1.9 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_bmap.c,v 1.50 2013/01/22 09:39:18 dholland Exp */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_bmap.c,v 1.8 2017/03/13 14:24:20 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_bmap.c,v 1.9 2017/03/30 09:10:08 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -49,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_bmap.c,v 1.8 2017/03/13 14:24:20 riastradh Exp
#include <sys/mount.h>
#include <sys/resourcevar.h>
#include <sys/trace.h>
#include <sys/fstrans.h>
#include <miscfs/specfs/specdev.h>
@ -113,10 +112,8 @@ ulfs_bmap(void *v)
if (ap->a_bnp == NULL)
return (0);
fstrans_start(ap->a_vp->v_mount, FSTRANS_SHARED);
error = ulfs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, NULL, NULL,
ap->a_runp, ulfs_issequential);
fstrans_done(ap->a_vp->v_mount);
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_inode.c,v 1.16 2016/08/20 12:37:09 hannken Exp $ */
/* $NetBSD: ulfs_inode.c,v 1.17 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_inode.c,v 1.95 2015/06/13 14:56:45 hannken Exp */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_inode.c,v 1.16 2016/08/20 12:37:09 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_inode.c,v 1.17 2017/03/30 09:10:08 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_inode.c,v 1.16 2016/08/20 12:37:09 hannken Exp
#include <sys/kernel.h>
#include <sys/namei.h>
#include <sys/kauth.h>
#include <sys/fstrans.h>
#include <sys/kmem.h>
#include <ufs/lfs/lfs.h>
@ -86,12 +85,9 @@ ulfs_inactive(void *v)
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
struct mount *transmp;
mode_t mode;
int error = 0;
transmp = vp->v_mount;
fstrans_start(transmp, FSTRANS_LAZY);
/*
* Ignore inodes related to stale file handles.
*/
@ -129,7 +125,6 @@ out:
*/
*ap->a_recycle = (ip->i_mode == 0);
VOP_UNLOCK(vp);
fstrans_done(transmp);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_lookup.c,v 1.39 2016/06/20 02:25:03 dholland Exp $ */
/* $NetBSD: ulfs_lookup.c,v 1.40 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_lookup.c,v 1.135 2015/07/11 11:04:48 mlelstv */
/*
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.39 2016/06/20 02:25:03 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.40 2017/03/30 09:10:08 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_lfs.h"
@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_lookup.c,v 1.39 2016/06/20 02:25:03 dholland Ex
#include <sys/vnode.h>
#include <sys/kernel.h>
#include <sys/kauth.h>
#include <sys/fstrans.h>
#include <sys/proc.h>
#include <sys/kmem.h>
@ -208,8 +207,6 @@ ulfs_lookup(void *v)
cnp->cn_flags |= ISWHITEOUT;
}
fstrans_start(vdp->v_mount, FSTRANS_SHARED);
/*
* Suppress search for slots unless creating
* file and at end of pathname, in which case
@ -630,7 +627,6 @@ found:
error = 0;
out:
fstrans_done(vdp->v_mount);
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_quota2.c,v 1.29 2016/11/20 21:22:14 riastradh Exp $ */
/* $NetBSD: ulfs_quota2.c,v 1.30 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_quota2.c,v 1.40 2015/03/28 19:24:05 maxv Exp Exp */
/* from NetBSD: ffs_quota2.c,v 1.5 2015/02/22 14:12:48 maxv Exp */
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.29 2016/11/20 21:22:14 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.30 2017/03/30 09:10:08 hannken Exp $");
#include <sys/buf.h>
#include <sys/param.h>
@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_quota2.c,v 1.29 2016/11/20 21:22:14 riastradh E
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/mount.h>
#include <sys/fstrans.h>
#include <sys/kauth.h>
#include <sys/quota.h>
#include <sys/quotactl.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_readwrite.c,v 1.22 2016/06/20 03:36:09 dholland Exp $ */
/* $NetBSD: ulfs_readwrite.c,v 1.23 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_readwrite.c,v 1.120 2015/04/12 22:48:38 riastradh Exp */
/*-
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.22 2016/06/20 03:36:09 dholland Exp $");
__KERNEL_RCSID(1, "$NetBSD: ulfs_readwrite.c,v 1.23 2017/03/30 09:10:08 hannken Exp $");
#ifdef LFS_READWRITE
#define FS struct lfs
@ -110,8 +110,6 @@ READ(void *v)
return ffs_snapshot_read(vp, uio, ioflag);
#endif /* !LFS_READWRITE */
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (uio->uio_offset >= ip->i_size)
goto out;
@ -132,7 +130,6 @@ READ(void *v)
out:
error = ulfs_post_read_update(vp, ap->a_ioflag, error);
fstrans_done(vp->v_mount);
return (error);
}
@ -174,8 +171,6 @@ BUFRD(struct vnode *vp, struct uio *uio, int ioflag, kauth_cred_t cred)
KASSERT(!ISSET(ip->i_flags, (SF_SNAPSHOT | SF_SNAPINVAL)));
#endif
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (uio->uio_offset >= ip->i_size)
goto out;
@ -223,7 +218,6 @@ BUFRD(struct vnode *vp, struct uio *uio, int ioflag, kauth_cred_t cred)
out:
error = ulfs_post_read_update(vp, ioflag, error);
fstrans_done(vp->v_mount);
return (error);
}
@ -298,8 +292,6 @@ WRITE(void *v)
if (uio->uio_resid == 0)
return (0);
fstrans_start(vp->v_mount, FSTRANS_SHARED);
flags = ioflag & IO_SYNC ? B_SYNC : 0;
async = vp->v_mount->mnt_flag & MNT_ASYNC;
origoff = uio->uio_offset;
@ -451,7 +443,6 @@ WRITE(void *v)
out:
error = ulfs_post_write_update(vp, uio, ioflag, cred, osize, resid,
extended, error);
fstrans_done(vp->v_mount);
return (error);
}
@ -496,8 +487,6 @@ BUFWR(struct vnode *vp, struct uio *uio, int ioflag, kauth_cred_t cred)
if (uio->uio_resid == 0)
return 0;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
flags = ioflag & IO_SYNC ? B_SYNC : 0;
resid = uio->uio_resid;
osize = ip->i_size;
@ -579,7 +568,6 @@ BUFWR(struct vnode *vp, struct uio *uio, int ioflag, kauth_cred_t cred)
error = ulfs_post_write_update(vp, uio, ioflag, cred, osize, resid,
extended, error);
fstrans_done(vp->v_mount);
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ulfs_vnops.c,v 1.45 2017/03/13 14:24:20 riastradh Exp $ */
/* $NetBSD: ulfs_vnops.c,v 1.46 2017/03/30 09:10:08 hannken Exp $ */
/* from NetBSD: ufs_vnops.c,v 1.232 2016/05/19 18:32:03 riastradh Exp */
/*-
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.45 2017/03/13 14:24:20 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.46 2017/03/30 09:10:08 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_lfs.h"
@ -90,7 +90,6 @@ __KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.45 2017/03/13 14:24:20 riastradh Ex
#include <sys/dirent.h>
#include <sys/lockf.h>
#include <sys/kauth.h>
#include <sys/fstrans.h>
#include <miscfs/specfs/specdev.h>
#include <miscfs/fifofs/fifo.h>
@ -159,9 +158,7 @@ ulfs_check_possible(struct vnode *vp, struct inode *ip, mode_t mode,
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = lfs_chkdq(ip, 0, cred, 0);
fstrans_done(vp->v_mount);
if (error != 0)
return error;
#endif
@ -263,8 +260,6 @@ ulfs_setattr(void *v)
return (EINVAL);
}
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (vap->va_flags != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
error = EROFS;
@ -403,7 +398,6 @@ ulfs_setattr(void *v)
}
VN_KNOTE(vp, NOTE_ATTRIB);
out:
fstrans_done(vp->v_mount);
return (error);
}
@ -424,12 +418,10 @@ ulfs_chmod(struct vnode *vp, int mode, kauth_cred_t cred, struct lwp *l)
if (error)
return (error);
fstrans_start(vp->v_mount, FSTRANS_SHARED);
ip->i_mode &= ~ALLPERMS;
ip->i_mode |= (mode & ALLPERMS);
ip->i_flag |= IN_CHANGE;
DIP_ASSIGN(ip, mode, ip->i_mode);
fstrans_done(vp->v_mount);
return (0);
}
@ -461,7 +453,6 @@ ulfs_chown(struct vnode *vp, uid_t uid, gid_t gid, kauth_cred_t cred,
if (error)
return (error);
fstrans_start(vp->v_mount, FSTRANS_SHARED);
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
ogid = ip->i_gid;
ouid = ip->i_uid;
@ -486,12 +477,10 @@ ulfs_chown(struct vnode *vp, uid_t uid, gid_t gid, kauth_cred_t cred,
DIP_ASSIGN(ip, uid, ouid);
(void) lfs_chkdq(ip, change, cred, FORCE);
(void) lfs_chkiq(ip, 1, cred, FORCE);
fstrans_done(vp->v_mount);
return (error);
good:
#endif /* LFS_QUOTA || LFS_QUOTA2 */
ip->i_flag |= IN_CHANGE;
fstrans_done(vp->v_mount);
return (0);
}
@ -505,21 +494,18 @@ ulfs_remove(void *v)
} */ *ap = v;
struct vnode *vp, *dvp;
struct inode *ip;
struct mount *mp;
int error;
struct ulfs_lookup_results *ulr;
vp = ap->a_vp;
dvp = ap->a_dvp;
ip = VTOI(vp);
mp = dvp->v_mount;
KASSERT(mp == vp->v_mount); /* XXX Not stable without lock. */
KASSERT(dvp->v_mount == vp->v_mount); /* XXX Not stable without lock. */
/* XXX should handle this material another way */
ulr = &VTOI(dvp)->i_crap;
ULFS_CHECK_CRAPCOUNTER(VTOI(dvp));
fstrans_start(mp, FSTRANS_SHARED);
if (vp->v_type == VDIR || (ip->i_flags & (IMMUTABLE | APPEND)) ||
(VTOI(dvp)->i_flags & APPEND))
error = EPERM;
@ -534,7 +520,6 @@ ulfs_remove(void *v)
else
vput(vp);
vput(dvp);
fstrans_done(mp);
return (error);
}
@ -552,20 +537,18 @@ ulfs_link(void *v)
struct vnode *dvp = ap->a_dvp;
struct vnode *vp = ap->a_vp;
struct componentname *cnp = ap->a_cnp;
struct mount *mp = dvp->v_mount;
struct inode *ip;
int error;
struct ulfs_lookup_results *ulr;
KASSERT(dvp != vp);
KASSERT(vp->v_type != VDIR);
KASSERT(mp == vp->v_mount); /* XXX Not stable without lock. */
KASSERT(dvp->v_mount == vp->v_mount); /* XXX Not stable without lock. */
/* XXX should handle this material another way */
ulr = &VTOI(dvp)->i_crap;
ULFS_CHECK_CRAPCOUNTER(VTOI(dvp));
fstrans_start(mp, FSTRANS_SHARED);
error = vn_lock(vp, LK_EXCLUSIVE);
if (error) {
VOP_ABORTOP(dvp, cnp);
@ -600,7 +583,6 @@ ulfs_link(void *v)
out2:
VN_KNOTE(vp, NOTE_LINK);
VN_KNOTE(dvp, NOTE_WRITE);
fstrans_done(mp);
return (error);
}
@ -636,7 +618,6 @@ ulfs_whiteout(void *v)
case CREATE:
/* create a new directory whiteout */
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
KASSERTMSG((fs->um_maxsymlinklen > 0),
"ulfs_whiteout: old format filesystem");
@ -646,7 +627,6 @@ ulfs_whiteout(void *v)
case DELETE:
/* remove an existing directory whiteout */
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
KASSERTMSG((fs->um_maxsymlinklen > 0),
"ulfs_whiteout: old format filesystem");
@ -657,7 +637,6 @@ ulfs_whiteout(void *v)
panic("ulfs_whiteout: unknown op");
/* NOTREACHED */
}
fstrans_done(dvp->v_mount);
return (error);
}
@ -697,8 +676,6 @@ ulfs_rmdir(void *v)
return (EINVAL);
}
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
/*
* Do not remove a directory that is in the process of being renamed.
* Verify that the directory is empty (and valid). (Rmdir ".." won't
@ -747,7 +724,6 @@ ulfs_rmdir(void *v)
out:
VN_KNOTE(vp, NOTE_DELETE);
vput(vp);
fstrans_done(dvp->v_mount);
vput(dvp);
return (error);
}