Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2020 21:44:00 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362561 - head/sys/geom/journal
Message-ID:  <202006232144.05NLi0tN046625@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 "



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