From 6f1953c4c14566d3303709869fd26201828b3ccf Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 4 Sep 2009 19:01:32 +0200 Subject: 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 Signed-off-by: Anthony Liguori --- block/cow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/cow.c') diff --git a/block/cow.c b/block/cow.c index 84818f1034..a70854e631 100644 --- a/block/cow.c +++ b/block/cow.c @@ -258,7 +258,7 @@ static int cow_create(const char *filename, QEMUOptionParameter *options) static void cow_flush(BlockDriverState *bs) { BDRVCowState *s = bs->opaque; - fsync(s->fd); + qemu_fdatasync(s->fd); } static QEMUOptionParameter cow_create_options[] = { -- cgit v1.2.1