tmpfs: Set tmpfs node malloc zone limit to be the same as tm_node_max.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Sun, 22 Aug 2010 12:17:43 +0000 (05:17 -0700)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Sun, 22 Aug 2010 12:17:43 +0000 (05:17 -0700)
This doesn't resolve panics from running fsstress on tmpfs, but it is a first
step towards solving these problems. No consideration of multiple tmpfs mounts
at the minute either.

sys/vfs/tmpfs/tmpfs_subr.c
sys/vfs/tmpfs/tmpfs_vfsops.c

index 265a636..564c8b7 100644 (file)
@@ -102,7 +102,7 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type,
        KKASSERT(IFF(type == VLNK, target != NULL));
        KKASSERT(IFF(type == VBLK || type == VCHR, rmajor != VNOVAL));
 
-       if (tmp->tm_nodes_inuse > tmp->tm_nodes_max)
+       if (tmp->tm_nodes_inuse >= tmp->tm_nodes_max)
                return (ENOSPC);
 
        nnode = (struct tmpfs_node *)objcache_get(tmp->tm_node_pool, M_WAITOK);
index 2dc8e55..f9d8cdc 100644 (file)
@@ -226,6 +226,9 @@ tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred)
        tmp->tm_pages_max = pages;
        tmp->tm_pages_used = 0;
 
+       kmalloc_raise_limit(M_TMPFS_NODE, sizeof(struct tmpfs_node) *
+                           tmp->tm_nodes_max);
+
        tmp->tm_dirent_pool =  objcache_create( "tmpfs dirent cache",
            0, 0,
            NULL, NULL, NULL,