X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/d31d6d83b77479ab4a835214231c16f30b9ea28f..29ca4fd6da8bb70ae90d8e73ea3c47fda22491a7:/sys/vfs/tmpfs/tmpfs_vfsops.c diff --git a/sys/vfs/tmpfs/tmpfs_vfsops.c b/sys/vfs/tmpfs/tmpfs_vfsops.c index 55b2ffc770..de23cb7d3b 100644 --- a/sys/vfs/tmpfs/tmpfs_vfsops.c +++ b/sys/vfs/tmpfs/tmpfs_vfsops.c @@ -186,14 +186,21 @@ tmpfs_mount(struct mount *mp, char *path, caddr_t data, struct ucred *cred) pages_limit = vm_swap_max + vmstats.v_page_count / 2; - if (size_max == 0) + if (size_max == 0) { pages = pages_limit / 2; - else if (size_max < PAGE_SIZE) + } else if (size_max < PAGE_SIZE) { pages = 1; - else if (OFF_TO_IDX(size_max) > pages_limit) - pages = pages_limit; - else + } else if (OFF_TO_IDX(size_max) > pages_limit) { + /* + * do not force pages = pages_limit for this case, otherwise + * we might not honor tmpfs size requests from /etc/fstab + * during boot because they are mounted prior to swap being + * turned on. + */ + pages = OFF_TO_IDX(size_max); + } else { pages = OFF_TO_IDX(size_max); + } if (nodes_max == 0) nodes = 3 + pages * PAGE_SIZE / 1024; @@ -244,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, @@ -342,8 +351,8 @@ tmpfs_unmount(struct mount *mp, int mntflags) if (node->tn_type == VDIR) { struct tmpfs_dirent *de; - while (!TAILQ_EMPTY(&node->tn_dir.tn_dirhead)) { - de = TAILQ_FIRST(&node->tn_dir.tn_dirhead); + while (!RB_EMPTY(&node->tn_dir.tn_dirtree)) { + de = RB_FIRST(tmpfs_dirtree, &node->tn_dir.tn_dirtree); tmpfs_dir_detach(node, de); tmpfs_free_dirent(tmp, de); node->tn_size -= sizeof(struct tmpfs_dirent);