From da85998867e287b07fd1ddcb27840f30ec4bb5f8 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sun, 27 Dec 2020 14:25:17 +0100
Subject: [PATCH 01/10] Remove last traces of FSMID support from userland.

The kernel side was removed in d98152a8b8a4b368ca0e08b84302f2f2b299525d.
---
 bin/cpdup/Makefile             |   2 +-
 bin/cpdup/cpdup.1              |  31 +-----
 bin/cpdup/cpdup.c              |  59 +---------
 bin/cpdup/cpdup.h              |   4 -
 bin/cpdup/fsmid.c              | 197 ---------------------------------
 bin/cpdup/hcproto.c            |  10 --
 bin/cpdup/hcproto.h            |   4 +-
 bin/cpdup/misc.c               |   3 -
 bin/ls/ls.1                    |   6 +-
 bin/ls/ls.c                    |  33 +-----
 bin/ls/ls.h                    |   3 -
 bin/ls/print.c                 |   2 -
 sys/sys/mount.h                |   1 -
 sys/sys/stat.h                 |   6 -
 sys/vfs/hammer/hammer_vfsops.c |   1 -
 sys/vfs/ufs/ffs_vfsops.c       |   5 -
 16 files changed, 11 insertions(+), 356 deletions(-)
 delete mode 100644 bin/cpdup/fsmid.c

diff --git a/bin/cpdup/Makefile b/bin/cpdup/Makefile
index 84f5617b97..c95639efdb 100644
--- a/bin/cpdup/Makefile
+++ b/bin/cpdup/Makefile
@@ -1,5 +1,5 @@
 PROG=	cpdup
-SRCS=	cpdup.c hcproto.c hclink.c misc.c fsmid.c
+SRCS=	cpdup.c hcproto.c hclink.c misc.c
 
 .if defined(BOOTSTRAPPING) || defined(RESCUE)
 # For boostrapping buildworld the md5 functionality is not needed
diff --git a/bin/cpdup/cpdup.1 b/bin/cpdup/cpdup.1
index f0071d7905..9ec142a897 100644
--- a/bin/cpdup/cpdup.1
+++ b/bin/cpdup/cpdup.1
@@ -2,7 +2,7 @@
 .\"    Permission to use and distribute based on the DragonFly copyright.
 .\"    Supplied as-is, USE WITH CAUTION.
 .\"
-.Dd November 24, 2009
+.Dd December 26, 2020
 .Dt CPDUP 1
 .Os
 .Sh NAME
@@ -31,8 +31,6 @@
 .Op Fl VV
 .Op Fl S
 .Op Fl R
-.Op Fl k
-.Op Fl K Ar file
 .Op Fl X Ar file
 .Op Fl x
 .Oo Oo Ar user Ns Li @ Oc Ns Ar host : Oc Ns Ar source_dir
@@ -203,33 +201,6 @@ This option is not intended to be used by humans.
 Place the slave into read-only mode.
 Can only be used when the source is remote.
 Useful for unattended backups via SSH keys.
-.It Fl k
-Generate and maintain a FSMID checkfile called
-.Pa \& .FSMID.CHECK
-in each directory on the target.
-.Nm
-will check the FSMID for each source file or directory against the checkfile
-on the target and will not copy the file or recurse through the directory
-when a match occurs.  Any source file or directory with the same name as the
-checkfile will be ignored.  The FSMID will be re-checked after the copy
-has been completed and
-.Nm
-will loop on that directory or file until it is sure it has an exact copy.
-.Pp
-Warning: FSMID is not always supported by a filesystem and may not be
-synchronized if a crash occurs.
-.Dx
-will simulate an FSMID when
-it is otherwise not supported by the filesystem, and users should be aware
-that simulated FSMIDs may change state in such cases even if the underlying
-hierarchy does not due to cache flushes.
-Additionally, the FSMID may not reflect changes made to remote filesystems
-by other hosts.  For example, using these options with NFS mounted sources
-will not work well.
-.It Fl K Ar file
-Works the same as
-.Fl k
-but allows you to specify the name of the FSMID checkfile.
 .It Fl x
 Causes
 .Nm
diff --git a/bin/cpdup/cpdup.c b/bin/cpdup/cpdup.c
index 05d33cf4bc..e5eeb1a759 100644
--- a/bin/cpdup/cpdup.c
+++ b/bin/cpdup/cpdup.c
@@ -44,8 +44,6 @@
  *
  *	- Is able to do incremental mirroring/backups via hardlinks from
  *	  the 'previous' version (supplied with -H path).
