block: use fdatasync instead of fsync if possible
authorChristoph Hellwig <hch@lst.de>
Fri, 4 Sep 2009 17:01:32 +0000 (19:01 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 11 Sep 2009 15:19:46 +0000 (10:19 -0500)
commite1eac6ef844fc1243fa648109cef81975819f3bb
tree522dacdca726cc3b8bc321e70791d03a3b543e72
parent186020c502cca0b65b30a68682a938d54ea513f0
block: use fdatasync instead of fsync if possible

If we are flushing the caches for our image files we only care about the
data (including the metadata required for accessing it) but not things
like timestamp updates.  So try to use fdatasync instead of fsync to
implement the flush operations.

Unfortunately many operating systems still do not support fdatasync,
so we add a qemu_fdatasync wrapper that uses fdatasync if available
as per the _POSIX_SYNCHRONIZED_IO feature macro or fsync otherwise.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/cow.c
block/raw-posix.c
cutils.c
qemu-common.h