dovecot-2.2: trash plugin: Count more correctly the number of by...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 29 08:29:29 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/8898c5ea38f2
changeset: 18491:8898c5ea38f2
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 29 10:27:50 2015 +0200
description:
trash plugin: Count more correctly the number of bytes/messages needed to get under quota.
If there already were some messages saved, those weren't counted when
figuring out how many/much mails are still needed to be expunged.
Patch by Alexei Gradinari
diffstat:
src/plugins/trash/trash-plugin.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diffs (30 lines):
diff -r 2dbee58a1a0d -r 8898c5ea38f2 src/plugins/trash/trash-plugin.c
--- a/src/plugins/trash/trash-plugin.c Wed Apr 29 10:22:26 2015 +0200
+++ b/src/plugins/trash/trash-plugin.c Wed Apr 29 10:27:50 2015 +0200
@@ -222,6 +222,8 @@
uoff_t size, bool *too_large_r)
{
int ret, i;
+ uint64_t size_needed = 0;
+ unsigned int count_needed = 0;
for (i = 0; ; i++) {
ret = trash_next_quota_test_alloc(ctx, size, too_large_r);
@@ -241,9 +243,15 @@
break;
}
+ if (ctx->bytes_ceil != (uint64_t)-1 &&
+ ctx->bytes_ceil < size + ctx->bytes_over)
+ size_needed = size + ctx->bytes_over - ctx->bytes_ceil;
+ if (ctx->count_ceil != (uint64_t)-1 &&
+ ctx->count_ceil < 1 + ctx->count_over)
+ count_needed = 1 + ctx->count_over - ctx->count_ceil;
+
/* not enough space. try deleting some from mailbox. */
- ret = trash_try_clean_mails(ctx, size + ctx->bytes_over,
- 1 + ctx->count_over);
+ ret = trash_try_clean_mails(ctx, size_needed, count_needed);
if (ret <= 0)
return 0;
}
More information about the dovecot-cvs
mailing list