This describes better what it does, because it's not just unlocking.
array_free(&ext_offsets);
if (*unlock) {
- (void)mail_cache_unlock(cache);
+ (void)mail_cache_flush_and_unlock(cache);
*unlock = FALSE;
}
cache->need_compress_file_seq = 0;
if (*unlock) {
- (void)mail_cache_unlock(cache);
+ (void)mail_cache_flush_and_unlock(cache);
*unlock = FALSE;
}
ret = mail_cache_compress_locked(cache, compress_file_seq, trans, &unlock);
cache->compressing = FALSE;
if (unlock) {
- if (mail_cache_unlock(cache) < 0)
+ if (mail_cache_flush_and_unlock(cache) < 0)
ret = -1;
}
if (ret < 0) {
T_BEGIN {
ret = mail_cache_header_fields_update_locked(cache);
} T_END;
- if (mail_cache_unlock(cache) < 0)
+ if (mail_cache_flush_and_unlock(cache) < 0)
ret = -1;
return ret;
}
int mail_cache_lock(struct mail_cache *cache);
int mail_cache_try_lock(struct mail_cache *cache);
/* Returns -1 if cache is / just got corrupted, 0 if ok. */
-int mail_cache_unlock(struct mail_cache *cache);
+int mail_cache_flush_and_unlock(struct mail_cache *cache);
int mail_cache_write(struct mail_cache *cache, const void *data, size_t size,
uoff_t offset);
else
cache->hdr_copy.record_count = 0;
cache->hdr_modified = TRUE;
- (void)mail_cache_unlock(cache);
+ (void)mail_cache_flush_and_unlock(cache);
}
}
if (mail_cache_transaction_lock(ctx) > 0) {
ctx->cache->hdr_copy.deleted_record_count +=
ctx->records_written;
- (void)mail_cache_unlock(ctx->cache);
+ (void)mail_cache_flush_and_unlock(ctx->cache);
}
}
it to free up some space. */
if (cache->hdr->continued_record_count > 0 ||
cache->hdr->deleted_record_count > 0) {
- (void)mail_cache_unlock(cache);
+ (void)mail_cache_flush_and_unlock(cache);
(void)mail_cache_transaction_compress(ctx);
return mail_cache_transaction_lock(ctx);
}
i_assert(ctx->last_rec_pos <= ctx->cache_data->used);
if (mail_cache_transaction_update_fields(ctx) < 0) {
- (void)mail_cache_unlock(ctx->cache);
+ (void)mail_cache_flush_and_unlock(ctx->cache);
return -1;
}
ctx->records_written++;
mail_cache_transaction_update_index(ctx, write_offset);
}
- if (mail_cache_unlock(ctx->cache) < 0)
+ if (mail_cache_flush_and_unlock(ctx->cache) < 0)
ret = -1;
return ret;
}
if (cache->read_buf != NULL)
buffer_set_used_size(cache->read_buf, 0);
if ((ret = mail_cache_map_all(cache)) <= 0) {
- (void)mail_cache_unlock(cache);
+ (void)mail_cache_flush_and_unlock(cache);
return ret;
}
cache->hdr_copy = *cache->hdr;
return mail_cache_lock_full(cache, TRUE);
}
-int mail_cache_unlock(struct mail_cache *cache)
+int mail_cache_flush_and_unlock(struct mail_cache *cache)
{
int ret = 0;