Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src As vnalloc() always allocates with PR_WAITOK there is no lon...



details:   https://anonhg.NetBSD.org/src/rev/43cd550876fd
branches:  trunk
changeset: 770176:43cd550876fd
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Oct 07 09:35:04 2011 +0000

description:
As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c |   6 +---
 sys/fs/msdosfs/msdosfs_vfsops.c                         |   7 ++---
 sys/fs/puffs/puffs_vfsops.c                             |   7 ++---
 sys/fs/smbfs/smbfs_vfsops.c                             |   7 ++---
 sys/kern/vfs_mount.c                                    |   7 +----
 sys/kern/vfs_vnode.c                                    |  20 +++-------------
 sys/nfs/nfs_vfsops.c                                    |   7 ++---
 sys/ufs/ext2fs/ext2fs_vfsops.c                          |  10 +++-----
 sys/ufs/ffs/ffs_snapshot.c                              |   9 ++-----
 sys/ufs/ffs/ffs_vfsops.c                                |  10 +++-----
 sys/ufs/ufs/ufs_quota1.c                                |  17 +++++---------
 11 files changed, 37 insertions(+), 70 deletions(-)

diffs (truncated from 375 to 300 lines):

diff -r 7e13a802fb93 -r 43cd550876fd external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c   Fri Oct 07 09:22:53 2011 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c   Fri Oct 07 09:35:04 2011 +0000
@@ -168,10 +168,8 @@
                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
diff -r 7e13a802fb93 -r 43cd550876fd sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
                }
        }
        /* Allocate a marker vnode. */
-       if ((mvp = vnalloc(mp)) == NULL)
-               return ENOMEM;
+       mvp = vnalloc(mp);
        fstrans_start(mp, FSTRANS_SHARED);
        /*
         * Write back each (modified) denode.
diff -r 7e13a802fb93 -r 43cd550876fd sys/fs/puffs/puffs_vfsops.c
--- a/sys/fs/puffs/puffs_vfsops.c       Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/fs/puffs/puffs_vfsops.c       Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        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
diff -r 7e13a802fb93 -r 43cd550876fd sys/fs/smbfs/smbfs_vfsops.c
--- a/sys/fs/smbfs/smbfs_vfsops.c       Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/fs/smbfs/smbfs_vfsops.c       Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        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.
         */
diff -r 7e13a802fb93 -r 43cd550876fd sys/kern/vfs_mount.c
--- a/sys/kern/vfs_mount.c      Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/kern/vfs_mount.c      Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
 
        /* Allocate a marker vnode. */
        mvp = vnalloc(mp);
-       if (mvp == NULL) {
-               return ENOMEM;
-       }
 
        /*
         * NOTE: not using the TAILQ_FOREACH here since in this loop vgone()
diff -r 7e13a802fb93 -r 43cd550876fd sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/kern/vfs_vnode.c      Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        vnode_t *vp;
        int error = 0;
 
-try_again:
        if (mp != NULL) {
                /*
                 * Mark filesystem busy while we are creating a vnode.
@@ -371,25 +370,14 @@
        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;
diff -r 7e13a802fb93 -r 43cd550876fd sys/nfs/nfs_vfsops.c
--- a/sys/nfs/nfs_vfsops.c      Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/nfs/nfs_vfsops.c      Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        /*
         * 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()
diff -r 7e13a802fb93 -r 43cd550876fd sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        }
 
        /* 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 @@
        }
 
        /* Allocate a marker vnode. */
-       if ((mvp = vnalloc(mp)) == NULL)
-               return (ENOMEM);
+       mvp = vnalloc(mp);
 
        /*
         * Write back each (modified) inode.
diff -r 7e13a802fb93 -r 43cd550876fd sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        /*
         * 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.
         */
diff -r 7e13a802fb93 -r 43cd550876fd sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Fri Oct 07 09:22:53 2011 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Fri Oct 07 09:35:04 2011 +0000
@@ -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 @@
        }
 
        /* Allocate a marker vnode. */



Home | Main Index | Thread Index | Old Index