[dovecot-cvs] dovecot/src/lib-index mail-cache-transaction.c, 1.3, 1.4 mail-cache.c, 1.31, 1.32

cras at procontrol.fi cras at procontrol.fi
Mon Jun 21 17:20:10 EEST 2004


Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv15986/lib-index

Modified Files:
	mail-cache-transaction.c mail-cache.c 
Log Message:
Disable cache with mmap_disabled=yes, for now.



Index: mail-cache-transaction.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache-transaction.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mail-cache-transaction.c	20 Jun 2004 09:13:14 -0000	1.3
+++ mail-cache-transaction.c	21 Jun 2004 14:20:08 -0000	1.4
@@ -513,7 +513,7 @@
 	if ((data_size & 3) != 0)
 		memset(buf, 0, 4 - (data_size & 3));
 
-	/* remember the transaction uid range */
+	/* remember the transaction sequence range */
 	if (seq < ctx->first_seq || ctx->first_seq == 0)
 		ctx->first_seq = seq;
 	if (seq > ctx->last_seq)

Index: mail-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- mail-cache.c	20 Jun 2004 09:40:00 -0000	1.31
+++ mail-cache.c	21 Jun 2004 14:20:08 -0000	1.32
@@ -378,7 +378,8 @@
 	cache->fd = -1;
         cache->split_header_pool = pool_alloconly_create("Headers", 512);
 
-	if (mail_cache_open_or_create_file(cache, &hdr) < 0) {
+	if (index->mmap_disable ||
+	    mail_cache_open_or_create_file(cache, &hdr) < 0) {
 		/* failed for some reason - doesn't really matter,
 		   just disable caching. */
 		mail_cache_file_close(cache);
@@ -461,9 +462,12 @@
 {
 	int ret;
 
-	if (cache->locks++ != 0)
+	if (cache->locks != 0)
 		return 1;
 
+	if (cache->disabled)
+		return 0;
+
 	if (nonblock) {
 		ret = file_try_lock(cache->fd, F_WRLCK);
 		if (ret < 0)
@@ -484,6 +488,7 @@
 			mail_cache_unlock(cache);
 			return 0;
 		}
+		cache->locks++;
 	}
 	return ret;
 }
@@ -508,7 +513,8 @@
 
 int mail_cache_need_reset(struct mail_cache *cache, uint32_t *new_file_seq_r)
 {
-	if (cache->hdr->file_seq != cache->index->hdr->cache_file_seq) {
+	if (!cache->disabled &&
+	    cache->hdr->file_seq != cache->index->hdr->cache_file_seq) {
 		if (mail_cache_lock(cache, TRUE) == 0) {
 			*new_file_seq_r = cache->hdr->file_seq;
 			return TRUE;



More information about the dovecot-cvs mailing list