Date: Thu, 05 Nov 1998 01:42:19 +0800 From: Peter Wemm <peter@netplex.com.au> To: zhihuizhang <bf20761@binghamton.edu> Cc: hackers <freebsd-hackers@FreeBSD.ORG> Subject: Re: How sync() gets called every 30 seconds? Message-ID: <199811041742.BAA01178@spinner.netplex.com.au> In-Reply-To: Your message of "Wed, 04 Nov 1998 12:19:41 EST." <Pine.SOL.L3.93.981104121741.14222A-100000@bingsun1>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811041742.BAA01178>