python-dev
[Prev] Thread [Next] | [Prev] Date [Next]
Re: [Python-Dev] Ext4 data loss Martin v. Löwis Wed Mar 11 02:00:46 2009
>> We already have os.fsync() and os.fdatasync(). Should the sync() (and
>> datasync()?) method be added as an object-oriented convenience?
>
> It's more than an object oriented convenience. fsync() takes a file
> descriptor as argument. Therefore I assume fsync() only syncs the data
> to disk that was written to the file descriptor. [*]
[...]
> [*] Is my assumption correct, anybody?
Not necessarily. In Linux, for many releases, fsync() was really
equivalent to sync() (i.e. flushing all data for all files on all
file systems to disk). It may be that some systems still implement
it that way today.
However, even it it was true, I don't see why a .sync method would
be more than a convenience. An application wishing to sync a file
before close can do
f.flush()
os.fsync(f.fileno)
f.close()
With a sync method, it would become
f.flush()
f.sync()
f.close()
which is *really* nothing more than convenience.
O'd also like to point to the O_SYNC/O_DSYNC/O_RSYNC open(2)
flags. Applications that require durable writes can also chose
to set those on open, and be done.
Regrds,
Martin
_______________________________________________
Python-Dev mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/alexiscircle%40gmail.com
- Re: [Python-Dev] Ext4 data loss, (continued)
- Re: [Python-Dev] Ext4 data loss Andrew McNabb
- Re: [Python-Dev] Ext4 data loss Nick Coghlan
- Re: [Python-Dev] Ext4 data loss Eric Smith
- Re: [Python-Dev] Ext4 data loss Antoine Pitrou
- Re: [Python-Dev] Ext4 data loss Eric Smith
- Re: [Python-Dev] Ext4 data loss Steven D'Aprano
- Re: [Python-Dev] [Python-ideas] Ext4 data loss zooko
- Message not available
- Re: [Python-Dev] Ext4 data loss Hrvoje Niksic
- Re: [Python-Dev] Ext4 data loss Martin v. Löwis
- Re: [Python-Dev] Ext4 data loss Greg Ewing
- Re: [Python-Dev] Ext4 data loss Martin v. Löwis <=
- Re: [Python-Dev] Ext4 data loss Antoine Pitrou
- Re: [Python-Dev] Ext4 data loss Cameron Simpson
Re: [Python-Dev] Ext4 data loss Joachim König
- Re: [Python-Dev] Ext4 data loss Cameron Simpson
- Re: [Python-Dev] Ext4 data loss Gisle Aas
Message not available
- Re: [Python-Dev] Ext4 data loss Hrvoje Niksic
Re: [Python-Dev] Ext4 data loss Neil Hodgson
- Re: [Python-Dev] Ext4 data loss Guido van Rossum
- Re: [Python-Dev] Ext4 data loss Barry Warsaw
- Re: [Python-Dev] Ext4 data loss Greg Ewing