From owner-freebsd-hackers Mon Oct 19 11:11:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA01904 for freebsd-hackers-outgoing; Mon, 19 Oct 1998 11:11:53 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from austin.polstra.com (austin.polstra.com [206.213.73.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA01899 for ; Mon, 19 Oct 1998 11:11:52 -0700 (PDT) (envelope-from jdp@austin.polstra.com) Received: from austin.polstra.com (jdp@localhost) by austin.polstra.com (8.9.1/8.9.1) with ESMTP id LAA14424; Mon, 19 Oct 1998 11:10:56 -0700 (PDT) (envelope-from jdp) Message-Id: <199810191810.LAA14424@austin.polstra.com> To: obrien@NUXI.com cc: hackers@FreeBSD.ORG Subject: Re: softupdates and sync In-reply-to: Your message of "Mon, 19 Oct 1998 11:00:57 PDT." <19981019110057.A28374@nuxi.com> Date: Mon, 19 Oct 1998 11:10:55 -0700 From: John Polstra Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Correctly me if I'm wrong: if you want to know the point at which > the disks are synced, you need to run it twice, right? > > Reason being the 1st ``sync'' simply kicks off the syncing procedure > and then returns. The 2nd ``sync'' will not return until the > syncing procedure from the 1st ``sync'' has completed. Thus once > the 2nd ``sync'' returns, you know your disk buffers are completely > flushed to disk. I haven't studied the code, but I know what the documentation says. It says, "sync() may return before the buffers are completely flushed." It doesn't say that if you run it a second time, it will make sure that the first sync() has completed. There's no stated guarantee of that kind. I think that whatever historical benefit came from running it three times was strictly derived from the fact that it takes a few seconds to type "sync" three times. It would work just as well to type: sync echo hi echo hi :-) When unmounting a filesystem, you don't have to run sync at all. Unmounting will automatically write out all the dirty buffers. John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-knowledge is always bad news." -- John Barth To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message