Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Aug 2018 12:59:03 -0700
From:      Kirk McKusick <mckusick@mckusick.com>
To:        FreeBSD Current <freebsd-current@FreeBSD.org>, FreeBSD Filesystems <freebsd-fs@FreeBSD.org>
Subject:   Re: CFT: TRIM Consolodation on UFS/FFS filesystems
Message-ID:  <201808201959.w7KJx3iK072721@chez.mckusick.com>
In-Reply-To: <201808201940.w7KJeu29072094@chez.mckusick.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: Kirk McKusick <mckusick@mckusick.com>
To: FreeBSD Current <freebsd-current@FreeBSD.org>,
        FreeBSD Filesystems <freebsd-fs@FreeBSD.org>
Subject: CFT: TRIM Consolodation on UFS/FFS filesystems
Date: Mon, 20 Aug 2018 12:40:56 -0700

Oops, forgot that attachments get stripped. Below are the diffs for
gathering statistics. Sorry to those of you on Gmail for whom they
will be mangled.

	Kirk McKusick

=-=-=

Index: sbin/mount/mount.c
===================================================================
--- sbin/mount/mount.c	(revision 338054)
+++ sbin/mount/mount.c	(working copy)
@@ -686,6 +686,18 @@ prmount(struct statfs *sfp)
 			for (i = 0; i < sizeof(sfp->f_fsid); i++)
 				printf("%02x", ((u_char *)&sfp->f_fsid)[i]);
 		}
+		if (sfp->f_trim_total != 0 || sfp->f_trim_total_blks != 0)
+			(void)printf(", TRIM: total %ju total blocks %ju",
+			    (uintmax_t)sfp->f_trim_total,
+			    (uintmax_t)sfp->f_trim_total_blks);
+		if (sfp->f_trim_inflight != 0 || sfp->f_trim_inflight_blks != 0)
+			(void)printf(", TRIM: inflight %ju inflight blocks %ju",
+			    (uintmax_t)sfp->f_trim_inflight,
+			    (uintmax_t)sfp->f_trim_inflight_blks);
+		if (sfp->f_pendingblks != 0 || sfp->f_pendingfiles != 0)
+			(void)printf(", pending blocks %ju, pending files %ju",
+			    (uintmax_t)sfp->f_pendingblks,
+			    (uintmax_t)sfp->f_pendingfiles);
 	}
 	(void)printf(")\n");
 }
Index: sys/sys/mount.h
===================================================================
--- sys/sys/mount.h	(revision 338054)
+++ sys/sys/mount.h	(working copy)
@@ -85,7 +85,13 @@ struct statfs {
 	uint64_t f_asyncwrites;		/* count of async writes since mount */
 	uint64_t f_syncreads;		/* count of sync reads since mount */
 	uint64_t f_asyncreads;		/* count of async reads since mount */
-	uint64_t f_spare[10];		/* unused spare */
+	uint64_t f_trim_total;		/* count of TRIM ops since mount */
+	uint64_t f_trim_total_blks;	/* count of TRIM blocks since mount */
+	uint64_t f_trim_inflight;	/* count of TRIM ops in progress */
+	uint64_t f_trim_inflight_blks;	/* count of TRIM blocks in progress */
+	int64_t	 f_pendingblks;		/* pending free blocks */
+	int64_t	 f_pendingfiles;	/* pending free nodes */
+	uint64_t f_spare[4];		/* unused spare */
 	uint32_t f_namemax;		/* maximum filename length */
 	uid_t	  f_owner;		/* user that mounted the filesystem */
 	fsid_t	  f_fsid;		/* filesystem id */
Index: sys/ufs/ffs/ffs_vfsops.c
===================================================================
--- sys/ufs/ffs/ffs_vfsops.c	(revision 338081)
+++ sys/ufs/ffs/ffs_vfsops.c	(working copy)
@@ -1398,7 +1398,13 @@ ffs_statfs(mp, sbp)
 	sbp->f_bsize = fs->fs_fsize;
 	sbp->f_iosize = fs->fs_bsize;
 	sbp->f_blocks = fs->fs_dsize;
+	sbp->f_pendingblks = dbtofsb(fs, fs->fs_pendingblocks);
+	sbp->f_pendingfiles = fs->fs_pendinginodes;
 	UFS_LOCK(ump);
+	sbp->f_trim_total = ump->um_trim_total;
+	sbp->f_trim_total_blks = ump->um_trim_total_blks;
+	sbp->f_trim_inflight = ump->um_trim_inflight;
+	sbp->f_trim_inflight_blks = ump->um_trim_inflight_blks;
 	sbp->f_bfree = fs->fs_cstotal.cs_nbfree * fs->fs_frag +
 	    fs->fs_cstotal.cs_nffree + dbtofsb(fs, fs->fs_pendingblocks);
 	sbp->f_bavail = freespace(fs, fs->fs_minfree) +




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808201959.w7KJx3iK072721>