]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add mailbox_list_index_include_inbox setting
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Jul 2017 11:17:22 +0000 (14:17 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 25 Jul 2017 15:04:13 +0000 (18:04 +0300)
This controls whether to update INBOX's STATUS information in the mailbox
list index. It can be useful especially if LISTINDEX points to a tmpfs,
but perhaps also in other situations.

I considered adding a more generic setting to exclude other mailboxes, but
the namespace prefixes and hierarchy separators get a bit complicated with
shared mailboxes. It's probably also not very useful to change this for
anything but the INBOX.

doc/example-config/conf.d/10-mail.conf
src/lib-storage/list/mailbox-list-index-status.c
src/lib-storage/mail-storage-settings.c
src/lib-storage/mail-storage-settings.h

index 62a5bb4bd5d621fe4eccc279825bbdac83e6671b..654a3749e0ad0969e164516a0937d8f23eb82117 100644 (file)
@@ -227,6 +227,10 @@ namespace inbox {
 # The results will be automatically fixed once the folders are opened.
 #mailbox_list_index_very_dirty_syncs = yes
 
+# Should INBOX be kept up-to-date in the mailbox list index? By default it's
+# not, because most of the mailbox accesses will open INBOX anyway.
+#mailbox_list_index_include_inbox = no
+
 # The minimum number of mails in a mailbox before updates are done to cache
 # file. This allows optimizing Dovecot's behavior to do less disk writes at
 # the cost of more disk reads.
index 3dc4640c63a6350adb563a1e48a4a14993226bec..b01fcddeaa6d97fbd83c032279db6da9ddfeb8db 100644 (file)
@@ -27,11 +27,10 @@ struct index_list_changes {
 struct index_list_storage_module index_list_storage_module =
        MODULE_CONTEXT_INIT(&mail_storage_module_register);
 
-/* Never update the STATUS information for INBOX. INBOX is almost always opened
-   anyway, so this just causes extra writes. (Although this could be useful if
-   somebody has a lot of other users' shared INBOXes.) */
+/* Should the STATUS information for this mailbox not be written to the
+   mailbox list index? */
 #define MAILBOX_IS_NEVER_IN_INDEX(box) \
-       ((box)->inbox_any)
+       ((box)->inbox_any && !(box)->storage->set->mailbox_list_index_include_inbox)
 
 static int
 index_list_open_view(struct mailbox *box, bool status_check,
index 4d674bfbc249551d728675b22a04c26e76908188..b95e2ee2bc8d083395d65612c4432ff0e64cb7cc 100644 (file)
@@ -52,6 +52,7 @@ static const struct setting_define mail_storage_setting_defines[] = {
        DEF(SET_BOOL, mail_nfs_index),
        DEF(SET_BOOL, mailbox_list_index),
        DEF(SET_BOOL, mailbox_list_index_very_dirty_syncs),
+       DEF(SET_BOOL, mailbox_list_index_include_inbox),
        DEF(SET_BOOL, mail_debug),
        DEF(SET_BOOL, mail_full_filesystem_access),
        DEF(SET_BOOL, maildir_stat_dirs),
@@ -94,6 +95,7 @@ const struct mail_storage_settings mail_storage_default_settings = {
        .mail_nfs_index = FALSE,
        .mailbox_list_index = FALSE,
        .mailbox_list_index_very_dirty_syncs = FALSE,
+       .mailbox_list_index_include_inbox = FALSE,
        .mail_debug = FALSE,
        .mail_full_filesystem_access = FALSE,
        .maildir_stat_dirs = FALSE,
index e0ee95dcbba81e30d4992ff0b00efa3c01f8014a..400805c32497f579238aa76fa40f140f8fdd2c20 100644 (file)
@@ -38,6 +38,7 @@ struct mail_storage_settings {
        bool mail_nfs_index;
        bool mailbox_list_index;
        bool mailbox_list_index_very_dirty_syncs;
+       bool mailbox_list_index_include_inbox;
        bool mail_debug;
        bool mail_full_filesystem_access;
        bool maildir_stat_dirs;