From owner-cvs-all@FreeBSD.ORG Wed Oct 27 09:15:37 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A409416A4CE; Wed, 27 Oct 2004 09:15:37 +0000 (GMT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3C17043D31; Wed, 27 Oct 2004 09:15:37 +0000 (GMT) (envelope-from truckman@FreeBSD.org) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.1/8.13.1) with ESMTP id i9R9FRIa019936; Wed, 27 Oct 2004 02:15:32 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <200410270915.i9R9FRIa019936@gw.catspoiler.org> Date: Wed, 27 Oct 2004 02:15:27 -0700 (PDT) From: Don Lewis To: phk@phk.freebsd.dk In-Reply-To: <61934.1098866287@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern vfs_subr.c src/sys/sys buf.h bufobj.h vnode.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2004 09:15:37 -0000 On 27 Oct, Poul-Henning Kamp wrote: > In message <200410270824.i9R8OqGc019841@gw.catspoiler.org>, Don Lewis writes: >>On 27 Oct, Poul-Henning Kamp wrote: >>> phk 2004-10-27 08:05:03 UTC >>> >>> FreeBSD src repository >>> >>> Modified files: >>> sys/kern vfs_subr.c >>> sys/sys buf.h bufobj.h vnode.h >>> Log: >>> Move the syncer linkage from vnode to bufobj. >>> >>> This is not quite a perfect separation: the syncer still think it knows >>> that everything is a vnode. >> >>This change strikes me as wrong. The syncer has to handle things like >>inode timestamps (utimes(2)) and fifos, which I wouldn't expect to have >>bufobjs. > > The syncers job is to push dirty buffers onto disk. In the process it > will need to call back into whoever owns the buffer so they can do their > private housekeeping as necessary. > > So the syncer doesn't deal with timestamps, the filesystems do. One of the things that is on my list of things to do is to handle timestamp updates by putting them on the syncer worklist. I stumbled across a bug a while back that causes files being written to be synced twice as often as they should. The file gets synced once when the syncer comes across it it on the worklist, and it gets synced again when the syncer encounters the file system syncer vnode, which results in a call to ffs_sync(), which syncs all the vnodes that have pending inode timestamp changes. This second sync can result in a large burst of activity if there are a lot of pending timestamp changes. This is quite noticable when unpacking a large tarball or doing something similar that writes to a lot of files. There are large bursts of disk activity every 30 seconds and the machine gets noticeably sluggish. If you monitor the length of the syncer worklist, it will vary in a sawtooth manner. I discussed this privately with mckusick a while back and he told me that the original intent was to not walk the vnode list in ffs_sync() in the MNT_LAZY case. The problem was that timestamp updates could end up being deferred indefinitely if no buffers were dirtied. Skipping the vnode list traversal in ffs_sync() in the MNT_LAZY case would also be a nice optimization just in terms of CPU time because this list can be quite long. It also makes sense to sync the timestamps stored in the inode and the file data blocks at the same time because the block pointers stored in the inode may need to be updated.