changeset 18934:295fd771e02d

lib-fs: fs_write() didn't update stats.write_count correctly. If backend implemented asynchronous write(), the write_count was updated multiple times. If backend didn't implement write(), then it was counted twice.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Aug 2015 13:07:21 +0200
parents 1ed8418031b6
children 2f1378beeef6
files src/lib-fs/fs-api.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-fs/fs-api.c	Sat Aug 15 12:14:35 2015 +0200
+++ b/src/lib-fs/fs-api.c	Sun Aug 16 13:07:21 2015 +0200
@@ -530,11 +530,12 @@
 {
 	int ret;
 
-	file->fs->stats.write_count++;
 	if (file->fs->v.write != NULL) {
 		T_BEGIN {
 			ret = file->fs->v.write(file, data, size);
 		} T_END;
+		if (!(ret < 0 && errno == EAGAIN))
+			file->fs->stats.write_count++;
 		return ret;
 	}