svn commit: r326921 - stable/11/sys/ufs/ffs

Mark Johnston markj at FreeBSD.org
Sun Dec 17 19:49:39 UTC 2017


Author: markj
Date: Sun Dec 17 19:49:37 2017
New Revision: 326921
URL: https://svnweb.freebsd.org/changeset/base/326921

Log:
  MFC r326731:
  Provide a sysctl to force synchronous initialization of inode blocks.

Modified:
  stable/11/sys/ufs/ffs/ffs_alloc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- stable/11/sys/ufs/ffs/ffs_alloc.c	Sun Dec 17 19:48:35 2017	(r326920)
+++ stable/11/sys/ufs/ffs/ffs_alloc.c	Sun Dec 17 19:49:37 2017	(r326921)
@@ -1974,6 +1974,16 @@ getinobuf(struct inode *ip, u_int cg, u_int32_t cginob
 }
 
 /*
+ * Synchronous inode initialization is needed only when barrier writes do not
+ * work as advertised, and will impose a heavy cost on file creation in a newly
+ * created filesystem.
+ */
+static int doasyncinodeinit = 1;
+SYSCTL_INT(_vfs_ffs, OID_AUTO, doasyncinodeinit, CTLFLAG_RWTUN,
+    &doasyncinodeinit, 0,
+    "Perform inode block initialization using asynchronous writes");
+
+/*
  * Determine whether an inode can be allocated.
  *
  * Check to see if an inode is available, and if it is,
@@ -2086,6 +2096,7 @@ gotit:
 				dp2->di_gen = arc4random();
 			dp2++;
 		}
+
 		/*
 		 * Rather than adding a soft updates dependency to ensure
 		 * that the new inode block is written before it is claimed
@@ -2095,7 +2106,10 @@ gotit:
 		 * written. The barrier write should only slow down bulk
 		 * loading of newly created filesystems.
 		 */
-		babarrierwrite(ibp);
+		if (doasyncinodeinit)
+			babarrierwrite(ibp);
+		else
+			bwrite(ibp);
 
 		/*
 		 * After the inode block is written, try to update the


More information about the svn-src-all mailing list