Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Dec 2017 15:44:31 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326731 - head/sys/ufs/ffs
Message-ID:  <201712091544.vB9FiVUI096790@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Sat Dec  9 15:44:30 2017
New Revision: 326731
URL: https://svnweb.freebsd.org/changeset/base/326731

Log:
  Provide a sysctl to force synchronous initialization of inode blocks.
  
  FFS performs asynchronous inode initialization, using a barrier write
  to ensure that the inode block is written before the corresponding
  cylinder group header update. Some GEOMs do not appear to handle
  BIO_ORDERED correctly, meaning that the barrier write may not work as
  intended. The sysctl allows one to work around this problem at the
  cost of expensive file creation on new filesystems. The default
  behaviour is unchanged.
  
  Reviewed by:	kib, mckusick
  MFC after:	1 weeks
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D13428

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Sat Dec  9 15:34:40 2017	(r326730)
+++ head/sys/ufs/ffs/ffs_alloc.c	Sat Dec  9 15:44:30 2017	(r326731)
@@ -1958,6 +1958,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,
@@ -2065,6 +2075,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
@@ -2074,7 +2085,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



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