- *
- * $DragonFly: src/bin/cpdup/cpdup.c,v 1.32 2008/11/11 04:36:00 dillon Exp $
  */
 
 /*-
@@ -149,7 +147,6 @@ int NotForRealOpt;
 int QuietOpt;
 int NoRemoveOpt;
 int UseMD5Opt;
-int UseFSMIDOpt;
 int SummaryOpt;
 int CompressOpt;
 int SlaveOpt;
@@ -161,7 +158,6 @@ int DstRootPrivs;
 
 const char *UseCpFile;
 const char *MD5CacheFile;
-const char *FSMIDCacheFile;
 const char *UseHLPath;
 
 static int DstBaseLen;
@@ -196,7 +192,7 @@ main(int ac, char **av)
 
     gettimeofday(&start, NULL);
     opterr = 0;
-    while ((opt = getopt(ac, av, ":CdF:fH:hIi:j:K:klM:mnoqRSs:uVvX:x")) != -1) {
+    while ((opt = getopt(ac, av, ":CdF:fH:hIi:j:lM:mnoqRSs:uVvX:x")) != -1) {
 	switch (opt) {
 	case 'C':
 	    CompressOpt = 1;
@@ -228,14 +224,6 @@ main(int ac, char **av)
 	case 'j':
 	    DeviceOpt = getbool(optarg);
 	    break;
-	case 'K':
-	    UseFSMIDOpt = 1;
-	    FSMIDCacheFile = optarg;
-	    break;
-	case 'k':
-	    UseFSMIDOpt = 1;
-	    FSMIDCacheFile = ".FSMID.CHECK";
-	    break;
 	case 'l':
 	    setlinebuf(stdout);
 	    setlinebuf(stderr);
@@ -333,8 +321,6 @@ main(int ac, char **av)
     if (dst && (ptr = SplitRemote(&dst)) != NULL) {
 	DstHost.host = dst;
 	dst = ptr;
-	if (UseFSMIDOpt)
-	    fatal("The FSMID options are not currently supported for remote targets");
 	if (hc_connect(&DstHost, 0) < 0)
 	    exit(1);
     } else {
@@ -381,7 +367,6 @@ main(int ac, char **av)
 #ifndef NOMD5
     md5_flush();
 #endif
-    fsmid_flush();
 
     if (SummaryOpt && i == 0) {
 	double duration;
@@ -815,8 +800,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
 
     /*
      * Do we need to copy the file/dir/link/whatever?  Early termination
-     * if we do not.  Always redo links.  Directories are always traversed
-     * except when the FSMID options are used.
+     * if we do not.  Always traverse directories.  Always redo links.
      *
      * NOTE: st2Valid is true only if dpath != NULL *and* dpath stats good.
      */
