[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-mail.c, 1.16, 1.17 dbox-storage.h, 1.22, 1.23 dbox-sync.c, 1.27, 1.28

tss at dovecot.org tss at dovecot.org
Tue Apr 17 18:09:19 EEST 2007


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

Modified Files:
	dbox-mail.c dbox-storage.h dbox-sync.c 
Log Message:
Call sync_notify() once at the end of syncing. Allow accessing mails even
while syncing, as long as it's safe to do so.



Index: dbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-mail.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- dbox-mail.c	30 Mar 2007 12:44:03 -0000	1.16
+++ dbox-mail.c	17 Apr 2007 15:09:12 -0000	1.17
@@ -114,7 +114,7 @@
 	uoff_t prev_offset = 0;
 	int i, ret;
 
-	if (mail->mail.mail.expunged)
+	if (mail->mail.mail.expunged || mbox->syncing)
 		return 0;
 
 	for (i = 0; i < 3; i++) {

Index: dbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- dbox-storage.h	30 Mar 2007 19:08:12 -0000	1.22
+++ dbox-storage.h	17 Apr 2007 15:09:12 -0000	1.23
@@ -69,6 +69,8 @@
 
 	uoff_t rotate_size, rotate_min_size;
 	unsigned int rotate_days;
+
+	unsigned int syncing:1;
 };
 
 struct dbox_transaction_context {

Index: dbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- dbox-sync.c	17 Apr 2007 12:41:28 -0000	1.27
+++ dbox-sync.c	17 Apr 2007 15:09:13 -0000	1.28
@@ -436,6 +436,7 @@
 
 static int dbox_sync_index(struct dbox_sync_context *ctx)
 {
+	struct mailbox *box = &ctx->mbox->ibox.box;
 	struct mail_index_sync_rec sync_rec;
         struct hash_iterate_context *iter;
 	void *key, *value;
@@ -470,6 +471,9 @@
 	}
 	hash_iterate_deinit(iter);
 
+	if (box->v.sync_notify != NULL)
+		box->v.sync_notify(box, 0, 0);
+
 	hash_destroy(ctx->syncs);
 	pool_unref(ctx->pool);
 
@@ -577,7 +581,7 @@
 	return 0;
 }
 
-int dbox_sync(struct dbox_mailbox *mbox, bool force)
+static int dbox_sync_int(struct dbox_mailbox *mbox, bool force)
 {
 	struct dbox_sync_context ctx;
 	int ret;
@@ -609,6 +613,16 @@
 	}
 }
 
+int dbox_sync(struct dbox_mailbox *mbox, bool force)
+{
+	int ret;
+
+	mbox->syncing = TRUE;
+	ret = dbox_sync_int(mbox, force);
+	mbox->syncing = FALSE;
+	return ret;
+}
+
 struct mailbox_sync_context *
 dbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 {



More information about the dovecot-cvs mailing list