Dovecot/doveadm quota
Martynas Bendorius
martynas at martynas.it
Fri Feb 7 11:07:44 EET 2020
Hello,
Is there any reason why dovecot relies on S= instead of real disk size email takes?
1) compressed mails take less than than the S= specified
2) we could avoid using "S=" for the lookups and count every file there, including indexes and mails without S=... if we'd read filesizes
Eample:
# ls -l '1567026317.M331058P4751.testing.server.com,S=3086,W=3148:2,S'
-rw------- 1 dev mail 1274 Aug 29 00:05 1567026317.M331058P4751.testing.server.com,S=3086,W=3148:2,S
Proposed patch (solves #1, not sure about your opinion on #2):
--- src/plugins/quota/quota-maildir.c.orig 2020-02-05 19:21:08.582998417 -0700
+++ src/plugins/quota/quota-maildir.c 2020-02-05 19:21:22.184998798 -0700
@@ -84,7 +84,7 @@
p = strstr(dp->d_name, ",S=");
num = (uoff_t)-1;
- if (p != NULL) {
+ if (0 && p != NULL) {
/* ,S=nnnn[:,] */
p += 3;
for (num = 0; *p >= '0' && *p <= '9'; p++)
@@ -104,7 +104,7 @@
str_truncate(path, len);
str_append(path, dp->d_name);
if (stat(str_c(path), &st) == 0) {
- *total_bytes += st.st_size;
+ *total_bytes += st.st_blocks * 512;
*total_count += 1;
} else if (errno != ENOENT && errno != ESTALE) {
*error_r = t_strdup_printf(
Thank you!
--
Best regards,
Martynas Bendorius
More information about the dovecot
mailing list