Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2807:ad3fcccca2bb HEAD
More expunge/rewrite fixes.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 22 Oct 2004 03:48:44 +0300 |
parents | 535e3e2d230e |
children | 48250919bbc4 |
files | src/lib-storage/index/mbox/mbox-sync-rewrite.c src/lib-storage/index/mbox/mbox-sync.c |
diffstat | 2 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-sync-rewrite.c Thu Oct 21 23:58:23 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync-rewrite.c Fri Oct 22 03:48:44 2004 +0300 @@ -452,7 +452,6 @@ break; } move_diff -= next_move_diff + mails[idx].space; - end_offset = next_end_offset; } else { /* this mail provides more space. just move it forward from the extra space offset and set end_offset to @@ -475,17 +474,18 @@ if ((mails[idx].flags & MBOX_EXPUNGED) == 0) { move_diff -= padding_per_mail; mails[idx].space = padding_per_mail; + + if (mbox_fill_space(sync_ctx, move_diff + + mails[idx].offset, + padding_per_mail) < 0) { + ret = -1; + break; + } } - mails[idx].offset += move_diff; - if (mbox_fill_space(sync_ctx, mails[idx].offset, - padding_per_mail) < 0) { - ret = -1; - break; - } } - i_assert(idx > 0 || move_diff == 0); + i_assert(move_diff >= 0 || idx == first_nonexpunged_idx); end_offset = next_end_offset; mails[idx].from_offset += move_diff;
--- a/src/lib-storage/index/mbox/mbox-sync.c Thu Oct 21 23:58:23 2004 +0300 +++ b/src/lib-storage/index/mbox/mbox-sync.c Fri Oct 22 03:48:44 2004 +0300 @@ -589,6 +589,9 @@ sync_ctx->expunged_space; mail.space = sync_ctx->expunged_space; + sync_ctx->space_diff = sync_ctx->expunged_space; + sync_ctx->expunged_space = 0; + sync_ctx->need_space_seq--; buffer_append(sync_ctx->mails, &mail, sizeof(mail)); } @@ -606,8 +609,14 @@ buffer_append(sync_ctx->mails, &mail_ctx->mail, sizeof(mail_ctx->mail)); sync_ctx->space_diff += mail_ctx->mail.space; - if (sync_ctx->space_diff < 0) + if (sync_ctx->space_diff < 0) { + if (sync_ctx->expunged_space > 0) { + i_assert(sync_ctx->expunged_space == + mail_ctx->mail.space); + sync_ctx->expunged_space = 0; + } return 0; + } /* we have enough space now */ if (mail_ctx->mail.uid == 0) {