dovecot: mmap_disable=yes: Don't invalidate file cache unneededl...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 13 06:23:28 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/407f75ee2598
changeset: 6795:407f75ee2598
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 13 06:23:22 2007 +0200
description:
mmap_disable=yes: Don't invalidate file cache unneededly when reading cache
fields.

diffstat:

1 file changed, 6 insertions(+), 2 deletions(-)
src/lib-index/mail-cache-fields.c |    8 ++++++--

diffs (32 lines):

diff -r 513076febc7a -r 407f75ee2598 src/lib-index/mail-cache-fields.c
--- a/src/lib-index/mail-cache-fields.c	Mon Nov 12 20:13:51 2007 +0200
+++ b/src/lib-index/mail-cache-fields.c	Tue Nov 13 06:23:22 2007 +0200
@@ -172,6 +172,7 @@ static int mail_cache_header_fields_get_
 	struct mail_cache_header_fields tmp_field_hdr;
 	uint32_t offset = 0, next_offset;
 	unsigned int next_count = 0;
+	bool invalidate = FALSE;
 	int ret;
 
 	if (MAIL_CACHE_IS_UNUSABLE(cache)) {
@@ -191,6 +192,7 @@ static int mail_cache_header_fields_get_
 			return -1;
 		}
 		offset = next_offset;
+		invalidate = TRUE;
 
 		if (cache->mmap_base != NULL) {
 			if (mail_cache_map(cache, offset,
@@ -231,8 +233,10 @@ static int mail_cache_header_fields_get_
 		cache->need_compress_file_seq = cache->hdr->file_seq;
 
 	if (map) {
-		if (cache->file_cache != NULL) {
-			/* we can't trust that the cached data is valid */
+		if (cache->file_cache != NULL && invalidate) {
+			/* if this isn't the first header in file and we hadn't
+			   read this before, we can't trust that the cached
+			   data is valid */
 			file_cache_invalidate(cache->file_cache, offset,
 					      field_hdr->size);
 		}


More information about the dovecot-cvs mailing list