Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 May 2012 19:07:40 +0000 (12:07 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 May 2012 19:07:40 +0000 (12:07 -0700)
sys/vfs/tmpfs/tmpfs.h
sys/vfs/tmpfs/tmpfs_subr.c
sys/vfs/tmpfs/tmpfs_vfsops.c

index 609b1c1..7e8a7e6 100644 (file)
@@ -398,6 +398,7 @@ struct tmpfs_mount {
        struct objcache         *tm_dirent_pool;
        struct objcache         *tm_node_pool;
 
+       int                     tm_ino;
        int                     tm_flags;
 
        struct netexport        tm_export;
index c5ae546..14e70b9 100644 (file)
@@ -54,9 +54,7 @@
 #include <vfs/tmpfs/tmpfs.h>
 #include <vfs/tmpfs/tmpfs_vnops.h>
 
-static ino_t t_ino = 2;
-static struct spinlock ino_lock;
-static ino_t tmpfs_fetch_ino(void);
+static ino_t tmpfs_fetch_ino(struct tmpfs_mount *);
 
 /* --------------------------------------------------------------------- */
 
@@ -115,7 +113,7 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type,
        nnode->tn_uid = uid;
        nnode->tn_gid = gid;
        nnode->tn_mode = mode;
-       nnode->tn_id = tmpfs_fetch_ino();
+       nnode->tn_id = tmpfs_fetch_ino(tmp);
        nnode->tn_advlock.init_done = 0;
 
        /* Type-specific initialization. */
@@ -1340,13 +1338,11 @@ out:
 /* --------------------------------------------------------------------- */
 
 static ino_t
-tmpfs_fetch_ino(void)
+tmpfs_fetch_ino(struct tmpfs_mount *tmp)
 {
-       ino_t   ret;
+       ino_t ret;
 
-       spin_lock(&ino_lock);
-       ret = t_ino++;
-       spin_unlock(&ino_lock);
+       ret = tmp->tm_ino++;
 
-       return ret;
+       return (ret);
 }
index f4ab2f4..4aa5eb1 100644 (file)
@@ -251,6 +251,8 @@ tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
            tmpfs_node_init, tmpfs_node_fini,
            &tmp->tm_node_zone_malloc_args);
 
+       tmp->tm_ino = 2;
+
        /* Allocate the root node. */
        error = tmpfs_alloc_node(tmp, VDIR, root_uid, root_gid,
                                 root_mode & ALLPERMS, NULL, NULL,