changeset 13695:3c5d3d618c76

maildir: Added maildir_broken_filename_sizes setting.
author Timo Sirainen <tss@iki.fi>
date Tue, 15 Nov 2011 00:34:00 +0200
parents 466badb63c0b
children c8076e71c849
files 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
diffstat 4 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/doc/example-config/conf.d/10-mail.conf	Tue Nov 15 00:05:50 2011 +0200
+++ b/doc/example-config/conf.d/10-mail.conf	Tue Nov 15 00:34:00 2011 +0200
@@ -251,6 +251,12 @@
 # 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
 ##
--- a/src/lib-storage/index/maildir/maildir-mail.c	Tue Nov 15 00:05:50 2011 +0200
+++ b/src/lib-storage/index/maildir/maildir-mail.c	Tue Nov 15 00:34:00 2011 +0200
@@ -294,11 +294,12 @@
 	}
 
 	/* 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) {
--- a/src/lib-storage/index/maildir/maildir-settings.c	Tue Nov 15 00:05:50 2011 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.c	Tue Nov 15 00:34:00 2011 +0200
@@ -14,13 +14,15 @@
 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 = {
--- a/src/lib-storage/index/maildir/maildir-settings.h	Tue Nov 15 00:05:50 2011 +0200
+++ b/src/lib-storage/index/maildir/maildir-settings.h	Tue Nov 15 00:34:00 2011 +0200
@@ -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);