dovecot-2.2: Avoid logging warnings about increasing memory pool...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 25 10:29:03 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/90891ca867f3
changeset: 17836:90891ca867f3
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 25 13:28:39 2014 +0300
description:
Avoid logging warnings about increasing memory pool/data stack with DEBUG on.
These could have a minor effect on memory usage, but shouldn't be much.

diffstat:

 src/config/config-filter.c               |   8 ++++----
 src/config/config-parser.c               |  22 ++++++++++++++++++----
 src/config/config-request.c              |  12 +++++++-----
 src/config/doveconf.c                    |   2 +-
 src/doveadm/dsync/dsync-brain-mailbox.c  |   2 +-
 src/doveadm/dsync/dsync-ibc-pipe.c       |   2 +-
 src/lib-master/master-instance.c         |   2 +-
 src/lib-master/master-service-settings.c |   2 +-
 src/lib-settings/settings-parser.c       |   4 ++--
 src/lib-storage/mail-storage-service.c   |   2 +-
 src/lib-storage/mail-user.c              |   2 +-
 src/master/service.c                     |   2 +-
 12 files changed, 39 insertions(+), 23 deletions(-)

diffs (240 lines):

diff -r 87f10e2fac95 -r 90891ca867f3 src/config/config-filter.c
--- a/src/config/config-filter.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/config/config-filter.c	Thu Sep 25 13:28:39 2014 +0300
@@ -185,7 +185,7 @@
 }
 
 static struct config_filter_parser *const *
-config_filter_find_all(struct config_filter_context *ctx,
+config_filter_find_all(struct config_filter_context *ctx, pool_t pool,
 		       const char *const *modules,
 		       const struct config_filter *filter,
 		       struct master_service_settings_output *output_r)
@@ -196,8 +196,8 @@
 
 	memset(output_r, 0, sizeof(*output_r));
 
-	t_array_init(&matches, 8);
-	t_array_init(&service_names, 8);
+	p_array_init(&matches, pool, 8);
+	p_array_init(&service_names, pool, 8);
 	for (i = 0; ctx->parsers[i] != NULL; i++) {
 		const struct config_filter *mask = &ctx->parsers[i]->filter;
 
@@ -322,7 +322,7 @@
 	   with an error. Merging SET_STRLIST types requires
 	   settings_parser_apply_changes() to work a bit unintuitively by
 	   letting the destination settings override the source settings. */
-	src = config_filter_find_all(ctx, modules, filter, output_r);
+	src = config_filter_find_all(ctx, pool, modules, filter, output_r);
 
 	/* all of them should have the same number of parsers.
 	   duplicate our initial parsers from the first match */
diff -r 87f10e2fac95 -r 90891ca867f3 src/config/config-parser.c
--- a/src/config/config-parser.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/config/config-parser.c	Thu Sep 25 13:28:39 2014 +0300
@@ -336,6 +336,10 @@
 			   const struct config_module_parser *p,
 			   const char **error_r)
 {
+	const char *error;
+	char *error_dup = NULL;
+	bool ok;
+
 	for (; p->root != NULL; p++) {
 		/* skip checking settings we don't care about */
 		if (!config_module_want_parser(ctx->root_parsers,
@@ -343,8 +347,17 @@
 			continue;
 
 		settings_parse_var_skip(p->parser);
-		if (!settings_parser_check(p->parser, ctx->pool, error_r))
+		T_BEGIN {
+			ok = settings_parser_check(p->parser, ctx->pool, &error);
+			if (!ok)
+				error_dup = i_strdup(error);
+		} T_END;
+		if (!ok) {
+			i_assert(error_dup != NULL);
+			*error_r = t_strdup(error_dup);
+			i_free(error_dup);
 			return -1;
+		}
 	}
 	return 0;
 }
@@ -392,7 +405,7 @@
 		return -1;
 	}
 
-	tmp_pool = pool_alloconly_create("config parsers check", 1024*64);
+	tmp_pool = pool_alloconly_create(MEMPOOL_GROWING"config parsers check", 1024*64);
 	parsers = array_get(&ctx->all_parsers, &count);
 	i_assert(count > 0 && parsers[count-1] == NULL);
 	count--;
@@ -909,7 +922,7 @@
 	}
 
 	memset(&ctx, 0, sizeof(ctx));
-	ctx.pool = pool_alloconly_create("config file parser", 1024*256);
+	ctx.pool = pool_alloconly_create(MEMPOOL_GROWING"config file parser", 1024*256);
 	ctx.path = path;
 	ctx.hide_errors = fd == -1;
 
@@ -940,8 +953,9 @@
 		i_stream_create_from_data("", 0);
 	i_stream_set_return_partial_line(ctx.cur_input->input, TRUE);
 	old_settings_init(&ctx);
-	if (hook_config_parser_begin != NULL)
+	if (hook_config_parser_begin != NULL) T_BEGIN {
 		hook_config_parser_begin(&ctx);
+	} T_END;
 
 prevfile:
 	while ((line = i_stream_read_next_line(ctx.cur_input->input)) != NULL) {
diff -r 87f10e2fac95 -r 90891ca867f3 src/config/config-request.c
--- a/src/config/config-request.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/config/config-request.c	Thu Sep 25 13:28:39 2014 +0300
@@ -357,8 +357,8 @@
 	ctx->callback = callback;
 	ctx->context = context;
 	ctx->scope = scope;
-	ctx->value = t_str_new(256);
-	ctx->prefix = t_str_new(64);
+	ctx->value = str_new(pool, 256);
+	ctx->prefix = str_new(pool, 64);
 	hash_table_create(&ctx->keys, ctx->pool, 0, str_hash, strcmp);
 	return ctx;
 }
@@ -419,9 +419,11 @@
 					       ctx->modules, parser->root))
 			continue;
 
