dovecot-2.1: maildir: Added maildir_broken_filename_sizes setting.

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 15 00:34:12 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/3c5d3d618c76
changeset: 13695:3c5d3d618c76
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 15 00:34:00 2011 +0200
description:
maildir: Added maildir_broken_filename_sizes setting.

diffstat:

 doc/example-config/conf.d/10-mail.conf           |   6 ++++++
 src/lib-storage/index/maildir/maildir-mail.c     |  11 ++++++-----
 src/lib-storage/index/maildir/maildir-settings.c |   4 +++-
 src/lib-storage/index/maildir/maildir-settings.h |   1 +
 4 files changed, 16 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r 466badb63c0b -r 3c5d3d618c76 doc/example-config/conf.d/10-mail.conf
--- 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
 ##
diff -r 466badb63c0b -r 3c5d3d618c76 src/lib-storage/index/maildir/maildir-mail.c
--- 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) {
diff -r 466badb63c0b -r 3c5d3d618c76 src/lib-storage/index/maildir/maildir-settings.c
--- 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 = {
diff -r 466badb63c0b -r 3c5d3d618c76 src/lib-storage/index/maildir/maildir-settings.h
--- 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);


More information about the dovecot-cvs mailing list