dovecot-2.2: maildir: Make sure the filename contains S=size and...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 30 03:10:11 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/494b5e18be58
changeset: 17295:494b5e18be58
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 30 06:03:56 2014 +0300
description:
maildir: Make sure the filename contains S=size and W=size even if GUID doesn't.
diffstat:
src/lib-storage/index/maildir/maildir-save.c | 26 ++++++++++++++++----------
1 files changed, 16 insertions(+), 10 deletions(-)
diffs (47 lines):
diff -r 021f78ba15c1 -r 494b5e18be58 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c Tue Apr 29 16:44:58 2014 +0300
+++ b/src/lib-storage/index/maildir/maildir-save.c Wed Apr 30 06:03:56 2014 +0300
@@ -838,27 +838,33 @@
struct maildir_filename *mf,
struct maildir_filename *prev_mf)
{
- uoff_t size;
+ uoff_t size, vsize;
if (!ctx->locked_uidlist_refresh && ctx->locked) {
(void)maildir_uidlist_refresh(ctx->mbox->uidlist);
ctx->locked_uidlist_refresh = TRUE;
}
- if (!ctx->locked_uidlist_refresh ||
+ if (!maildir_filename_get_size(mf->dest_basename,
+ MAILDIR_EXTRA_FILE_SIZE, &size))
+ size = (uoff_t)-1;
+ if (!maildir_filename_get_size(mf->dest_basename,
+ MAILDIR_EXTRA_VIRTUAL_SIZE, &vsize))
+ vsize = (uoff_t)-1;
+
+ if (size != mf->size || vsize != mf->vsize ||
+ !ctx->locked_uidlist_refresh ||
(prev_mf != NULL && maildir_filename_has_conflict(mf, prev_mf)) ||
maildir_uidlist_get_full_filename(ctx->mbox->uidlist,
mf->dest_basename) != NULL) {
- /* file already exists. give it another name.
+ /* a) dest_basename didn't contain the (correct) size/vsize.
+ they're required for good performance.
+
+ b) file already exists. give it another name.
but preserve the size/vsize in the filename if possible */
- if (mf->size == (uoff_t)-1 &&
- maildir_filename_get_size(mf->dest_basename,
- MAILDIR_EXTRA_FILE_SIZE, &size))
+ if (mf->size == (uoff_t)-1)
mf->size = size;
- if (mf->vsize == (uoff_t)-1 &&
- maildir_filename_get_size(mf->dest_basename,
- MAILDIR_EXTRA_VIRTUAL_SIZE,
- &size))
+ if (mf->vsize == (uoff_t)-1)
mf->vsize = size;
mf->guid = mf->dest_basename;
More information about the dovecot-cvs
mailing list