]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Disable cache with mmap_disabled=yes, for now.
authorTimo Sirainen <tss@iki.fi>
Mon, 21 Jun 2004 14:20:08 +0000 (17:20 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 21 Jun 2004 14:20:08 +0000 (17:20 +0300)
--HG--
branch : HEAD

src/lib-index/mail-cache-transaction.c
src/lib-index/mail-cache.c

index badc7321707ab1518939cb4a11138b6a980b278d..a0ddd24369c7d0c9300116eca7fc4da62a881fef 100644 (file)
@@ -513,7 +513,7 @@ int mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq,
        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 e852abe8ae55b77ac7ec9da43ed2e0c2ae8261fa..e1cc15114dedb4fd10a9733539917d1bf8faa87a 100644 (file)
@@ -378,7 +378,8 @@ struct mail_cache *mail_cache_open_or_create(struct mail_index *index)
        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 mail_cache_lock(struct mail_cache *cache, int nonblock)
 {
        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 @@ int mail_cache_lock(struct mail_cache *cache, int nonblock)
                        mail_cache_unlock(cache);
                        return 0;
                }
+               cache->locks++;
        }
        return ret;
 }
@@ -508,7 +513,8 @@ int mail_cache_is_locked(struct mail_cache *cache)
 
 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;