From: Timo Sirainen Date: Mon, 14 Nov 2011 22:34:00 +0000 (+0200) Subject: maildir: Added maildir_broken_filename_sizes setting. X-Git-Tag: 2.1.rc1~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80bcc6caa317a52bddcafe74fede886247dbba5b;p=thirdparty%2Fdovecot%2Fcore.git maildir: Added maildir_broken_filename_sizes setting. --- diff --git a/doc/example-config/conf.d/10-mail.conf b/doc/example-config/conf.d/10-mail.conf index 63f1b5e6e6..e05c6af4c9 100644 --- a/doc/example-config/conf.d/10-mail.conf +++ b/doc/example-config/conf.d/10-mail.conf @@ -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= 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 --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index c187c8ce4b..9c2adc0df6 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -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) { diff --git a/src/lib-storage/index/maildir/maildir-settings.c b/src/lib-storage/index/maildir/maildir-settings.c index be2f1e0349..ff3ba33918 100644 --- a/src/lib-storage/index/maildir/maildir-settings.c +++ b/src/lib-storage/index/maildir/maildir-settings.c @@ -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 --git a/src/lib-storage/index/maildir/maildir-settings.h b/src/lib-storage/index/maildir/maildir-settings.h index 098afd9a58..11b4917295 100644 --- a/src/lib-storage/index/maildir/maildir-settings.h +++ b/src/lib-storage/index/maildir/maildir-settings.h @@ -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);