dovecot-2.2: lib-fs: Changed FS_OPEN_FLAG_UNIMPORTANT to a rever...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 5 03:38:01 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/397253f15f36
changeset: 15740:397253f15f36
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 05 03:37:47 2013 +0200
description:
lib-fs: Changed FS_OPEN_FLAG_UNIMPORTANT to a reversed FS_OPEN_FLAG_FSYNC.
This explains its behavior better.

diffstat:

 src/lib-fs/fs-api.h                      |  6 +++---
 src/lib-fs/fs-posix.c                    |  2 +-
 src/lib-storage/index/index-attachment.c |  4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r e7e95d2d2b37 -r 397253f15f36 src/lib-fs/fs-api.h
--- a/src/lib-fs/fs-api.h	Tue Feb 05 03:30:01 2013 +0200
+++ b/src/lib-fs/fs-api.h	Tue Feb 05 03:37:47 2013 +0200
@@ -40,9 +40,9 @@
 };
 
 enum fs_open_flags {
-	/* File being written isn't very important, performance is more
-	   important than actually guaranteeing that the file gets saved */
-	FS_OPEN_FLAG_UNIMPORTANT	= 0x10,
+	/* File is important and writing must call fsync() or have equivalent
+	   behavior. */
+	FS_OPEN_FLAG_FSYNC		= 0x10,
 	/* Asynchronous writes: fs_write() will fail with EAGAIN if it needs to
 	   be called again (the retries can use size=0). For streams
 	   fs_write_stream_finish() may request retrying with 0.
diff -r e7e95d2d2b37 -r 397253f15f36 src/lib-fs/fs-posix.c
--- a/src/lib-fs/fs-posix.c	Tue Feb 05 03:30:01 2013 +0200
+++ b/src/lib-fs/fs-posix.c	Tue Feb 05 03:37:47 2013 +0200
@@ -350,7 +350,7 @@
 {
 	int ret;
 
-	if ((file->open_flags & FS_OPEN_FLAG_UNIMPORTANT) == 0) {
+	if ((file->open_flags & FS_OPEN_FLAG_FSYNC) != 0) {
 		if (fdatasync(file->fd) < 0) {
 			fs_set_error(file->file.fs, "fdatasync(%s) failed: %m",
 				     file->file.path);
diff -r e7e95d2d2b37 -r 397253f15f36 src/lib-storage/index/index-attachment.c
--- a/src/lib-storage/index/index-attachment.c	Tue Feb 05 03:30:01 2013 +0200
+++ b/src/lib-storage/index/index-attachment.c	Tue Feb 05 03:37:47 2013 +0200
@@ -87,8 +87,8 @@
 
 	i_assert(attach->cur_file == NULL);
 
-	if (storage->set->parsed_fsync_mode == FSYNC_MODE_NEVER)
-		flags |= FS_OPEN_FLAG_UNIMPORTANT;
+	if (storage->set->parsed_fsync_mode != FSYNC_MODE_NEVER)
+		flags |= FS_OPEN_FLAG_FSYNC;
 
 	if (strlen(digest) < 4) {
 		/* make sure we can access first 4 bytes without accessing


More information about the dovecot-cvs mailing list