Re: fsync in glib/gio
- From: Xavier Bestel <xavier bestel free fr>
- To: Pavel Machek <pavel ucw cz>
- Cc: gtk-devel-list gnome org, Sven Neumann <sven gimp org>, Alexander Larsson <alexl redhat com>
- Subject: Re: fsync in glib/gio
- Date: Tue, 24 Mar 2009 11:09:03 +0100
On Tue, 2009-03-24 at 10:38 +0100, Pavel Machek wrote:
> > > > One compromise we could make it to only fsync in the case we're actually
> > > > overwriting an existing file. This would mean that we don't risk
> > > > loosing
> > >
> > > You should fsync just before doing rename, preferably in some special
> > > way so that we can tell it apart from 'normal' fsync.
> >
> > This is what I mean of course. And there is no such "special way"
> > infortunately.
>
> One proposal was to create "replace()" call (doing proper replacement
> of one file with another). It could start up as "fsync(); rename()"
> initially, but it should slowly move up into glibc and kernel, and do
> the right thing.
Isn't that a bit heavyweight ? The minimal thing needed would be a sort
of barrier, to ensure the file state is coherent before and after the
rename() - i.e. replace()+unlink() shouldn't do more io than unlink().
IMHO the kernel should guarantee a safe rename() (more that the minimal
posix requirement) with either the old or new file on disk. But maybe
that's too hard to fix.
Xav
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]