Fstrans_start() always returns zero, so change its type to void.

This commit is contained in:
hannken 2007-05-17 07:26:21 +00:00
parent 19468d62cc
commit 64b7e5637e
11 changed files with 61 additions and 87 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: fstrans.9,v 1.4 2007/02/16 17:23:59 hannken Exp $
.\" $NetBSD: fstrans.9,v 1.5 2007/05/17 07:26:21 hannken Exp $
.\"
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 16, 2007
.Dd May 17, 2007
.Dt FSTRANS 9
.Os
.Sh NAME
@ -53,7 +53,7 @@
.Fn fstrans_setstate "struct mount *" "enum fstrans_state"
.Ft "enum fstrans_state"
.Fn fstrans_getstate "struct mount *"
.Ft int
.Ft void
.Fn fstrans_start "struct mount *" "enum fstrans_lock_type"
.Ft int
.Fn fstrans_start_nowait "struct mount *" "enum fstrans_lock_type"
@ -135,8 +135,7 @@ if this thread is currently suspending the file system
.El
.Sh RETURN VALUES
The functions
.Fn fstrans_setstate ,
.Fn fstrans_start ,
.Fn fstrans_setstate
and
.Fn fstrans_start_nowait
return zero on success and an error value on failure.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_trans.c,v 1.8 2007/05/16 16:11:56 hannken Exp $ */
/* $NetBSD: vfs_trans.c,v 1.9 2007/05/17 07:26:22 hannken Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.8 2007/05/16 16:11:56 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.9 2007/05/17 07:26:22 hannken Exp $");
/*
* File system transaction operations.
@ -287,7 +287,6 @@ fstrans_is_owner(struct mount *mp)
int
fstrans_setstate(struct mount *mp, enum fstrans_state new_state)
{
int error;
struct fstrans_mount_info *fmi;
if ((fmi = mount_getspecific(mp, mount_data_key)) == NULL)
@ -296,8 +295,7 @@ fstrans_setstate(struct mount *mp, enum fstrans_state new_state)
switch (new_state) {
case FSTRANS_SUSPENDING:
KASSERT(fmi->fmi_state == FSTRANS_NORMAL);
if ((error = fstrans_start(mp, FSTRANS_EXCL)) != 0)
return error;
fstrans_start(mp, FSTRANS_EXCL);
fmi->fmi_state = FSTRANS_SUSPENDING;
break;
@ -306,9 +304,8 @@ fstrans_setstate(struct mount *mp, enum fstrans_state new_state)
fmi->fmi_state == FSTRANS_SUSPENDING);
KASSERT(fmi->fmi_state == FSTRANS_NORMAL ||
fstrans_is_owner(mp));
if (fmi->fmi_state == FSTRANS_NORMAL &&
(error = fstrans_start(mp, FSTRANS_EXCL)) != 0)
return error;
if (fmi->fmi_state == FSTRANS_NORMAL)
fstrans_start(mp, FSTRANS_EXCL);
rw_enter(&fmi->fmi_lazy_lock, RW_WRITER);
fmi->fmi_state = FSTRANS_SUSPENDED;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: genfs_vnops.c,v 1.152 2007/05/13 13:11:53 yamt Exp $ */
/* $NetBSD: genfs_vnops.c,v 1.153 2007/05/17 07:26:22 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.152 2007/05/13 13:11:53 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.153 2007/05/17 07:26:22 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -599,11 +599,10 @@ startover:
UVMHIST_LOG(ubchist, "ridx %d npages %d startoff %ld endoff %ld",
ridx, npages, startoffset, endoffset);
if (!has_trans &&
(error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0) {
goto out_err;
if (!has_trans) {
fstrans_start(vp->v_mount, FSTRANS_SHARED);
has_trans = true;
}
has_trans = true;
/*
* hold g_glock to prevent a race with truncate.
@ -1093,12 +1092,12 @@ genfs_do_putpages(struct vnode *vp, off_t startoff, off_t endoff, int flags,
if ((flags & PGO_CLEANIT) != 0) {
simple_unlock(slock);
if (pagedaemon)
if (pagedaemon) {
error = fstrans_start_nowait(vp->v_mount, FSTRANS_LAZY);
else
error = fstrans_start(vp->v_mount, FSTRANS_LAZY);
if (error)
return error;
if (error)
return error;
} else
fstrans_start(vp->v_mount, FSTRANS_LAZY);
has_trans = true;
simple_lock(slock);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: fstrans.h,v 1.3 2007/01/29 15:42:50 hannken Exp $ */
/* $NetBSD: fstrans.h,v 1.4 2007/05/17 07:26:21 hannken Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -64,7 +64,10 @@ enum fstrans_state {
};
void fstrans_init(void);
#define fstrans_start(mp, t) _fstrans_start((mp), (t), 1)
#define fstrans_start(mp, t) \
do { \
KASSERT(_fstrans_start((mp), (t), 1) == 0); \
} while (/* CONSTCOND */ 0)
#define fstrans_start_nowait(mp, t) _fstrans_start((mp), (t), 0)
int _fstrans_start(struct mount *, enum fstrans_lock_type, int);
void fstrans_done(struct mount *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.198 2007/04/07 14:21:52 hannken Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.199 2007/05/17 07:26:23 hannken Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.198 2007/04/07 14:21:52 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.199 2007/05/17 07:26:23 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -1312,8 +1312,7 @@ ffs_sync(struct mount *mp, int waitfor, kauth_cred_t cred, struct lwp *l)
printf("fs = %s\n", fs->fs_fsmnt);
panic("update: rofs mod");
}
if ((error = fstrans_start(mp, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(mp, FSTRANS_SHARED);
/*
* Write back each (modified) inode.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vnops.c,v 1.86 2007/02/20 16:21:04 ad Exp $ */
/* $NetBSD: ffs_vnops.c,v 1.87 2007/05/17 07:26:23 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.86 2007/02/20 16:21:04 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vnops.c,v 1.87 2007/05/17 07:26:23 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -254,8 +254,7 @@ ffs_fsync(void *v)
vp = ap->a_vp;
if ((error = fstrans_start(vp->v_mount, FSTRANS_LAZY)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_LAZY);
/*
* XXX no easy way to sync a range in a file with softdep.
*/
@ -493,8 +492,7 @@ ffs_reclaim(void *v)
struct ufsmount *ump = ip->i_ump;
int error;
if ((error = fstrans_start(mp, FSTRANS_LAZY)) != 0)
return error;
fstrans_start(mp, FSTRANS_LAZY);
if ((error = ufs_reclaim(vp, ap->a_l)) != 0) {
fstrans_done(mp);
return (error);
@ -631,8 +629,7 @@ ffs_getextattr(void *v)
#ifdef UFS_EXTATTR
int error;
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ufs_getextattr(ap);
fstrans_done(vp->v_mount);
return error;
@ -664,8 +661,7 @@ ffs_setextattr(void *v)
#ifdef UFS_EXTATTR
int error;
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ufs_setextattr(ap);
fstrans_done(vp->v_mount);
return error;
@ -717,8 +713,7 @@ ffs_deleteextattr(void *v)
#ifdef UFS_EXTATTR
int error;
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = ufs_deleteextattr(ap);
fstrans_done(vp->v_mount);
return error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_bmap.c,v 1.44 2007/02/22 06:10:49 thorpej Exp $ */
/* $NetBSD: ufs_bmap.c,v 1.45 2007/05/17 07:26:22 hannken Exp $ */
/*
* Copyright (c) 1989, 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.44 2007/02/22 06:10:49 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.45 2007/05/17 07:26:22 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -93,8 +93,7 @@ ufs_bmap(void *v)
if (ap->a_bnp == NULL)
return (0);
if ((error = fstrans_start(ap->a_vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(ap->a_vp->v_mount, FSTRANS_SHARED);
error = ufs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, NULL, NULL,
ap->a_runp, ufs_issequential);
fstrans_done(ap->a_vp->v_mount);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_inode.c,v 1.65 2007/04/07 14:21:52 hannken Exp $ */
/* $NetBSD: ufs_inode.c,v 1.66 2007/05/17 07:26:22 hannken Exp $ */
/*
* Copyright (c) 1991, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.65 2007/04/07 14:21:52 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.66 2007/05/17 07:26:22 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -90,8 +90,7 @@ ufs_inactive(void *v)
vprint("ufs_inactive: pushing active", vp);
transmp = vp->v_mount;
if ((error = fstrans_start(transmp, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(transmp, FSTRANS_SHARED);
/*
* Ignore inodes related to stale file handles.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_lookup.c,v 1.88 2007/03/04 06:03:47 christos Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.89 2007/05/17 07:26:22 hannken Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.88 2007/03/04 06:03:47 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.89 2007/05/17 07:26:22 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_ffs.h"
@ -170,8 +170,7 @@ ufs_lookup(void *v)
return (error);
}
if ((error = fstrans_start(vdp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vdp->v_mount, FSTRANS_SHARED);
/*
* Suppress search for slots unless creating

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_readwrite.c,v 1.77 2007/04/19 11:05:14 yamt Exp $ */
/* $NetBSD: ufs_readwrite.c,v 1.78 2007/05/17 07:26:23 hannken Exp $ */
/*-
* Copyright (c) 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.77 2007/04/19 11:05:14 yamt Exp $");
__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.78 2007/05/17 07:26:23 hannken Exp $");
#ifdef LFS_READWRITE
#define BLKSIZE(a, b, c) blksize(a, b, c)
@ -105,8 +105,7 @@ READ(void *v)
if (uio->uio_resid == 0)
return (0);
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (uio->uio_offset >= ip->i_size)
goto out;
@ -282,8 +281,7 @@ WRITE(void *v)
if (uio->uio_resid == 0)
return (0);
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
flags = ioflag & IO_SYNC ? B_SYNC : 0;
async = vp->v_mount->mnt_flag & MNT_ASYNC;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.152 2007/03/04 06:03:48 christos Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.153 2007/05/17 07:26:23 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993, 1995
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.152 2007/03/04 06:03:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.153 2007/05/17 07:26:23 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -106,8 +106,7 @@ ufs_create(void *v)
} */ *ap = v;
int error;
if ((error = fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED);
error =
ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode),
ap->a_dvp, ap->a_vpp, ap->a_cnp);
@ -140,8 +139,7 @@ ufs_mknod(void *v)
vap = ap->a_vap;
vpp = ap->a_vpp;
if ((error = fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED);
if ((error =
ufs_makeinode(MAKEIMODE(vap->va_type, vap->va_mode),
ap->a_dvp, vpp, ap->a_cnp)) != 0)
@ -266,9 +264,7 @@ ufs_access(void *v)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
#ifdef QUOTA
if ((error =
fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
error = getinoquota(ip);
fstrans_done(vp->v_mount);
if (error != 0)
@ -398,8 +394,7 @@ ufs_setattr(void *v)
return (EINVAL);
}
if ((error = fstrans_start(vp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(vp->v_mount, FSTRANS_SHARED);
if (vap->va_flags != VNOVAL) {
if (vp->v_mount->mnt_flag & MNT_RDONLY) {
@ -699,8 +694,7 @@ ufs_remove(void *v)
vp = ap->a_vp;
dvp = ap->a_dvp;
ip = VTOI(vp);
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
if (vp->v_type == VDIR || (ip->i_flags & (IMMUTABLE | APPEND)) ||
(VTOI(dvp)->i_flags & APPEND))
error = EPERM;
@ -741,8 +735,7 @@ ufs_link(void *v)
if ((cnp->cn_flags & HASBUF) == 0)
panic("ufs_link: no name");
#endif
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
if (vp->v_type == VDIR) {
VOP_ABORTOP(dvp, cnp);
error = EPERM;
@ -828,8 +821,7 @@ ufs_whiteout(void *v)
case CREATE:
/* create a new directory whiteout */
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & SAVENAME) == 0)
panic("ufs_whiteout: missing name");
@ -850,8 +842,7 @@ ufs_whiteout(void *v)
case DELETE:
/* remove an existing directory whiteout */
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
#ifdef DIAGNOSTIC
if (ump->um_maxsymlinklen <= 0)
panic("ufs_whiteout: old format filesystem");
@ -1023,8 +1014,7 @@ ufs_rename(void *v)
xp = VTOI(tvp);
mp = fdvp->v_mount;
if ((error = fstrans_start(mp, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(mp, FSTRANS_SHARED);
/*
* 1) Bump link count while we're moving stuff
@ -1332,8 +1322,7 @@ ufs_mkdir(void *v)
struct ufsmount *ump = dp->i_ump;
int dirblksiz = ump->um_dirblksiz;
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
#ifdef DIAGNOSTIC
if ((cnp->cn_flags & HASBUF) == 0)
@ -1531,8 +1520,7 @@ ufs_rmdir(void *v)
return (EINVAL);
}
if ((error = fstrans_start(dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(dvp->v_mount, FSTRANS_SHARED);
/*
* Do not remove a directory that is in the process of being renamed.
@ -1628,8 +1616,7 @@ ufs_symlink(void *v)
int len, error;
vpp = ap->a_vpp;
if ((error = fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED)) != 0)
return error;
fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED);
error = ufs_makeinode(IFLNK | ap->a_vap->va_mode, ap->a_dvp,
vpp, ap->a_cnp);
if (error)