From owner-freebsd-hackers Wed Nov 4 09:42:59 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA00581 for freebsd-hackers-outgoing; Wed, 4 Nov 1998 09:42:59 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from spinner.netplex.com.au (spinner.netplex.com.au [202.12.86.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA00412 for ; Wed, 4 Nov 1998 09:42:47 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from spinner.netplex.com.au (localhost [127.0.0.1]) by spinner.netplex.com.au (8.9.1/8.9.1/Spinner) with ESMTP id BAA01178; Thu, 5 Nov 1998 01:42:20 +0800 (WST) (envelope-from peter@spinner.netplex.com.au) Message-Id: <199811041742.BAA01178@spinner.netplex.com.au> X-Mailer: exmh version 2.0.2 2/24/98 To: zhihuizhang cc: hackers Subject: Re: How sync() gets called every 30 seconds? In-reply-to: Your message of "Wed, 04 Nov 1998 12:19:41 EST." Date: Thu, 05 Nov 1998 01:42:19 +0800 From: Peter Wemm Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG zhihuizhang wrote: > > Hi, Can anyone tell me where in the source code the sync() (in > vfs_syscalls.c) is set up to be called every 30 seconds? > > Thanks a lot. In 2.x, there is a process called 'update' that sleeps for 30 seconds and calls sync each time. In 3.x, it is different because of softupdates and not easy to explain :-). For non-softupdates mounts, a 'syncer vnode' is allocated at mount time. It has got some vnode operations including sync_fsync(). This vnode is inserted into the work queue for the new 'syncer' process, and is interleaved with other mounts. For non-softupdates, each filesystem is periodically sync'ed via sync_fsync once every 30 seconds with a fairly even pacing. Theoretically, if you had 3 filesystems, one would get sync'ed every 10 seconds so they were all done in 30, but it doesn't work out that exact. For softupdates, much more is done by the syncer process, it processes "dirty" vnodes periodically to maintain dependency information and maintain metadata write order. Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message