From owner-svn-src-all@FreeBSD.ORG Sat Mar 21 10:14:18 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 523E99F8; Sat, 21 Mar 2015 10:14:18 +0000 (UTC) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 139A11CF; Sat, 21 Mar 2015 10:14:17 +0000 (UTC) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 2B677104093D; Sat, 21 Mar 2015 20:49:01 +1100 (AEDT) Date: Sat, 21 Mar 2015 20:49:00 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Xin LI Subject: Re: svn commit: r280308 - head/sys/fs/devfs In-Reply-To: <201503210114.t2L1ECcB075556@svn.freebsd.org> Message-ID: <20150321200221.K1846@besplex.bde.org> References: <201503210114.t2L1ECcB075556@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=ZuzUdbLG c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=AUD30uXixocujIzroAsA:9 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2015 10:14:18 -0000 On Sat, 21 Mar 2015, Xin LI wrote: > Log: > Disable timestamping on devfs read/write operations by default. > > Currently we update timestamps unconditionally when doing read or > write operations. This may slow things down on hardware where > reading timestamps is expensive (e.g. HPET, because of the default > vfs.timestamp_precision setting is nanosecond now) with limited > benefit. > > A new sysctl variable, vfs.devfs.dotimes is added, which can be > set to non-zero value when the old behavior is desirable. I don't like this. It defaults to non-POSIX-conformant behaviour... The slowness is mostly from no delayed update of times in devfs. Switching vfs.timestamp_precision to a hardware timecounter would have been even more expensive for regular files if file systems didn't have delayed updates. The assumption that vfs_timestamp() doesn't use a slow timecounter was so often satisfied that no one missed devfs also not supporting mounting with -noatime. Delayed updates are even easier to implement for devfs than for disk file systems the times never need to be written to disk. A slow update is still wasteful for atimes, but not as bad as for disk file systems since it doesn't trigger a slower sync to disk. > ... > Modified: head/sys/fs/devfs/devfs_vnops.c > ============================================================================== > --- head/sys/fs/devfs/devfs_vnops.c Sat Mar 21 00:21:30 2015 (r280307) > +++ head/sys/fs/devfs/devfs_vnops.c Sat Mar 21 01:14:11 2015 (r280308) > ... > @@ -1700,7 +1708,8 @@ devfs_write_f(struct file *fp, struct ui > resid = uio->uio_resid; > > error = dsw->d_write(dev, uio, ioflag); > - if (uio->uio_resid != resid || (error == 0 && resid != 0)) { > + if (devfs_dotimes && > + (uio->uio_resid != resid || (error == 0 && resid != 0))) { > vfs_timestamp(&dev->si_ctime); > dev->si_mtime = dev->si_ctime; > } An old bug is evident in the diff. Writing shouldn't change the ctime. Bruce