dovecot: Added MAIL_STORAGE_FLAG_FSYNC_DISABLE and moved FSYNC_D...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 13 00:18:33 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/78fe45cdc192
changeset: 5975:78fe45cdc192
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 13 00:12:21 2007 +0300
description:
Added MAIL_STORAGE_FLAG_FSYNC_DISABLE and moved FSYNC_DISABLE environment
handling elsewhere.

diffstat:

3 files changed, 8 insertions(+), 5 deletions(-)
src/lib-storage/index/index-storage.c |    9 ++++-----
src/lib-storage/mail-storage.c        |    2 ++
src/lib-storage/mail-storage.h        |    2 ++

diffs (50 lines):

diff -r b88278b5d8d3 -r 78fe45cdc192 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Fri Jul 13 00:05:44 2007 +0300
+++ b/src/lib-storage/index/index-storage.c	Fri Jul 13 00:12:21 2007 +0300
@@ -354,11 +354,6 @@ void index_storage_mailbox_open(struct i
 
 	i_assert(!ibox->box.opened);
 
-	if (getenv("FSYNC_DISABLE") != NULL) {
-		ibox->fsync_disable = TRUE;
-		index_flags |= MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE;
-	}
-
 	if (!ibox->move_to_memory)
 		index_flags |= MAIL_INDEX_OPEN_FLAG_CREATE;
 #ifndef MMAP_CONFLICTS_WRITE
@@ -369,6 +364,10 @@ void index_storage_mailbox_open(struct i
 		index_flags |= MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL;
 	if ((storage->flags & MAIL_STORAGE_FLAG_NFS_FLUSH_INDEX) != 0)
 		index_flags |= MAIL_INDEX_OPEN_FLAG_NFS_FLUSH;
+	if ((storage->flags & MAIL_STORAGE_FLAG_FSYNC_DISABLE) != 0) {
+		index_flags |= MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE;
+		ibox->fsync_disable = TRUE;
+	}
 
 	ret = mail_index_open(ibox->index, index_flags, storage->lock_method);
 	if (ret <= 0 || ibox->move_to_memory) {
diff -r b88278b5d8d3 -r 78fe45cdc192 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Jul 13 00:05:44 2007 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Jul 13 00:12:21 2007 +0300
@@ -84,6 +84,8 @@ void mail_storage_parse_env(enum mail_st
 		*flags_r |= MAIL_STORAGE_FLAG_DOTLOCK_USE_EXCL;
 	if (getenv("MAIL_SAVE_CRLF") != NULL)
 		*flags_r |= MAIL_STORAGE_FLAG_SAVE_CRLF;
+	if (getenv("FSYNC_DISABLE") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_FSYNC_DISABLE;
 
 	str = getenv("POP3_UIDL_FORMAT");
 	if (str != NULL && (str = strchr(str, '%')) != NULL &&
diff -r b88278b5d8d3 -r 78fe45cdc192 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri Jul 13 00:05:44 2007 +0300
+++ b/src/lib-storage/mail-storage.h	Fri Jul 13 00:12:21 2007 +0300
@@ -36,6 +36,8 @@ enum mail_storage_flags {
 	/* Flush NFS caches for mail storage / index */
 	MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE	= 0x800,
 	MAIL_STORAGE_FLAG_NFS_FLUSH_INDEX	= 0x1000,
+	/* Don't use fsync() or fdatasync() */
+	MAIL_STORAGE_FLAG_FSYNC_DISABLE		= 0x2000
 };
 
 enum mailbox_open_flags {


More information about the dovecot-cvs mailing list