tmpfs was disabled in GENERIC a bit shy of 7 years ago, is it time to kill it?
Skimming sbin/mount_tmpfs and sys/tmpfs, it looks like the vast majority of the
touches were part of wide-encompassing diffs, along with a couple tmpfs panic
fixes from the mailing lists.
My cvs diff-fu is not strong, the attached diff expects removal of the
following src files:
regress/sys/ffs/tmpfs/*
sbin/mount_tmpfs/*
sys/tmpfs/*
Diff successfully runs a full build + release. Thanks.
Brian Conway
Index: distrib/sets/lists/base/mi
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/mi,v
retrieving revision 1.1095
diff -u -p -u -p -r1.1095 mi
--- distrib/sets/lists/base/mi 10 Mar 2023 16:47:36 -0000 1.1095
+++ distrib/sets/lists/base/mi 19 Apr 2023 12:41:50 -0000
@@ -373,7 +373,6 @@
./sbin/mount_mfs
./sbin/mount_msdos
./sbin/mount_nfs
-./sbin/mount_tmpfs
./sbin/mount_udf
./sbin/mount_vnd
./sbin/mountd
Index: distrib/sets/lists/man/mi
===================================================================
RCS file: /cvs/src/distrib/sets/lists/man/mi,v
retrieving revision 1.1698
diff -u -p -u -p -r1.1698 mi
--- distrib/sets/lists/man/mi 5 Apr 2023 10:34:36 -0000 1.1698
+++ distrib/sets/lists/man/mi 19 Apr 2023 12:41:52 -0000
@@ -2535,7 +2535,6 @@
./usr/share/man/man8/mount_msdos.8
./usr/share/man/man8/mount_nfs.8
./usr/share/man/man8/mount_ntfs.8
-./usr/share/man/man8/mount_tmpfs.8
./usr/share/man/man8/mount_udf.8
./usr/share/man/man8/mount_vnd.8
./usr/share/man/man8/mountd.8
Index: sbin/Makefile
===================================================================
RCS file: /cvs/src/sbin/Makefile,v
retrieving revision 1.110
diff -u -p -u -p -r1.110 Makefile
--- sbin/Makefile 26 Feb 2021 17:17:03 -0000 1.110
+++ sbin/Makefile 19 Apr 2023 12:42:47 -0000
@@ -5,7 +5,7 @@ SUBDIR= atactl badsect bioctl clri dhcli
fsck_msdos fsdb fsirand growfs ifconfig iked init ipsecctl \
isakmpd kbd ldattach mknod mount \
mount_cd9660 mount_ext2fs mount_ffs mount_msdos \
- mount_nfs mount_ntfs mount_tmpfs mount_udf \
+ mount_nfs mount_ntfs mount_udf \
mount_vnd mountd ncheck_ffs newfs newfs_ext2fs newfs_msdos \
nfsd nologin pdisk pfctl pflogd ping quotacheck \
reboot resolvd restore route savecore scan_ffs \
Index: sbin/mount/mount.8
===================================================================
RCS file: /cvs/src/sbin/mount/mount.8,v
retrieving revision 1.90
diff -u -p -u -p -r1.90 mount.8
--- sbin/mount/mount.8 10 Mar 2019 14:42:21 -0000 1.90
+++ sbin/mount/mount.8 19 Apr 2023 12:42:48 -0000
@@ -406,7 +406,6 @@ with option
.Xr mount_msdos 8 ,
.Xr mount_nfs 8 ,
.Xr mount_ntfs 8 ,
-.Xr mount_tmpfs 8 ,
.Xr mount_udf 8 ,
.Xr mount_vnd 8 ,
.Xr sysctl 8 ,
Index: sbin/mount/mount.c
===================================================================
RCS file: /cvs/src/sbin/mount/mount.c,v
retrieving revision 1.76
diff -u -p -u -p -r1.76 mount.c
--- sbin/mount/mount.c 4 Dec 2022 23:50:46 -0000 1.76
+++ sbin/mount/mount.c 19 Apr 2023 12:42:48 -0000
@@ -597,21 +597,6 @@ prmount(struct statfs *sf)
(void)printf("%s%s", !f++ ? " (" : ", ", "gens");
if (iso_args->flags & ISOFSMNT_EXTATT)
(void)printf("%s%s", !f++ ? " (" : ", ", "extatt");
- } else if (strcmp(sf->f_fstypename, MOUNT_TMPFS) == 0) {
- struct tmpfs_args *tmpfs_args = &sf->mount_info.tmpfs_args;
-
- if (verbose || tmpfs_args->ta_root_uid ||
tmpfs_args->ta_root_gid)
- (void)printf("%s%s=%u, %s=%u", !f++ ? " (" : ", ",
- "uid", tmpfs_args->ta_root_uid, "gid",
tmpfs_args->ta_root_gid);
- if (verbose || tmpfs_args->ta_root_mode != 040755)
- (void)printf("%s%s=%04o", !f++ ? " (" : ", ",
- "mode", tmpfs_args->ta_root_mode & 07777);
- if (verbose || tmpfs_args->ta_size_max)
- (void)printf("%s%s=%lu", !f++ ? " (" : ", ",
- "size", (unsigned long)tmpfs_args->ta_size_max);
- if (verbose || tmpfs_args->ta_nodes_max)
- (void)printf("%s%s=%lu", !f++ ? " (" : ", ",
- "inodes", (unsigned long)tmpfs_args->ta_nodes_max);
}
(void)printf(f ? ")\n" : "\n");
}
Index: share/man/man4/options.4
===================================================================
RCS file: /cvs/src/share/man/man4/options.4,v
retrieving revision 1.269
diff -u -p -u -p -r1.269 options.4
--- share/man/man4/options.4 11 Sep 2022 06:38:11 -0000 1.269
+++ share/man/man4/options.4 19 Apr 2023 12:42:49 -0000
@@ -234,10 +234,6 @@ See
Includes code for the UDF file systems typically found on DVD discs.
See
.Xr mount_udf 8 .
-.It Cd option TMPFS
-Includes code for the TMPFS efficient memory file system.
-See
-.Xr mount_tmpfs 8 .
.El
.Sh FILE SYSTEM OPTIONS
.Bl -ohang
Index: share/man/man5/fstab.5
===================================================================
RCS file: /cvs/src/share/man/man5/fstab.5,v
retrieving revision 1.54
diff -u -p -u -p -r1.54 fstab.5
--- share/man/man5/fstab.5 31 Mar 2022 17:27:22 -0000 1.54
+++ share/man/man5/fstab.5 19 Apr 2023 12:42:49 -0000
@@ -121,10 +121,6 @@ A Sun Microsystems compatible Network Fi
An NTFS filesystem.
.It swap
A disk partition to be used for swapping.
-.It tmpfs
-A local memory-based
-.Ux
-filesystem.
.It udf
A UDF filesystem.
.It vnd
Index: sys/conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/conf/GENERIC,v
retrieving revision 1.288
diff -u -p -u -p -r1.288 GENERIC
--- sys/conf/GENERIC 27 Mar 2023 09:39:21 -0000 1.288
+++ sys/conf/GENERIC 19 Apr 2023 12:42:51 -0000
@@ -40,7 +40,6 @@ option CD9660 # ISO 9660 + Rock Ridge
option UDF # UDF (DVD) file system
option MSDOSFS # MS-DOS file system
option FIFO # FIFOs; RECOMMENDED
-#option TMPFS # efficient memory file system
option FUSE # FUSE
option SOCKET_SPLICE # Socket Splicing for TCP and UDP
Index: sys/conf/files
===================================================================
RCS file: /cvs/src/sys/conf/files,v
retrieving revision 1.723
diff -u -p -u -p -r1.723 files
--- sys/conf/files 4 Apr 2023 00:38:37 -0000 1.723
+++ sys/conf/files 19 Apr 2023 12:42:53 -0000
@@ -798,12 +798,6 @@ file ntfs/ntfs_ihash.c ntfs
file ntfs/ntfs_subr.c ntfs
file ntfs/ntfs_vfsops.c ntfs
file ntfs/ntfs_vnops.c ntfs
-file tmpfs/tmpfs_mem.c tmpfs
-file tmpfs/tmpfs_subr.c tmpfs
-file tmpfs/tmpfs_vfsops.c tmpfs
-file tmpfs/tmpfs_vnops.c tmpfs
-file tmpfs/tmpfs_specops.c tmpfs
-file tmpfs/tmpfs_fifoops.c tmpfs & fifo
file net/art.c
file net/bpf.c bpfilter needs-count
file net/bpf_filter.c bpfilter
Index: sys/kern/vfs_init.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_init.c,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 vfs_init.c
--- sys/kern/vfs_init.c 26 Dec 2019 13:30:54 -0000 1.43
+++ sys/kern/vfs_init.c 19 Apr 2023 12:42:54 -0000
@@ -95,11 +95,6 @@ static struct vfsconf vfsconflist[] = {
{ &fusefs_vfsops, MOUNT_FUSEFS, 18, 0, MNT_LOCAL,
sizeof(struct fusefs_args) },
#endif
-
-#ifdef TMPFS
- { &tmpfs_vfsops, MOUNT_TMPFS, 19, 0, MNT_LOCAL,
- sizeof(struct tmpfs_args) },
-#endif
};
Index: sys/sys/mount.h
===================================================================
RCS file: /cvs/src/sys/sys/mount.h,v
retrieving revision 1.148
diff -u -p -u -p -r1.148 mount.h
--- sys/sys/mount.h 6 Apr 2021 14:17:35 -0000 1.148
+++ sys/sys/mount.h 19 Apr 2023 12:42:54 -0000
@@ -223,23 +223,6 @@ struct udf_args {
};
/*
- * Arguments to mount tmpfs file systems
- */
-#define TMPFS_ARGS_VERSION 1
-struct tmpfs_args {
- int ta_version;
-
- /* Size counters. */
- ino_t ta_nodes_max;
- off_t ta_size_max;
-
- /* Root node attributes. */
- uid_t ta_root_uid;
- gid_t ta_root_gid;
- mode_t ta_root_mode;
-};
-
-/*
* Arguments to mount fusefs filesystems
*/
struct fusefs_args {
@@ -272,7 +255,6 @@ union mount_info {
struct iso_args iso_args;
struct msdosfs_args msdosfs_args;
struct ntfs_args ntfs_args;
- struct tmpfs_args tmpfs_args;
char __align[160]; /* 64-bit alignment and room to grow */
};
@@ -323,7 +305,6 @@ struct statfs {
#define MOUNT_NCPFS "ncpfs" /* NetWare Network File System
*/
#define MOUNT_NTFS "ntfs" /* NTFS */
#define MOUNT_UDF "udf" /* UDF */
-#define MOUNT_TMPFS "tmpfs" /* tmpfs */
#define MOUNT_FUSEFS "fuse" /* FUSE */
/*
@@ -557,7 +538,6 @@ extern const struct vfsops ext2fs_vfsops
extern const struct vfsops ntfs_vfsops;
extern const struct vfsops udf_vfsops;
extern const struct vfsops fusefs_vfsops;
-extern const struct vfsops tmpfs_vfsops;
#include <net/radix.h>
#include <sys/socket.h> /* XXX for AF_MAX */
Index: sys/sys/vnode.h
===================================================================
RCS file: /cvs/src/sys/sys/vnode.h,v
retrieving revision 1.168
diff -u -p -u -p -r1.168 vnode.h
--- sys/sys/vnode.h 10 Feb 2023 14:34:17 -0000 1.168
+++ sys/sys/vnode.h 19 Apr 2023 12:42:54 -0000
@@ -66,13 +66,13 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCH
enum vtagtype {
VT_NON, VT_UFS, VT_NFS, VT_MFS, VT_MSDOSFS,
VT_PORTAL, VT_PROCFS, VT_AFS, VT_ISOFS, VT_ADOSFS,
- VT_EXT2FS, VT_VFS, VT_NTFS, VT_UDF, VT_FUSEFS, VT_TMPFS,
+ VT_EXT2FS, VT_VFS, VT_NTFS, VT_UDF, VT_FUSEFS,
};
#define VTAG_NAMES \
"NON", "UFS", "NFS", "MFS", "MSDOSFS", \
"unused", "unused", "unused", "ISOFS", "unused", \
- "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS", "TMPFS"
+ "EXT2FS", "VFS", "NTFS", "UDF", "FUSEFS"
/*
* Each underlying filesystem allocates its own private area and hangs
Index: sys/uvm/uvm_aobj.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
retrieving revision 1.107
diff -u -p -u -p -r1.107 uvm_aobj.c
--- sys/uvm/uvm_aobj.c 29 Aug 2022 02:58:13 -0000 1.107
+++ sys/uvm/uvm_aobj.c 19 Apr 2023 12:42:57 -0000
@@ -154,14 +154,6 @@ static boolean_t uao_pagein(struct uvm
static boolean_t uao_pagein_page(struct uvm_aobj *, int);
void uao_dropswap_range(struct uvm_object *, voff_t, voff_t);
-void uao_shrink_flush(struct uvm_object *, int, int);
-int uao_shrink_hash(struct uvm_object *, int);
-int uao_shrink_array(struct uvm_object *, int);
-int uao_shrink_convert(struct uvm_object *, int);
-
-int uao_grow_hash(struct uvm_object *, int);
-int uao_grow_array(struct uvm_object *, int);
-int uao_grow_convert(struct uvm_object *, int);
/*
* aobj_pager
@@ -382,285 +374,6 @@ uao_free(struct uvm_aobj *aobj)
/*
* pager functions
*/
-
-#ifdef TMPFS
-/*
- * Shrink an aobj to a given number of pages. The procedure is always the same:
- * assess the necessity of data structure conversion (hash to array), secure
- * resources, flush pages and drop swap slots.
- *
- */
-
-void
-uao_shrink_flush(struct uvm_object *uobj, int startpg, int endpg)
-{
- KASSERT(startpg < endpg);
- KASSERT(uobj->uo_refs == 1);
- uao_flush(uobj, (voff_t)startpg << PAGE_SHIFT,
- (voff_t)endpg << PAGE_SHIFT, PGO_FREE);
- uao_dropswap_range(uobj, startpg, endpg);
-}
-
-int
-uao_shrink_hash(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- struct uao_swhash *new_swhash;
- struct uao_swhash_elt *elt;
- unsigned long new_hashmask;
- int i;
-
- KASSERT(UAO_USES_SWHASH(aobj));
-
- /*
- * If the size of the hash table doesn't change, all we need to do is
- * to adjust the page count.
- */
- if (UAO_SWHASH_BUCKETS(aobj->u_pages) == UAO_SWHASH_BUCKETS(pages)) {
- uao_shrink_flush(uobj, pages, aobj->u_pages);
- aobj->u_pages = pages;
- return 0;
- }
-
- new_swhash = hashinit(UAO_SWHASH_BUCKETS(pages), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL, &new_hashmask);
- if (new_swhash == NULL)
- return ENOMEM;
-
- uao_shrink_flush(uobj, pages, aobj->u_pages);
-
- /*
- * Even though the hash table size is changing, the hash of the buckets
- * we are interested in copying should not change.
- */
- for (i = 0; i < UAO_SWHASH_BUCKETS(aobj->u_pages); i++) {
- while (LIST_EMPTY(&aobj->u_swhash[i]) == 0) {
- elt = LIST_FIRST(&aobj->u_swhash[i]);
- LIST_REMOVE(elt, list);
- LIST_INSERT_HEAD(&new_swhash[i], elt, list);
- }
- }
-
- hashfree(aobj->u_swhash, UAO_SWHASH_BUCKETS(aobj->u_pages), M_UVMAOBJ);
-
- aobj->u_swhash = new_swhash;
- aobj->u_pages = pages;
- aobj->u_swhashmask = new_hashmask;
-
- return 0;
-}
-
-int
-uao_shrink_convert(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- struct uao_swhash_elt *elt;
- int i, *new_swslots;
-
- new_swslots = mallocarray(pages, sizeof(int), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL | M_ZERO);
- if (new_swslots == NULL)
- return ENOMEM;
-
- uao_shrink_flush(uobj, pages, aobj->u_pages);
-
- /* Convert swap slots from hash to array. */
- for (i = 0; i < pages; i++) {
- elt = uao_find_swhash_elt(aobj, i, FALSE);
- if (elt != NULL) {
- new_swslots[i] = UAO_SWHASH_ELT_PAGESLOT(elt, i);
- if (new_swslots[i] != 0)
- elt->count--;
- if (elt->count == 0) {
- LIST_REMOVE(elt, list);
- pool_put(&uao_swhash_elt_pool, elt);
- }
- }
- }
-
- hashfree(aobj->u_swhash, UAO_SWHASH_BUCKETS(aobj->u_pages), M_UVMAOBJ);
-
- aobj->u_swslots = new_swslots;
- aobj->u_pages = pages;
-
- return 0;
-}
-
-int
-uao_shrink_array(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- int i, *new_swslots;
-
- new_swslots = mallocarray(pages, sizeof(int), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL | M_ZERO);
- if (new_swslots == NULL)
- return ENOMEM;
-
- uao_shrink_flush(uobj, pages, aobj->u_pages);
-
- for (i = 0; i < pages; i++)
- new_swslots[i] = aobj->u_swslots[i];
-
- free(aobj->u_swslots, M_UVMAOBJ, aobj->u_pages * sizeof(int));
-
- aobj->u_swslots = new_swslots;
- aobj->u_pages = pages;
-
- return 0;
-}
-
-int
-uao_shrink(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
-
- KASSERT(pages < aobj->u_pages);
-
- /*
- * Distinguish between three possible cases:
- * 1. aobj uses hash and must be converted to array.
- * 2. aobj uses array and array size needs to be adjusted.
- * 3. aobj uses hash and hash size needs to be adjusted.
- */
- if (pages > UAO_SWHASH_THRESHOLD)
- return uao_shrink_hash(uobj, pages); /* case 3 */
- else if (aobj->u_pages > UAO_SWHASH_THRESHOLD)
- return uao_shrink_convert(uobj, pages); /* case 1 */
- else
- return uao_shrink_array(uobj, pages); /* case 2 */
-}
-
-/*
- * Grow an aobj to a given number of pages. Right now we only adjust the swap
- * slots. We could additionally handle page allocation directly, so that they
- * don't happen through uvm_fault(). That would allow us to use another
- * mechanism for the swap slots other than malloc(). It is thus mandatory that
- * the caller of these functions does not allow faults to happen in case of
- * growth error.
- */
-int
-uao_grow_array(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- int i, *new_swslots;
-
- KASSERT(aobj->u_pages <= UAO_SWHASH_THRESHOLD);
-
- new_swslots = mallocarray(pages, sizeof(int), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL | M_ZERO);
- if (new_swslots == NULL)
- return ENOMEM;
-
- for (i = 0; i < aobj->u_pages; i++)
- new_swslots[i] = aobj->u_swslots[i];
-
- free(aobj->u_swslots, M_UVMAOBJ, aobj->u_pages * sizeof(int));
-
- aobj->u_swslots = new_swslots;
- aobj->u_pages = pages;
-
- return 0;
-}
-
-int
-uao_grow_hash(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- struct uao_swhash *new_swhash;
- struct uao_swhash_elt *elt;
- unsigned long new_hashmask;
- int i;
-
- KASSERT(pages > UAO_SWHASH_THRESHOLD);
-
- /*
- * If the size of the hash table doesn't change, all we need to do is
- * to adjust the page count.
- */
- if (UAO_SWHASH_BUCKETS(aobj->u_pages) == UAO_SWHASH_BUCKETS(pages)) {
- aobj->u_pages = pages;
- return 0;
- }
-
- KASSERT(UAO_SWHASH_BUCKETS(aobj->u_pages) < UAO_SWHASH_BUCKETS(pages));
-
- new_swhash = hashinit(UAO_SWHASH_BUCKETS(pages), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL, &new_hashmask);
- if (new_swhash == NULL)
- return ENOMEM;
-
- for (i = 0; i < UAO_SWHASH_BUCKETS(aobj->u_pages); i++) {
- while (LIST_EMPTY(&aobj->u_swhash[i]) == 0) {
- elt = LIST_FIRST(&aobj->u_swhash[i]);
- LIST_REMOVE(elt, list);
- LIST_INSERT_HEAD(&new_swhash[i], elt, list);
- }
- }
-
- hashfree(aobj->u_swhash, UAO_SWHASH_BUCKETS(aobj->u_pages), M_UVMAOBJ);
-
- aobj->u_swhash = new_swhash;
- aobj->u_pages = pages;
- aobj->u_swhashmask = new_hashmask;
-
- return 0;
-}
-
-int
-uao_grow_convert(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
- struct uao_swhash *new_swhash;
- struct uao_swhash_elt *elt;
- unsigned long new_hashmask;
- int i, *old_swslots;
-
- new_swhash = hashinit(UAO_SWHASH_BUCKETS(pages), M_UVMAOBJ,
- M_WAITOK | M_CANFAIL, &new_hashmask);
- if (new_swhash == NULL)
- return ENOMEM;
-
- /* Set these now, so we can use uao_find_swhash_elt(). */
- old_swslots = aobj->u_swslots;
- aobj->u_swhash = new_swhash;
- aobj->u_swhashmask = new_hashmask;
-
- for (i = 0; i < aobj->u_pages; i++) {
- if (old_swslots[i] != 0) {
- elt = uao_find_swhash_elt(aobj, i, TRUE);
- elt->count++;
- UAO_SWHASH_ELT_PAGESLOT(elt, i) = old_swslots[i];
- }
- }
-
- free(old_swslots, M_UVMAOBJ, aobj->u_pages * sizeof(int));
- aobj->u_pages = pages;
-
- return 0;
-}
-
-int
-uao_grow(struct uvm_object *uobj, int pages)
-{
- struct uvm_aobj *aobj = (struct uvm_aobj *)uobj;
-
- KASSERT(pages > aobj->u_pages);
-
- /*
- * Distinguish between three possible cases:
- * 1. aobj uses hash and hash size needs to be adjusted.
- * 2. aobj uses array and array size needs to be adjusted.
- * 3. aobj uses array and must be converted to hash.
- */
- if (pages <= UAO_SWHASH_THRESHOLD)
- return uao_grow_array(uobj, pages); /* case 2 */
- else if (aobj->u_pages > UAO_SWHASH_THRESHOLD)
- return uao_grow_hash(uobj, pages); /* case 1 */
- else
- return uao_grow_convert(uobj, pages);
-}
-#endif /* TMPFS */
/*
* uao_create: create an aobj of the given size and return its uvm_object.