[dovecot-cvs] dovecot/src/lib-index mail-cache-transaction.c, 1.19,
1.20
cras at dovecot.org
cras at dovecot.org
Sun Aug 15 05:54:49 EEST 2004
Update of /home/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv19300
Modified Files:
mail-cache-transaction.c
Log Message:
rollback: don't lock file if we don't need to
Index: mail-cache-transaction.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache-transaction.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail-cache-transaction.c 31 Jul 2004 03:06:48 -0000 1.19
+++ mail-cache-transaction.c 15 Aug 2004 02:54:47 -0000 1.20
@@ -480,24 +480,28 @@
const uint32_t *buf;
size_t size;
- if (mail_cache_lock(cache) > 0) {
- mail_cache_transaction_free_space(ctx);
+ buf = buffer_get_data(ctx->reservations, &size);
+ i_assert(size % sizeof(uint32_t)*2 == 0);
+ size /= sizeof(*buf);
- buf = buffer_get_data(ctx->reservations, &size);
- i_assert(size % sizeof(uint32_t)*2 == 0);
- size /= sizeof(*buf);
+ if (ctx->reserved_space > 0 || size > 0) {
+ if (mail_cache_lock(cache) > 0) {
+ mail_cache_transaction_free_space(ctx);
- if (size > 0) {
- /* free flushed data as well. do it from end to
- beginning so we have a better chance of updating
- used_file_size instead of adding holes */
- do {
- size -= 2;
- mail_cache_free_space(ctx->cache, buf[size],
- buf[size+1]);
- } while (size > 0);
+ if (size > 0) {
+ /* free flushed data as well. do it from end to
+ beginning so we have a better chance of
+ updating used_file_size instead of adding
+ holes */
+ do {
+ size -= 2;
+ mail_cache_free_space(ctx->cache,
+ buf[size],
+ buf[size+1]);
+ } while (size > 0);
+ }
+ mail_cache_unlock(cache);
}
- mail_cache_unlock(cache);
}
mail_cache_transaction_free(ctx);
More information about the dovecot-cvs
mailing list