Subject: Re: Extension of fsync_range() to permit forcing disk cache flushing
To: Thor Lancelot Simon <firstname.lastname@example.org>
From: Manuel Bouyer <email@example.com>
Date: 12/17/2004 14:34:08
On Fri, Dec 17, 2004 at 07:24:46AM -0500, Thor Lancelot Simon wrote:
> On Fri, Dec 17, 2004 at 10:08:48AM +0100, Manuel Bouyer wrote:
> > I'm not really happy with this. IMHO this should be the default behavior of
> > fsync(). A programmer using fsync in his software uses it to make use data
> > is on stable storage.
> The problem is that syncing 1K of data from one file could cause an
> entire 8MB cache to be written back (in fact, on an IDE disk, *will*
> cause that).
In another thread, we admit that the upper layers needs to aware of this
property of the ATA drives, and deal with it. fsync() doens't have to
call directly the flush cache ioctl, it could insert itself in the
write queue with a write barrier. This way several subsystem's
barrier could be combined in one to help performances on busy systems.
> Some applications "defensively" call fsync on every write;
> think what that will do to overall system performance.
Then maybe these applications need to be fixed ?
Adding a flag to fsync() to make it do what we expect from it, just because
some application don't use it in a good way seems backward to me.
Manuel Bouyer <firstname.lastname@example.org>
NetBSD: 26 ans d'experience feront toujours la difference