@@ -827,24 +811,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
 	&& FlagsMatch(stat1, &st2)
     ) {
 	if (S_ISLNK(stat1->st_mode) || S_ISDIR(stat1->st_mode)) {
-	    /*
-	     * If FSMID tracking is turned on we can avoid recursing through
-	     * an entire directory subtree if the FSMID matches.
-	     */
-#ifdef _ST_FSMID_PRESENT_
-	    if (ForceOpt == 0 &&
-		(UseFSMIDOpt && (fres = fsmid_check(stat1->st_fsmid, dpath)) == 0)
-	    ) {
-		if (VerboseOpt >= 3) {
-		    if (UseFSMIDOpt) /* always true!?! */
-			logstd("%-32s fsmid-nochange\n", (dpath ? dpath : spath));
-		    else
-			logstd("%-32s nochange\n", (dpath ? dpath : spath));
-		}
-		r = 0;
-		goto done;
-	    }
-#endif
+	    ;
 	} else {
 	    if (ForceOpt == 0 &&
 		stat1->st_size == st2.st_size &&
@@ -853,10 +820,6 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
 #ifndef NOMD5
 		&& (UseMD5Opt == 0 || !S_ISREG(stat1->st_mode) ||
 		    (mres = md5_check(spath, dpath)) == 0)
-#endif
-#ifdef _ST_FSMID_PRESENT_
-		&& (UseFSMIDOpt == 0 ||
-		    (fres = fsmid_check(stat1->st_fsmid, dpath)) == 0)
 #endif
 		&& (ValidateOpt == 0 || !S_ISREG(stat1->st_mode) ||
 		    validate_check(spath, dpath) == 0)
@@ -888,10 +851,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
 				(dpath ? dpath : spath));
 		    } else
 #endif
-		    if (UseFSMIDOpt) {
-			logstd("%-32s fsmid-nochange",
-				(dpath ? dpath : spath));
-		    } else if (ValidateOpt) {
+		    if (ValidateOpt) {
 			logstd("%-32s nochange (contents validated)",
 				(dpath ? dpath : spath));
 		    } else {
@@ -935,9 +895,6 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
     if (S_ISDIR(stat1->st_mode)) {
 	int skipdir = 0;
 
-	if (fres < 0)
-	    logerr("%-32s/ fsmid-CHECK-FAILED\n", (dpath) ? dpath : spath);
-
 	if (dpath) {
 	    if (!st2Valid || S_ISDIR(st2.st_mode) == 0) {
 		if (st2Valid)
@@ -1128,10 +1085,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
 #ifndef NOMD5
 	if (mres < 0)
 	    logerr("%-32s md5-CHECK-FAILED\n", (dpath) ? dpath : spath);
-	else
 #endif
-	if (fres < 0)
-	    logerr("%-32s fsmid-CHECK-FAILED\n", (dpath) ? dpath : spath);
 
 	/*
 	 * Not quite ready to do the copy yet.  If UseHLPath is defined,
@@ -1477,14 +1431,9 @@ ScanDir(List *list, struct HostConf *host, const char *path,
 	/*
 	 * Automatically exclude MD5CacheFile that we create on the
 	 * source from the copy to the destination.
-	 *
-	 * Automatically exclude a FSMIDCacheFile on the source that
-	 * would otherwise overwrite the one we maintain on the target.
 	 */
 	if (UseMD5Opt)
 	    AddList(list, MD5CacheFile, 1, NULL);
-	if (UseFSMIDOpt)
-	    AddList(list, FSMIDCacheFile, 1, NULL);
     }
 
     if ((dir = hc_opendir(host, path)) == NULL)
diff --git a/bin/cpdup/cpdup.h b/bin/cpdup/cpdup.h
index 6ea8803449..9f2bc13ab8 100644
--- a/bin/cpdup/cpdup.h
+++ b/bin/cpdup/cpdup.h
@@ -61,8 +61,6 @@ int16_t hc_bswap16(int16_t var);
 int32_t hc_bswap32(int32_t var);
 int64_t hc_bswap64(int64_t var);
 
-int fsmid_check(int64_t fsmid, const char *dpath);
-void fsmid_flush(void);
 #ifndef NOMD5
 int md5_check(const char *spath, const char *dpath);
 void md5_flush(void);
@@ -70,7 +68,6 @@ void md5_flush(void);
 
 extern const char *UseCpFile;
 extern const char *MD5CacheFile;
-extern const char *FSMIDCacheFile;
 extern const char *UseHLPath;
 
 extern int AskConfirmation;
@@ -83,7 +80,6 @@ extern int QuietOpt;
 extern int NotForRealOpt;
 extern int NoRemoveOpt;
 extern int UseMD5Opt;
-extern int UseFSMIDOpt;
 extern int SlaveOpt;
 extern int SummaryOpt;
 extern int CompressOpt;
diff --git a/bin/cpdup/fsmid.c b/bin/cpdup/fsmid.c
deleted file mode 100644
index d1b17f434f..0000000000
--- a/bin/cpdup/fsmid.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * FSMID.C
- *
- * (c) Copyright 1997-1999,2006 by Matthew Dillon.  Permission to
- *     use and distribute based on the FreeBSD copyright.
- *
- * $DragonFly: src/bin/cpdup/fsmid.c,v 1.3 2008/11/10 14:30:02 swildner Exp $
- */
-
-#include "cpdup.h"
-
-typedef struct FSMIDNode {
-    struct FSMIDNode *fid_Next;
-    char *fid_Name;
-    int64_t fid_Code;
-    int fid_Accessed;
-} FSMIDNode;
-
-static FSMIDNode *fsmid_lookup(const char *sfile);
-static void fsmid_cache(const char *dpath, int ddirlen);
-
-static char *FSMIDDCache;	/* cache source directory name */
-static FSMIDNode *FSMIDBase;
-static int FSMIDDCacheDirLen;
-static int FSMIDDCacheDirty;
-
-void
-fsmid_flush(void)
-{
-    if (FSMIDDCacheDirty && FSMIDDCache && NotForRealOpt == 0) {
-	FILE *fo;
-
-	if ((fo = fopen(FSMIDDCache, "w")) != NULL) {
-	    FSMIDNode *node;
-
-	    for (node = FSMIDBase; node; node = node->fid_Next) {
-		if (node->fid_Accessed && node->fid_Code) {
-		    fprintf(fo, "%016jx %zu %s\n",
-			(intmax_t)node->fid_Code,
-			strlen(node->fid_Name),
-			node->fid_Name
-		    );
-		}
-	    }
-	    fclose(fo);
-	}
-    }
-
-    FSMIDDCacheDirty = 0;
-
-    if (FSMIDDCache) {
-	FSMIDNode *node;
-
-	while ((node = FSMIDBase) != NULL) {
-	    FSMIDBase = node->fid_Next;
-
-	    if (node->fid_Name)
-		free(node->fid_Name);
-	    free(node);
-	}
-	free(FSMIDDCache);
-	FSMIDDCache = NULL;
-    }
-}
-
-static void
-fsmid_cache(const char *dpath, int ddirlen)
-{
-    FILE *fi;
-
-    /*
-     * Already cached
-     */
-
-    if (
-	FSMIDDCache &&
-	ddirlen == FSMIDDCacheDirLen &&
-	strncmp(dpath, FSMIDDCache, ddirlen) == 0
-    ) {
-	return;
-    }
-
-    /*
-     * Different cache, flush old cache
-     */
-
-    if (FSMIDDCache != NULL)
-	fsmid_flush();
-
-    /*
-     * Create new cache
-     */
-
-    FSMIDDCacheDirLen = ddirlen;
-    FSMIDDCache = mprintf("%*.*s%s", ddirlen, ddirlen, dpath, FSMIDCacheFile);
-
-    if ((fi = fopen(FSMIDDCache, "r")) != NULL) {
-	FSMIDNode **pnode = &FSMIDBase;
-	int c;
-
-	c = fgetc(fi);
-	while (c != EOF) {
-	    FSMIDNode *node = *pnode = malloc(sizeof(FSMIDNode));
-	    char *s;
-	    int nlen;
-
-	    nlen = 0;
-
-	    if (pnode == NULL || node == NULL)
-		fatal("out of memory");
-
-	    bzero(node, sizeof(FSMIDNode));
-	    node->fid_Code = strtoull(fextract(fi, -1, &c, ' '), NULL, 16);
-	    node->fid_Accessed = 1;
-	    if ((s = fextract(fi, -1, &c, ' ')) != NULL) {
-		nlen = strtol(s, NULL, 0);
-		free(s);
-	    }
-	    /*
-	     * extracting fid_Name - name may contain embedded control
-	     * characters.
-	     */
-	    CountSourceReadBytes += nlen+1;
-	    node->fid_Name = fextract(fi, nlen, &c, EOF);
-	    if (c != '\n') {
-		fprintf(stderr, "Error parsing FSMID Cache: %s (%c)\n", FSMIDDCache, c);
-		while (c != EOF && c != '\n')
-		    c = fgetc(fi);
-	    }
-	    if (c != EOF)
-		c = fgetc(fi);
-	    pnode = &node->fid_Next;
-	}
-	fclose(fi);
-    }
-}
-
-/*
- * fsmid_lookup:	lookup/create fsmid entry
- */
-
-static FSMIDNode *
-fsmid_lookup(const char *sfile)
-{
-    FSMIDNode **pnode;
-    FSMIDNode *node;
-
-    for (pnode = &FSMIDBase; (node = *pnode) != NULL; pnode = &node->fid_Next) {
-	if (strcmp(sfile, node->fid_Name) == 0) {
-	    break;
-	}
-    }
-    if (node == NULL) {
-	if ((node = *pnode = malloc(sizeof(FSMIDNode))) == NULL)
-	    fatal("out of memory");
-	bzero(node, sizeof(FSMIDNode));
-	node->fid_Name = strdup(sfile);
-	FSMIDDCacheDirty = 1;
-    }
-    node->fid_Accessed = 1;
-    return(node);
-}
-
-/*
- * fsmid_check:  check FSMID against file
- *
- *	Return -1 if check failed
- *	Return 0  if check succeeded
- *
- * dpath can be NULL, in which case we are force-updating
- * the source FSMID.
- */
-int
-fsmid_check(int64_t fsmid, const char *dpath)
-{
-    const char *dfile;
-    int ddirlen;
-    FSMIDNode *node;
-
-    if ((dfile = strrchr(dpath, '/')) != NULL)
-	++dfile;
-    else
-	dfile = dpath;
-    ddirlen = dfile - dpath;
-
-    fsmid_cache(dpath, ddirlen);
-
-    node = fsmid_lookup(dfile);
-
-    if (node->fid_Code != fsmid) {
-	node->fid_Code = fsmid;
-	FSMIDDCacheDirty = 1;
-	return(1);
-    }
-    return(0);
-}
-
diff --git a/bin/cpdup/hcproto.c b/bin/cpdup/hcproto.c
index cac23314b1..cc56958058 100644
--- a/bin/cpdup/hcproto.c
+++ b/bin/cpdup/hcproto.c
@@ -2,8 +2,6 @@
  * HCPROTO.C
  *
  * This module implements a simple remote control protocol
- *
- * $DragonFly: src/bin/cpdup/hcproto.c,v 1.8 2008/11/11 04:36:00 dillon Exp $
  */
 
 #include "cpdup.h"
@@ -319,11 +317,6 @@ hc_decode_stat_item(struct stat *st, struct HCLeaf *item)
     case LC_BLKSIZE:
 	st->st_blksize = HCC_INT32(item);
 	break;
-#ifdef _ST_FSMID_PRESENT_
-    case LC_FSMID:
-	st->st_fsmid = HCC_INT64(item);
-	break;
-#endif
 #ifdef _ST_FLAGS_PRESENT_
     case LC_FILEFLAGS:
 	st->st_flags = (uint32_t)HCC_INT64(item);
@@ -397,9 +390,6 @@ rc_encode_stat(hctransaction_t trans, struct stat *st)
     hcc_leaf_int64(trans, LC_FILESIZE, st->st_size);
     hcc_leaf_int64(trans, LC_FILEBLKS, st->st_blocks);
     hcc_leaf_int32(trans, LC_BLKSIZE, st->st_blksize);
-#ifdef _ST_FSMID_PRESENT_
-    hcc_leaf_int64(trans, LC_FSMID, st->st_fsmid);
-#endif
 #ifdef _ST_FLAGS_PRESENT_
     hcc_leaf_int64(trans, LC_FILEFLAGS, st->st_flags);
 #endif
diff --git a/bin/cpdup/hcproto.h b/bin/cpdup/hcproto.h
index 7188b5c2a8..b9cdd4f20a 100644
--- a/bin/cpdup/hcproto.h
+++ b/bin/cpdup/hcproto.h
@@ -1,7 +1,5 @@
 /*
  * HCPROTO.H
- *
- * $DragonFly: src/bin/cpdup/hcproto.h,v 1.4 2008/04/16 17:38:19 dillon Exp $
  */
 
 #ifndef _HCPROTO_H_
@@ -64,7 +62,7 @@
 #define LC_FILESIZE	(0x0020|LCF_INT64)
 #define LC_FILEBLKS	(0x0021|LCF_INT64)
 #define LC_FILEFLAGS	(0x0022|LCF_INT64)
-#define LC_FSMID	(0x0023|LCF_INT64)
+#define LC_UNUSED23	(0x0023|LCF_INT64)
 #define LC_DESCRIPTOR	(0x0024|LCF_INT32)
 #define LC_DATA		(0x0025|LCF_BINARY)
 #define LC_TYPE		(0x0026|LCF_INT32)
diff --git a/bin/cpdup/misc.c b/bin/cpdup/misc.c
index b43d54e6ff..126bec1960 100644
--- a/bin/cpdup/misc.c
+++ b/bin/cpdup/misc.c
@@ -178,9 +178,6 @@ fatal(const char *ctl, ...)
 	     "    -I          display performance summary\n"
 	     "    -i0         do NOT confirm when removing something\n"
 	     "    -j0         do not try to recreate CHR or BLK devices\n"
-	     "    -k          maintain/generate FSMID checkfile on target,\n"
-	     "                and compare source FSMIDs against the checkfiles\n"
-	     "    -K file     -k+specify FSMID checkfile, else .FSMID.CHECK\n"
 	     "    -l          force line-buffered stdout/stderr"
 	);
 #ifndef NOMD5
diff --git a/bin/ls/ls.1 b/bin/ls/ls.1
index eef0caccfc..de60c31026 100644
--- a/bin/ls/ls.1
+++ b/bin/ls/ls.1
@@ -31,7 +31,7 @@
 .\"     @(#)ls.1	8.7 (Berkeley) 7/29/94
 .\" $FreeBSD: src/bin/ls/ls.1,v 1.86 2005/02/13 22:25:09 ru Exp $
 .\"
-.Dd December 26, 2017
+.Dd December 27, 2020
 .Dt LS 1
 .Os
 .Sh NAME
@@ -280,10 +280,6 @@ The same as
 .Fl C ,
 except that the multi-column output is produced with entries sorted
 across, rather than down, the columns.
-.It Fl y
-Include the FSMID field in a long
-.Pq Fl l
-output.
 .It Fl 1
 (The numeric digit
 .Dq one . )
diff --git a/bin/ls/ls.c b/bin/ls/ls.c
index 18cee1f031..9cc01e4810 100644
--- a/bin/ls/ls.c
+++ b/bin/ls/ls.c
@@ -94,7 +94,6 @@ int termwidth = 80;		/* default terminal width */
 /* flags */
        int f_accesstime;	/* use time of last access */
        int f_flags;		/* show flags associated with a file */
-       int f_fsmid;		/* show FSMID associated with a file */
        int f_humanval;		/* show human-readable file sizes */
        int f_inode;		/* print inode */
 static int f_kblocks;		/* print size in kilobytes */
@@ -175,7 +174,7 @@ main(int argc, char *argv[])
 
 	fts_options = FTS_PHYSICAL;
 	while ((ch = getopt(argc, argv,
-	    "1ABCD:FGHILPRSTW_abcdfghiklmnopqrstuwxy")) != -1) {
+	    "1ABCD:FGHILPRSTW_abcdfghiklmnopqrstuwx")) != -1) {
 		switch (ch) {
 		/*
 		 * The -1, -C, -x and -l options all override each other so
@@ -204,11 +203,6 @@ main(int argc, char *argv[])
 			f_longform = 0;
 			f_singlecol = 0;
 			break;
-		case 'y':
-#ifdef _ST_FSMID_PRESENT_
-			f_fsmid = 1;
-#endif
-			break;
 		/* The -c and -u options override each other. */
 		case 'c':
 			f_statustime = 1;
@@ -554,14 +548,11 @@ display(const FTSENT *p, FTSENT *list)
 	int bcfile, maxflags;
 	gid_t maxgroup;
 	uid_t maxuser;
-	size_t fsmidlen, flen, ulen, glen;
+	size_t flen, ulen, glen;
 	char *initmax;
 	int entries, needstats;
 	const char *user, *group;
 	char *flags;
-#ifdef _ST_FSMID_PRESENT_
-	int64_t fsmid;
-#endif
 	char buf[STRBUF_SIZEOF(u_quad_t) + 1];
 	char ngroup[STRBUF_SIZEOF(uid_t) + 1];
 	char nuser[STRBUF_SIZEOF(gid_t) + 1];
@@ -719,20 +710,9 @@ display(const FTSENT *p, FTSENT *list)
 				} else {
 					flen = 0;
 				}
-#ifdef _ST_FSMID_PRESENT_
-				if (f_fsmid) {
-					fsmid = sp->st_fsmid;
-					fsmidlen = 18;
-				} else {
-					fsmid = 0;
-					fsmidlen = 0;
-				}
-#else
-				fsmidlen = 0;
-#endif
 
 				if ((np = malloc(sizeof(NAMES) +
-				    ulen + glen + flen + fsmidlen + 4)) == NULL)
+				    ulen + glen + flen + 3)) == NULL)
 					err(1, "malloc");
 
 				np->user = &np->data[0];
