svn commit: r362561 - head/sys/geom/journal

Kirk McKusick mckusick at FreeBSD.org
Tue Jun 23 21:44:01 UTC 2020


Author: mckusick
Date: Tue Jun 23 21:44:00 2020
New Revision: 362561
URL: https://svnweb.freebsd.org/changeset/base/362561

Log:
  Optimize g_journal's superblock update by noting that the summary
  information is neither read nor written so it need not be written
  out when updating the superblock.
  
  PR:           247425
  Sponsored by: Netflix

Modified:
  head/sys/geom/journal/g_journal_ufs.c

Modified: head/sys/geom/journal/g_journal_ufs.c
==============================================================================
--- head/sys/geom/journal/g_journal_ufs.c	Tue Jun 23 21:37:12 2020	(r362560)
+++ head/sys/geom/journal/g_journal_ufs.c	Tue Jun 23 21:44:00 2020	(r362561)
@@ -68,7 +68,6 @@ g_journal_ufs_clean(struct mount *mp)
 static void
 g_journal_ufs_dirty(struct g_consumer *cp)
 {
-	struct fs_summary_info *fs_si;
 	struct fs *fs;
 	int error;
 
@@ -81,15 +80,18 @@ g_journal_ufs_dirty(struct g_consumer *cp)
 		    ("g_journal_ufs_dirty: non-NULL fs %p\n", fs));
 		return;
 	}
+	/*
+	 * Do not use or change summary information, so free it now
+	 * to avoid unnecessarily writing it back out in ffs_sbput().
+	 */
+	g_free(fs->fs_csp);
+	g_free(fs->fs_si);
+	fs->fs_si = NULL;
+
 	GJ_DEBUG(0, "clean=%d flags=0x%x", fs->fs_clean, fs->fs_flags);
 	fs->fs_clean = 0;
 	fs->fs_flags |= FS_NEEDSFSCK | FS_UNCLEAN;
-	fs_si = fs->fs_si;
-	fs->fs_si = NULL;
 	error = ffs_sbput(cp, fs, fs->fs_sblockloc, g_use_g_write_data);
-	fs->fs_si = fs_si;
-	g_free(fs->fs_csp);
-	g_free(fs->fs_si);
 	g_free(fs);
 	if (error != 0) {
 		GJ_DEBUG(0, "Cannot mark file system %s as dirty "


More information about the svn-src-all mailing list