[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-rewrite.c, 1.37, 1.38 mbox-sync.c, 1.108, 1.109

cras at dovecot.org cras at dovecot.org
Fri Oct 22 03:48:46 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv9121/lib-storage/index/mbox

Modified Files:
	mbox-sync-rewrite.c mbox-sync.c 
Log Message:
More expunge/rewrite fixes.



Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- mbox-sync-rewrite.c	21 Oct 2004 20:33:44 -0000	1.37
+++ mbox-sync-rewrite.c	22 Oct 2004 00:48:44 -0000	1.38
@@ -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;
-			}
 
-			mails[idx].offset += move_diff;
-			if (mbox_fill_space(sync_ctx, mails[idx].offset,
-					    padding_per_mail) < 0) {
-				ret = -1;
-				break;
+				if (mbox_fill_space(sync_ctx, move_diff +
+						    mails[idx].offset,
+						    padding_per_mail) < 0) {
+					ret = -1;
+					break;
+				}
 			}
+			mails[idx].offset += move_diff;
 		}
 
-		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;

Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- mbox-sync.c	21 Oct 2004 20:33:44 -0000	1.108
+++ mbox-sync.c	22 Oct 2004 00:48:44 -0000	1.109
@@ -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) {



More information about the dovecot-cvs mailing list