changeset 5498:21199280aa3b HEAD

Added mailbox_list_index_disable setting.
author Timo Sirainen <tss@iki.fi>
date Tue, 03 Apr 2007 08:54:55 +0300
parents e57b685ad093
children e1e19a0db57d
files dovecot-example.conf src/lib-storage/list/index-mailbox-list-sync.c src/lib-storage/list/index-mailbox-list.c src/master/mail-process.c src/master/master-settings-defs.c src/master/master-settings.c src/master/master-settings.h
diffstat 7 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dovecot-example.conf	Tue Apr 03 08:42:33 2007 +0300
+++ b/dovecot-example.conf	Tue Apr 03 08:54:55 2007 +0300
@@ -297,6 +297,9 @@
 # goes down.
 #fsync_disable = no
 
+# Disable mailbox list indexing.
+#mailbox_list_index_disable = no
+
 # Locking method for index files. Alternatives are fcntl, flock and dotlock.
 # Dotlocking uses some tricks which may create more disk I/O than other locking
 # methods. NOTE: If you use NFS, remember to change also mmap_disable setting!
--- a/src/lib-storage/list/index-mailbox-list-sync.c	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/lib-storage/list/index-mailbox-list-sync.c	Tue Apr 03 08:54:55 2007 +0300
@@ -464,13 +464,14 @@
 
 static void index_list_mail_mailbox_opened(struct mailbox *box)
 {
+	struct index_mailbox_list *ilist =
+		INDEX_LIST_CONTEXT(box->storage->list);
 	struct index_list_mailbox *ibox;
 
 	if (index_list_next_hook_mailbox_created != NULL)
 		index_list_next_hook_mailbox_created(box);
 
-	/* FIXME: maildir-only for now */
-	if (strcmp(box->storage->list->name, "maildir++") != 0)
+	if (ilist == NULL)
 		return;
 
 	ibox = p_new(box->pool, struct index_list_mailbox, 1);
--- a/src/lib-storage/list/index-mailbox-list.c	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/lib-storage/list/index-mailbox-list.c	Tue Apr 03 08:54:55 2007 +0300
@@ -10,6 +10,7 @@
 #include "mailbox-list-index.h"
 #include "index-mailbox-list.h"
 
+#include <stdlib.h>
 #include <time.h>
 #include <sys/stat.h>
 
@@ -393,12 +394,17 @@
 
 static void index_mailbox_list_created(struct mailbox_list *list)
 {
-	struct index_mailbox_list *ilist;
+	struct index_mailbox_list *ilist = NULL;
 	const char *dir;
 
 	/* FIXME: for now we only work with maildir++ */
-	if (strcmp(list->name, "maildir++") != 0)
+	if (getenv("MAILBOX_LIST_INDEX_DISABLE") != NULL ||
+	    strcmp(list->name, "maildir++") != 0) {
+		/* reserve the module context anyway, so syncing code knows
+		   that the index is disabled */
+		MODULE_CONTEXT_SET(list, index_mailbox_list_module, ilist);
 		return;
+	}
 
 	ilist = p_new(list->pool, struct index_mailbox_list, 1);
 	ilist->module_ctx.super = list->v;
--- a/src/master/mail-process.c	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/master/mail-process.c	Tue Apr 03 08:54:55 2007 +0300
@@ -241,6 +241,8 @@
 		env_put("DOTLOCK_USE_EXCL=1");
 	if (set->fsync_disable)
 		env_put("FSYNC_DISABLE=1");
+	if (set->mailbox_list_index_disable)
+		env_put("MAILBOX_LIST_INDEX_DISABLE=1");
 	if (set->maildir_stat_dirs)
 		env_put("MAILDIR_STAT_DIRS=1");
 	if (set->maildir_copy_with_hardlinks)
--- a/src/master/master-settings-defs.c	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/master/master-settings-defs.c	Tue Apr 03 08:54:55 2007 +0300
@@ -77,6 +77,7 @@
 	DEF_BOOL(mmap_no_write),
 	DEF_BOOL(dotlock_use_excl),
 	DEF_BOOL(fsync_disable),
+	DEF_BOOL(mailbox_list_index_disable),
 	DEF_STR(lock_method),
 	DEF_BOOL(maildir_stat_dirs),
 	DEF_BOOL(maildir_copy_with_hardlinks),
--- a/src/master/master-settings.c	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/master/master-settings.c	Tue Apr 03 08:54:55 2007 +0300
@@ -229,6 +229,7 @@
 #endif
 	MEMBER(dotlock_use_excl) FALSE,
 	MEMBER(fsync_disable) FALSE,
+	MEMBER(mailbox_list_index_disable) FALSE,
 	MEMBER(lock_method) "fcntl",
 	MEMBER(maildir_stat_dirs) FALSE,
 	MEMBER(maildir_copy_with_hardlinks) FALSE,
--- a/src/master/master-settings.h	Tue Apr 03 08:42:33 2007 +0300
+++ b/src/master/master-settings.h	Tue Apr 03 08:54:55 2007 +0300
@@ -81,6 +81,7 @@
 	bool mmap_no_write;
 	bool dotlock_use_excl;
 	bool fsync_disable;
+	bool mailbox_list_index_disable;
 	const char *lock_method;
 	bool maildir_stat_dirs;
 	bool maildir_copy_with_hardlinks;