]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Added maildir_broken_filename_sizes setting.
authorTimo Sirainen <tss@iki.fi>
Mon, 14 Nov 2011 22:34:00 +0000 (00:34 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 14 Nov 2011 22:34:00 +0000 (00:34 +0200)
doc/example-config/conf.d/10-mail.conf
src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/maildir/maildir-settings.c
src/lib-storage/index/maildir/maildir-settings.h

index 63f1b5e6e63725443fbe7fcede2c57978f40ba37..e05c6af4c991e503207e9ea0c14754a4331c5adb 100644 (file)
 # when its mtime changes unexpectedly or when we can't find the mail otherwise.
 #maildir_very_dirty_syncs = no
 
+# If enabled, Dovecot doesn't use the S=<size> in the Maildir filenames for
+# getting the mail's physical size, except when recalculating Maildir++ quota.
+# This can be useful in systems where a lot of the Maildir filenames have a
+# broken size. The performance hit for enabling this is very small.
+#maildir_broken_filename_sizes = no
+
 ##
 ## mbox-specific settings
 ##
index c187c8ce4b772be2cd292d19f74d32ef0fe91443..9c2adc0df6e5e5e3ce2d1d1c92756e8030884656 100644 (file)
@@ -294,11 +294,12 @@ static int maildir_quick_size_lookup(struct index_mail *mail, bool vsize,
        }
 
        /* size can be included in filename */
-       if (maildir_filename_get_size(fname,
-                                     vsize ? MAILDIR_EXTRA_VIRTUAL_SIZE :
-                                     MAILDIR_EXTRA_FILE_SIZE,
-                                     size_r))
-               return 1;
+       if (vsize || !mbox->storage->set->maildir_broken_filename_sizes) {
+               if (maildir_filename_get_size(fname,
+                               vsize ? MAILDIR_EXTRA_VIRTUAL_SIZE :
+                                       MAILDIR_EXTRA_FILE_SIZE, size_r))
+                       return 1;
+       }
 
        /* size can be included in uidlist entry */
        if (!_mail->saving) {
index be2f1e03492b1673e4e3fa18badf84c02fde881b..ff3ba3391863be824aa7fbbc62eaf14a2f2c2015 100644 (file)
 static const struct setting_define maildir_setting_defines[] = {
        DEF(SET_BOOL, maildir_copy_with_hardlinks),
        DEF(SET_BOOL, maildir_very_dirty_syncs),
+       DEF(SET_BOOL, maildir_broken_filename_sizes),
 
        SETTING_DEFINE_LIST_END
 };
 
 static const struct maildir_settings maildir_default_settings = {
        .maildir_copy_with_hardlinks = TRUE,
-       .maildir_very_dirty_syncs = FALSE
+       .maildir_very_dirty_syncs = FALSE,
+       .maildir_broken_filename_sizes = FALSE
 };
 
 static const struct setting_parser_info maildir_setting_parser_info = {
index 098afd9a5821e6e4369930c030c443aa4487bd1c..11b49172959068fed21981bb6e8e3e3a22f1703d 100644 (file)
@@ -4,6 +4,7 @@
 struct maildir_settings {
        bool maildir_copy_with_hardlinks;
        bool maildir_very_dirty_syncs;
+       bool maildir_broken_filename_sizes;
 };
 
 const struct setting_parser_info *maildir_get_setting_parser_info(void);