]> 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)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 24 Jul 2017 15:44:40 +0000 (18:44 +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 3832a7c6be5d0e97077292baea85687ac5be5d4c..6d6f5cde4f69caf84ff4355510d37924413f346d 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 005f5c91b50a24d79de80c20f7c7bf435a6165b0..ab03535a5cf16826b8001f32b75cfb908b9ea7f0 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 dea6a0dbd14da925af88e0416cd9a6a070887050..fd5a20627065fbe5603d9a52dc72149528cf4e9e 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 = TRUE,
        .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 409669d26d91c1e35ee4e5277235b68635011227..288ad69572f0f2c44b3be1e7d0717ea3f0b1609c 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;