@@ -749,13 +729,6 @@ display(const FTSENT *p, FTSENT *list)
 					strcpy(np->flags, flags);
 					free(flags);
 				}
-#ifdef _ST_FSMID_PRESENT_
-				if (f_fsmid) {
-					np->fsmid = np->data + ulen + glen + flen + 3;
-					snprintf(np->fsmid, fsmidlen + 1,
-						 "%016jx", (intmax_t)fsmid);
-				}
-#endif
 				cur->fts_pointer = np;
 			}
 		}
diff --git a/bin/ls/ls.h b/bin/ls/ls.h
index 279d950a1d..c980de5496 100644
--- a/bin/ls/ls.h
+++ b/bin/ls/ls.h
@@ -39,7 +39,6 @@ extern long blocksize;		/* block size units */
 
 extern int f_accesstime;	/* use time of last access */
 extern int f_flags;		/* show flags associated with a file */
-extern int f_fsmid;		/* show FSMID associated with a file */
 extern int f_humanval;		/* show human-readable file sizes */
 extern int f_inode;		/* print inode */
 extern int f_longform;		/* long listing format */
@@ -67,7 +66,6 @@ typedef struct {
 	int maxlen;
 	u_int s_block;
 	u_int s_flags;
-	u_int s_fsmid;
 	u_int s_group;
 	u_int s_inode;
 	u_int s_nlink;
@@ -79,6 +77,5 @@ typedef struct {
 	char *user;
 	char *group;
 	char *flags;
-	char *fsmid;
 	char data[1];
 } NAMES;
diff --git a/bin/ls/print.c b/bin/ls/print.c
index 630a54314b..8ebfc57bd5 100644
--- a/bin/ls/print.c
+++ b/bin/ls/print.c
@@ -153,8 +153,6 @@ printlong(const DISPLAY *dp)
 		printf("%s %*u %-*s  %-*s  ", buf, dp->s_nlink,
 		    sp->st_nlink, dp->s_user, np->user, dp->s_group,
 		    np->group);
-		if (f_fsmid)
-			printf("%s ", np->fsmid);
 		if (f_flags)
 			printf("%-*s ", dp->s_flags, np->flags);
 		if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode))
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index c0c5d18d07..eb94421e14 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -356,7 +356,6 @@ struct mount {
 #define MNTK_UNMOUNT	0x01000000	/* unmount in progress */
 #define	MNTK_MWAIT	0x02000000	/* waiting for unmount to finish */
 #define MNTK_WANTRDWR	0x04000000	/* upgrade to read/write requested */
-#define MNTK_FSMID	0x08000000	/* getattr supports FSMIDs */
 #define MNTK_NOSTKMNT	0x10000000	/* no stacked mount point allowed */
 #define MNTK_NOMSYNC	0x20000000	/* used by tmpfs */
 #define MNTK_THR_SYNC	0x40000000	/* fs sync thread requested */
diff --git a/sys/sys/stat.h b/sys/sys/stat.h
index 17c2897124..3df4bb480e 100644
--- a/sys/sys/stat.h
+++ b/sys/sys/stat.h
@@ -50,11 +50,6 @@
 #include <sys/_timespec.h>
 #endif
 
-/*
- * stat structure notes:
- *
- * NOTE: st_fsmid removed in DragonFly 2.5.x.
- */
 struct stat {
 	ino_t		st_ino;		/* inode's number */
 	nlink_t		st_nlink;	/* number of hard links */
@@ -77,7 +72,6 @@ struct stat {
 	int64_t		st_qspare2;
 };
 
-/*#define _ST_FSMID_PRESENT_*/
 #define	_ST_FLAGS_PRESENT_
 
 #define	st_atime st_atim.tv_sec
diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c
index f31cdf973e..6d9d571363 100644
--- a/sys/vfs/hammer/hammer_vfsops.c
+++ b/sys/vfs/hammer/hammer_vfsops.c
@@ -625,7 +625,6 @@ hammer_vfs_mount(struct mount *mp, char *mntpt, caddr_t data,
 	 * root vnode.
 	 */
 	mp->mnt_iosize_max = MAXPHYS;
-	mp->mnt_kern_flag |= MNTK_FSMID;
 	mp->mnt_kern_flag |= MNTK_THR_SYNC;	/* new vsyncscan semantics */
 
 	/*
diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c
index dd78d98d15..4260882633 100644
--- a/sys/vfs/ufs/ffs_vfsops.c
+++ b/sys/vfs/ufs/ffs_vfsops.c
@@ -625,11 +625,6 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct malloc_type *mtype)
 	if (mp->mnt_iosize_max > MAXPHYS)
 		mp->mnt_iosize_max = MAXPHYS;
 
-	/*
-	 * Filesystem supports native FSMIDs
-	 */
-	mp->mnt_kern_flag |= MNTK_FSMID;
-
 	/*
 	 * The backing device must be VMIO-capable because we use getblk().
 	 * NOTE: the MFS driver now returns a VMIO-enabled descriptor.
-- 
2.28.0