-		settings_export(ctx, parser->root, FALSE,
-				settings_parser_get(parser->parser),
-				settings_parser_get_changes(parser->parser));
+		T_BEGIN {
+			settings_export(ctx, parser->root, FALSE,
+					settings_parser_get(parser->parser),
+					settings_parser_get_changes(parser->parser));
+		} T_END;
 
 		if ((ctx->flags & CONFIG_DUMP_FLAG_CHECK_SETTINGS) != 0) {
 			settings_parse_var_skip(parser->parser);
diff -r 87f10e2fac95 -r 90891ca867f3 src/config/doveconf.c
--- a/src/config/doveconf.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/config/doveconf.c	Thu Sep 25 13:28:39 2014 +0300
@@ -129,7 +129,7 @@
 	enum config_dump_flags flags;
 	pool_t pool;
 
-	pool = pool_alloconly_create("config human strings", 1024*32);
+	pool = pool_alloconly_create(MEMPOOL_GROWING"config human strings", 1024*32);
 	ctx = p_new(pool, struct config_dump_human_context, 1);
 	ctx->pool = pool;
 	ctx->list_prefix = str_new(ctx->pool, 128);
diff -r 87f10e2fac95 -r 90891ca867f3 src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c	Thu Sep 25 13:28:39 2014 +0300
@@ -144,7 +144,7 @@
 		p_clear(brain->dsync_box_pool);
 	else {
 		brain->dsync_box_pool =
-			pool_alloconly_create("dsync brain box pool", 1024);
+			pool_alloconly_create(MEMPOOL_GROWING"dsync brain box pool", 2048);
 	}
 	dsync_mailbox_cache_field_dup(&brain->local_dsync_box.cache_fields,
 				      &local_dsync_box->cache_fields,
diff -r 87f10e2fac95 -r 90891ca867f3 src/doveadm/dsync/dsync-ibc-pipe.c
--- a/src/doveadm/dsync/dsync-ibc-pipe.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/doveadm/dsync/dsync-ibc-pipe.c	Thu Sep 25 13:28:39 2014 +0300
@@ -62,7 +62,7 @@
 
 	pools = array_get_modifiable(&pipe->pools, &count);
 	if (count == 0)
-		return pool_alloconly_create("pipe item pool", 1024);
+		return pool_alloconly_create(MEMPOOL_GROWING"pipe item pool", 1024);
 
 	ret = pools[count-1];
 	array_delete(&pipe->pools, count-1, 1);
diff -r 87f10e2fac95 -r 90891ca867f3 src/lib-master/master-instance.c
--- a/src/lib-master/master-instance.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/lib-master/master-instance.c	Thu Sep 25 13:28:39 2014 +0300
@@ -38,7 +38,7 @@
 	struct master_instance_list *list;
 	pool_t pool;
 
-	pool = pool_alloconly_create("master instances", 256);
+	pool = pool_alloconly_create(MEMPOOL_GROWING"master instances", 256);
 	list = p_new(pool, struct master_instance_list, 1);
 	list->pool = pool;
 	list->path = p_strdup(pool, path);
diff -r 87f10e2fac95 -r 90891ca867f3 src/lib-master/master-service-settings.c
--- a/src/lib-master/master-service-settings.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/lib-master/master-service-settings.c	Thu Sep 25 13:28:39 2014 +0300
@@ -413,7 +413,7 @@
 		p_clear(service->set_pool);
 	} else {
 		service->set_pool =
-			pool_alloconly_create("master service settings", 8192);
+			pool_alloconly_create("master service settings", 16384);
 	}
 
 	p_array_init(&all_roots, service->set_pool, 8);
diff -r 87f10e2fac95 -r 90891ca867f3 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/lib-settings/settings-parser.c	Thu Sep 25 13:28:39 2014 +0300
@@ -118,7 +118,7 @@
 	memset(&info, 0, sizeof(info));
 	info = *def->list_info;
 
-	for (i = 0; i < count; i++) {
+	for (i = 0; i < count; i++) T_BEGIN {
 		new_set = p_malloc(ctx->set_pool, info.struct_size);
 		array_append(arr, &new_set, 1);
 
@@ -148,7 +148,7 @@
 
 		info.defaults = children[i];
 		setting_parser_copy_defaults(ctx, &info, new_link);
-	}
+	} T_END;
 }
 
 static void
