g_file_set_contents(): don't fsync on ext3/4
authorRyan Lortie <desrt@desrt.ca>
Tue, 4 Jun 2013 13:48:12 +0000 (09:48 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 4 Jun 2013 13:52:10 +0000 (09:52 -0400)
commit9d0c17b50102267a5029b58b1f44efbad82d8f03
tree734b13815b49482e3a57cb6e5ffc3019db804955
parent16b26231ca7d807a5bb52228eb4f2cae4427edde
g_file_set_contents(): don't fsync on ext3/4

ext3 and ext4 (for quite some time) with default mount options don't
need fsync() to ensure safety of replace-by-rename.  Stop doing that for
these filesystems.

Note: this patch also impacts ext2, which is probably not safe, but I
don't know of any way to check ext2. vs the others because they all have
the same magic numbers (short of opening /proc/mount).

This patch assumes that if BTRFS_SUPER_MAGIC is defined then so will be
EXT3_SUPER_MAGIC.

https://bugzilla.gnome.org/show_bug.cgi?id=701560
glib/gfileutils.c