dovecot: Added mail_nfs_storage and mail_nfs_index settings.

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


details:   http://hg.dovecot.org/dovecot/rev/38a73d870731
changeset: 5977:38a73d870731
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 13 00:18:24 2007 +0300
description:
Added mail_nfs_storage and mail_nfs_index settings.

diffstat:

6 files changed, 26 insertions(+)
dovecot-example.conf              |    7 +++++++
src/lib-storage/mail-storage.c    |    9 +++++++++
src/master/mail-process.c         |    4 ++++
src/master/master-settings-defs.c |    2 ++
src/master/master-settings.c      |    2 ++
src/master/master-settings.h      |    2 ++

diffs (86 lines):

diff -r 3a19830ab7f6 -r 38a73d870731 dovecot-example.conf
--- a/dovecot-example.conf	Fri Jul 13 00:15:56 2007 +0300
+++ b/dovecot-example.conf	Fri Jul 13 00:18:24 2007 +0300
@@ -302,6 +302,13 @@
 # at the cost of potential data loss if the server (or the file server)
 # goes down.
 #fsync_disable = no
+
+# Mail storage exists in NFS. Set this to yes to make Dovecot flush NFS caches
+# whenever needed. If you're using only a single mail server this isn't needed.
+#mail_nfs_storage = no
+# Mail index files also exist in NFS. Setting this to yes requires
+# mmap_disable=yes and fsync_disable=no.
+#mail_nfs_index = no
 
 # Disable mailbox list indexing.
 #mailbox_list_index_disable = no
diff -r 3a19830ab7f6 -r 38a73d870731 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Jul 13 00:15:56 2007 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Jul 13 00:18:24 2007 +0300
@@ -86,6 +86,15 @@ void mail_storage_parse_env(enum mail_st
 		*flags_r |= MAIL_STORAGE_FLAG_SAVE_CRLF;
 	if (getenv("FSYNC_DISABLE") != NULL)
 		*flags_r |= MAIL_STORAGE_FLAG_FSYNC_DISABLE;
+	if (getenv("MAIL_NFS_STORAGE") != NULL)
+		*flags_r |= MAIL_STORAGE_FLAG_NFS_FLUSH_STORAGE;
+	if (getenv("MAIL_NFS_INDEX") != NULL) {
+		*flags_r |= MAIL_STORAGE_FLAG_NFS_FLUSH_INDEX;
+		if ((*flags_r & MAIL_STORAGE_FLAG_MMAP_DISABLE) == 0)
+			i_fatal("mail_nfs_index=yes requires mmap_disable=yes");
+		if ((*flags_r & MAIL_STORAGE_FLAG_FSYNC_DISABLE) != 0)
+			i_fatal("mail_nfs_index=yes requires fsync_disable=no");
+	}
 
 	str = getenv("POP3_UIDL_FORMAT");
 	if (str != NULL && (str = strchr(str, '%')) != NULL &&
diff -r 3a19830ab7f6 -r 38a73d870731 src/master/mail-process.c
--- a/src/master/mail-process.c	Fri Jul 13 00:15:56 2007 +0300
+++ b/src/master/mail-process.c	Fri Jul 13 00:18:24 2007 +0300
@@ -334,6 +334,10 @@ mail_process_set_environment(struct sett
 		env_put("DOTLOCK_USE_EXCL=1");
 	if (set->fsync_disable)
 		env_put("FSYNC_DISABLE=1");
+	if (set->mail_nfs_storage)
+		env_put("MAIL_NFS_STORAGE=1");
+	if (set->mail_nfs_index)
+		env_put("MAIL_NFS_INDEX=1");
 	if (set->mailbox_list_index_disable)
 		env_put("MAILBOX_LIST_INDEX_DISABLE=1");
 	if (set->maildir_stat_dirs)
diff -r 3a19830ab7f6 -r 38a73d870731 src/master/master-settings-defs.c
--- a/src/master/master-settings-defs.c	Fri Jul 13 00:15:56 2007 +0300
+++ b/src/master/master-settings-defs.c	Fri Jul 13 00:18:24 2007 +0300
@@ -79,6 +79,8 @@ static struct setting_def setting_defs[]
 	DEF_BOOL(mmap_disable),
 	DEF_BOOL(dotlock_use_excl),
 	DEF_BOOL(fsync_disable),
+	DEF_BOOL(mail_nfs_storage),
+	DEF_BOOL(mail_nfs_index),
 	DEF_BOOL(mailbox_list_index_disable),
 	DEF_STR(lock_method),
 	DEF_BOOL(maildir_stat_dirs),
diff -r 3a19830ab7f6 -r 38a73d870731 src/master/master-settings.c
--- a/src/master/master-settings.c	Fri Jul 13 00:15:56 2007 +0300
+++ b/src/master/master-settings.c	Fri Jul 13 00:18:24 2007 +0300
@@ -235,6 +235,8 @@ struct settings default_settings = {
 #endif
 	MEMBER(dotlock_use_excl) FALSE,
 	MEMBER(fsync_disable) FALSE,
+	MEMBER(mail_nfs_storage) FALSE,
+	MEMBER(mail_nfs_index) FALSE,
 	MEMBER(mailbox_list_index_disable) FALSE,
 	MEMBER(lock_method) "fcntl",
 	MEMBER(maildir_stat_dirs) FALSE,
diff -r 3a19830ab7f6 -r 38a73d870731 src/master/master-settings.h
--- a/src/master/master-settings.h	Fri Jul 13 00:15:56 2007 +0300
+++ b/src/master/master-settings.h	Fri Jul 13 00:18:24 2007 +0300
@@ -91,6 +91,8 @@ struct settings {
 	bool mmap_disable;
 	bool dotlock_use_excl;
 	bool fsync_disable;
+	bool mail_nfs_storage;
+	bool mail_nfs_index;
 	bool mailbox_list_index_disable;
 	const char *lock_method;
 	bool maildir_stat_dirs;


More information about the dovecot-cvs mailing list