From owner-svn-src-head@freebsd.org Sat Dec 9 15:44:32 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25DB4E8EFCB; Sat, 9 Dec 2017 15:44:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E73EF69CFE; Sat, 9 Dec 2017 15:44:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB9FiVfs096791; Sat, 9 Dec 2017 15:44:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB9FiVUI096790; Sat, 9 Dec 2017 15:44:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201712091544.vB9FiVUI096790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 9 Dec 2017 15:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326731 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 326731 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Dec 2017 15:44:32 -0000 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