diff -r 87f10e2fac95 -r 90891ca867f3 src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/lib-storage/mail-storage-service.c	Thu Sep 25 13:28:39 2014 +0300
@@ -1022,7 +1022,7 @@
 	pool_t user_pool, temp_pool;
 	int ret = 1;
 
-	user_pool = pool_alloconly_create("mail storage service user", 1024*6);
+	user_pool = pool_alloconly_create(MEMPOOL_GROWING"mail storage service user", 1024*6);
 	flags = mail_storage_service_input_get_flags(ctx, input);
 
 	if ((flags & MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP) != 0 &&
diff -r 87f10e2fac95 -r 90891ca867f3 src/lib-storage/mail-user.c
--- a/src/lib-storage/mail-user.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/lib-storage/mail-user.c	Thu Sep 25 13:28:39 2014 +0300
@@ -49,7 +49,7 @@
 	i_assert(username != NULL);
 	i_assert(*username != '\0');
 
-	pool = pool_alloconly_create("mail user", 16*1024);
+	pool = pool_alloconly_create(MEMPOOL_GROWING"mail user", 16*1024);
 	user = p_new(pool, struct mail_user, 1);
 	user->pool = pool;
 	user->refcount = 1;
diff -r 87f10e2fac95 -r 90891ca867f3 src/master/service.c
--- a/src/master/service.c	Thu Sep 25 13:26:20 2014 +0300
+++ b/src/master/service.c	Thu Sep 25 13:28:39 2014 +0300
@@ -497,7 +497,7 @@
 {
 	pool_t pool;
 
-	pool = pool_alloconly_create("services pool", 4096);
+	pool = pool_alloconly_create("services pool", 32768);
 	if (services_create_real(set, pool, services_r, error_r) < 0) {
 		pool_unref(&pool);
 		return -1;


More information about the dovecot-cvs mailing list