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)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 9 Jun 2013 22:15:54 +0000 (18:15 -0400)
commitcf1922965a897cbfb53ac3e88c2a444f880b01d7
treebd9c63f54f8725120ea15807d74449a463ab7d77
parentee8d3333ddc350da5853707c31169af866fc4524
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