git: ce00b11940ab - main - mount: revert the active vnode reporting feature

From: Doug Ambrisko <ambrisko_at_FreeBSD.org>
Date: Wed, 15 Jun 2022 15:05:43 UTC
The branch main has been updated by ambrisko:

URL: https://cgit.FreeBSD.org/src/commit/?id=ce00b11940aba80f0bd5fd712d77263194290d57

commit ce00b11940aba80f0bd5fd712d77263194290d57
Author:     Doug Ambrisko <ambrisko@FreeBSD.org>
AuthorDate: 2022-06-14 21:37:27 +0000
Commit:     Doug Ambrisko <ambrisko@FreeBSD.org>
CommitDate: 2022-06-15 14:24:55 +0000

    mount: revert the active vnode reporting feature
    
    Revert the computing of active vnode reporting since statfs is used
    by a lot of tools.  Only report the vnodes used.
    
    Reported by:    mjg
---
 sbin/mount/mount.c   |  7 +++----
 sys/kern/vfs_mount.c | 12 ------------
 sys/sys/mount.h      |  2 +-
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index bd3d0073c474..6c986907bcda 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -692,11 +692,10 @@ prmount(struct statfs *sfp)
 			xo_emit("{D:, }{Lw:fsid}{:fsid}", fsidbuf);
 			free(fsidbuf);
 		}
-		if (sfp->f_nvnodelistsize != 0 || sfp->f_avnodecount != 0) {
+		if (sfp->f_nvnodelistsize != 0) {
 			xo_open_container("vnodes");
-			xo_emit("{D:, }{Lwc:vnodes}{Lw:count}{w:count/%ju}{Lw:active}{:active/%ju}",
-			    (uintmax_t)sfp->f_nvnodelistsize,
-			    (uintmax_t)sfp->f_avnodecount);
+			xo_emit("{D:, }{Lwc:vnodes}{Lw:count}{w:count/%ju}",
+			    (uintmax_t)sfp->f_nvnodelistsize);
 			xo_close_container("vnodes");
 		}
 	}
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index e33492cd8367..155e397b7f5e 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -2610,9 +2610,6 @@ vfs_copyopt(struct vfsoptlist *opts, const char *name, void *dest, int len)
 int
 __vfs_statfs(struct mount *mp, struct statfs *sbp)
 {
-	struct vnode *vp;
-	uint32_t count;
-
 	/*
 	 * Filesystems only fill in part of the structure for updates, we
 	 * have to read the entirety first to get all content.
@@ -2628,15 +2625,6 @@ __vfs_statfs(struct mount *mp, struct statfs *sbp)
 	sbp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
 	sbp->f_nvnodelistsize = mp->mnt_nvnodelistsize;
 
-	count = 0;
-	MNT_ILOCK(mp);
-	TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
-		if (vrefcnt(vp) > 0) /* racy but does not matter */
-			count++;
-	}
-	MNT_IUNLOCK(mp);
-	sbp->f_avnodecount = count;
-
 	return (mp->mnt_op->vfs_statfs(mp, sbp));
 }
 
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index edac64171f9a..ffb2676258f3 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -92,7 +92,7 @@ struct statfs {
 	uint64_t f_syncreads;		/* count of sync reads since mount */
 	uint64_t f_asyncreads;		/* count of async reads since mount */
 	uint32_t f_nvnodelistsize;	/* # of vnodes */
-	uint32_t f_avnodecount;		/* # of active vnodes */
+	uint32_t f_spare0;		/* unused spare */
 	uint64_t f_spare[9];		/* unused spare */
 	uint32_t f_namemax;		/* maximum filename length */
 	uid_t	  f_owner;		/* user that mounted the filesystem */