As vnalloc() always allocates with PR_WAITOK there is no longer the need

to test its result for NULL.
This commit is contained in:
hannken 2011-10-07 09:35:04 +00:00
parent 726006876b
commit 34f54c83be
11 changed files with 37 additions and 70 deletions

View File

@ -168,10 +168,8 @@ zfs_sync(vfs_t *vfsp, int flag, cred_t *cr)
return (0);
/* Allocate a marker vnode. */
if ((mvp = vnalloc(vfsp)) == NULL)
return (ENOMEM);
mvp = vnalloc(vfsp);
/*
* On NetBSD, we need to push out atime updates. Solaris does
* this during VOP_INACTIVE, but that does not work well with the

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.91 2011/06/12 03:35:53 rmind Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.92 2011/10/07 09:35:04 hannken Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.91 2011/06/12 03:35:53 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.92 2011/10/07 09:35:04 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -953,8 +953,7 @@ msdosfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
}
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
fstrans_start(mp, FSTRANS_SHARED);
/*
* Write back each (modified) denode.

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vfsops.c,v 1.97 2011/09/21 15:36:33 manu Exp $ */
/* $NetBSD: puffs_vfsops.c,v 1.98 2011/10/07 09:35:05 hannken Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.97 2011/09/21 15:36:33 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.98 2011/10/07 09:35:05 hannken Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@ -519,8 +519,7 @@ pageflush(struct mount *mp, kauth_cred_t cred, int waitfor)
fsyncwait = (waitfor == MNT_WAIT) ? FSYNC_WAIT : 0;
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
/*
* Sync all cached data from regular vnodes (which are not

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vfsops.c,v 1.94 2011/06/12 03:35:54 rmind Exp $ */
/* $NetBSD: smbfs_vfsops.c,v 1.95 2011/10/07 09:35:05 hannken Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.94 2011/06/12 03:35:54 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vfsops.c,v 1.95 2011/10/07 09:35:05 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -418,8 +418,7 @@ smbfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
int error, allerror = 0;
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
/*
* Force stale buffer cache information to be flushed.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_mount.c,v 1.9 2011/09/01 12:29:41 christos Exp $ */
/* $NetBSD: vfs_mount.c,v 1.10 2011/10/07 09:35:05 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.9 2011/09/01 12:29:41 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.10 2011/10/07 09:35:05 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -443,9 +443,6 @@ vflush(struct mount *mp, vnode_t *skipvp, int flags)
/* Allocate a marker vnode. */
mvp = vnalloc(mp);
if (mvp == NULL) {
return ENOMEM;
}
/*
* NOTE: not using the TAILQ_FOREACH here since in this loop vgone()

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnode.c,v 1.13 2011/10/03 10:30:13 hannken Exp $ */
/* $NetBSD: vfs_vnode.c,v 1.14 2011/10/07 09:35:06 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@ -120,7 +120,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.13 2011/10/03 10:30:13 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.14 2011/10/07 09:35:06 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -352,7 +352,6 @@ getnewvnode(enum vtagtype tag, struct mount *mp, int (**vops)(void *),
vnode_t *vp;
int error = 0;
try_again:
if (mp != NULL) {
/*
* Mark filesystem busy while we are creating a vnode.
@ -371,25 +370,14 @@ try_again:
if (numvnodes > desiredvnodes + desiredvnodes / 10)
cv_signal(&vdrain_cv);
mutex_exit(&vnode_free_list_lock);
if ((vp = vnalloc(NULL)) == NULL) {
mutex_enter(&vnode_free_list_lock);
numvnodes--;
mutex_exit(&vnode_free_list_lock);
if (mp != NULL) {
vfs_unbusy(mp, false, NULL);
}
printf("WARNING: unable to allocate new vnode, retrying...\n");
kpause("newvn", false, hz, NULL);
goto try_again;
}
vp->v_usecount = 1;
vp = vnalloc(NULL);
KASSERT(vp->v_freelisthd == NULL);
KASSERT(LIST_EMPTY(&vp->v_nclist));
KASSERT(LIST_EMPTY(&vp->v_dnclist));
/* Initialize vnode. */
vp->v_usecount = 1;
vp->v_type = VNON;
vp->v_tag = tag;
vp->v_op = vops;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.218 2011/06/12 03:35:59 rmind Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.219 2011/10/07 09:35:06 hannken Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.218 2011/06/12 03:35:59 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.219 2011/10/07 09:35:06 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfs.h"
@ -953,8 +953,7 @@ nfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
/*
* Force stale buffer cache information to be flushed.
*/
if ((mvp = vnalloc(mp)) == NULL)
return (ENOMEM);
mvp = vnalloc(mp);
loop:
/*
* NOTE: not using the TAILQ_FOREACH here since in this loop vgone()

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.160 2011/06/12 03:36:00 rmind Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.161 2011/10/07 09:35:06 hannken Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.160 2011/06/12 03:36:00 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.161 2011/10/07 09:35:06 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -592,8 +592,7 @@ ext2fs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
/*
* NOTE: not using the TAILQ_FOREACH here since in this loop vgone()
* and vclean() can be called indirectly
@ -914,8 +913,7 @@ ext2fs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return (ENOMEM);
mvp = vnalloc(mp);
/*
* Write back each (modified) inode.

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_snapshot.c,v 1.117 2011/07/01 14:28:21 hannken Exp $ */
/* $NetBSD: ffs_snapshot.c,v 1.118 2011/10/07 09:35:06 hannken Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.117 2011/07/01 14:28:21 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.118 2011/10/07 09:35:06 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -629,10 +629,7 @@ snapshot_expunge(struct mount *mp, struct vnode *vp, struct fs *copy_fs,
/*
* Allocate a marker vnode.
*/
if ((mvp = vnalloc(mp)) == NULL) {
error = ENOMEM;
goto out;
}
mvp = vnalloc(mp);
/*
* We also calculate the needed size for the snapshot list.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.268 2011/06/17 14:23:52 manu Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.269 2011/10/07 09:35:07 hannken Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.268 2011/06/17 14:23:52 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.269 2011/10/07 09:35:07 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -785,8 +785,7 @@ ffs_reload(struct mount *mp, kauth_cred_t cred, struct lwp *l)
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
/*
* NOTE: not using the TAILQ_FOREACH here since in this loop vgone()
* and vclean() can be called indirectly
@ -1598,8 +1597,7 @@ ffs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return (ENOMEM);
mvp = vnalloc(mp);
fstrans_start(mp, FSTRANS_SHARED);
is_suspending = (fstrans_getstate(mp) == FSTRANS_SUSPENDING);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_quota1.c,v 1.4 2011/06/12 03:36:02 rmind Exp $ */
/* $NetBSD: ufs_quota1.c,v 1.5 2011/10/07 09:35:07 hannken Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.4 2011/06/12 03:36:02 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.5 2011/10/07 09:35:07 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -368,10 +368,7 @@ quota1_handle_cmd_quotaon(struct lwp *l, struct ufsmount *ump, int type,
dqrele(NULLVP, dq);
}
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL) {
error = ENOMEM;
goto out;
}
mvp = vnalloc(mp);
/*
* Search vnodes associated with this mount point,
* adding references to quota file being opened.
@ -405,7 +402,7 @@ again:
}
mutex_exit(&mntvnode_lock);
vnfree(mvp);
out:
mutex_enter(&dqlock);
ump->umq1_qflags[type] &= ~QTF_OPENING;
cv_broadcast(&dqcv);
@ -432,8 +429,7 @@ quota1_handle_cmd_quotaoff(struct lwp *l, struct ufsmount *ump, int type)
int i, error;
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return ENOMEM;
mvp = vnalloc(mp);
mutex_enter(&dqlock);
while ((ump->umq1_qflags[type] & (QTF_CLOSING | QTF_OPENING)) != 0)
@ -760,8 +756,7 @@ q1sync(struct mount *mp)
return (0);
/* Allocate a marker vnode. */
if ((mvp = vnalloc(mp)) == NULL)
return (ENOMEM);
mvp = vnalloc(mp);
/*
* Search vnodes associated with this mount point,