dovecot-2.2: quota: Added more debug logs about quota_grace

dovecot at dovecot.org dovecot at dovecot.org
Sun Mar 31 19:02:44 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/c75b26e1d17f
changeset: 16135:c75b26e1d17f
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Mar 31 19:02:32 2013 +0300
description:
quota: Added more debug logs about quota_grace

diffstat:

 src/plugins/quota/quota-private.h |   1 +
 src/plugins/quota/quota.c         |  15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diffs (50 lines):

diff -r 800836bd8f2e -r c75b26e1d17f src/plugins/quota/quota-private.h
--- a/src/plugins/quota/quota-private.h	Sun Mar 31 18:43:13 2013 +0300
+++ b/src/plugins/quota/quota-private.h	Sun Mar 31 19:02:32 2013 +0300
@@ -26,6 +26,7 @@
 
 	const char *quota_exceeded_msg;
 	unsigned int debug:1;
+	unsigned int initialized:1;
 };
 
 struct quota_rule {
diff -r 800836bd8f2e -r c75b26e1d17f src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Sun Mar 31 18:43:13 2013 +0300
+++ b/src/plugins/quota/quota.c	Sun Mar 31 19:02:32 2013 +0300
@@ -227,6 +227,8 @@
 		pool_unref(&pool);
 		return 0;
 	}
+
+	quota_set->initialized = TRUE;
 	*set_r = quota_set;
 	return 1;
 }
@@ -454,6 +456,13 @@
 	quota_rule_recalculate_relative_rules(&root_set->grace_rule,
 					      bytes_limit, 0);
 	root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
+
+	if (root_set->set->debug && root_set->set->initialized) {
+		i_debug("Quota root %s: Recalculated relative rules with "
+			"bytes=%lld count=%lld. Now grace=%llu", root_set->name,
+			(long long)bytes_limit, (long long)count_limit,
+			(unsigned long long)root_set->last_mail_max_extra_bytes);
+	}
 }
 
 static int
@@ -632,6 +641,12 @@
 	quota_rule_recalculate_relative_rules(&root_set->grace_rule,
 		root_set->default_rule.bytes_limit, 0);
 	root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
+	if (root_set->set->debug) {
+		i_debug("Quota grace: root=%s bytes=%lld%s",
+			root_set->name, (long long)root_set->grace_rule.bytes_limit,
+			root_set->grace_rule.bytes_percent == 0 ? "" :
+			t_strdup_printf(" (%u%%)", root_set->grace_rule.bytes_percent));
+	}
 	return 0;
 }
 


More information about the dovecot-cvs mailing list