[dovecot-cvs] dovecot/src/lib-index mail-index-open.c,1.26,1.27 mail-index.h,1.70,1.71

cras at procontrol.fi cras at procontrol.fi
Thu Apr 10 00:10:03 EEST 2003


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv22327/lib-index

Modified Files:
	mail-index-open.c mail-index.h 
Log Message:
Rewritten maildir syncing. Uses dovecot-uidlist file to store UIDs
permanently.



Index: mail-index-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-open.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mail-index-open.c	6 Mar 2003 19:23:44 -0000	1.26
+++ mail-index-open.c	9 Apr 2003 20:10:01 -0000	1.27
@@ -64,6 +64,8 @@
 static int index_open_and_fix(struct mail_index *index,
 			      enum mail_index_open_flags flags)
 {
+	int rebuilt;
+
 	/* open/create the index files */
 	if ((flags & _MAIL_INDEX_OPEN_FLAG_CREATING) == 0) {
 		if (!mail_index_data_open(index)) {
@@ -97,6 +99,9 @@
 		/* no inconsistency problems since we're still opening
 		   the index */
 		index->inconsistent = FALSE;
+		rebuilt = TRUE;
+	} else {
+		rebuilt = FALSE;
 	}
 
 	if ((flags & _MAIL_INDEX_OPEN_FLAG_CREATING) == 0) {
@@ -122,11 +127,14 @@
 			return FALSE;
 	}
 
-	/* sync ourself. do it before updating cache and compression which
-	   may happen because of this. */
-	if (!index->sync_and_lock(index, MAIL_LOCK_SHARED, NULL))
-		return FALSE;
-	index->inconsistent = FALSE;
+	if (!rebuilt) {
+		/* sync ourself. do it before updating cache and compression
+		   which may happen because of this. */
+		if (!index->sync_and_lock(index, MAIL_LOCK_SHARED, NULL))
+			return FALSE;
+
+		index->inconsistent = FALSE;
+	}
 
 	/* we never want to keep shared lock if syncing happens to set it.
 	   either exclusive or nothing (NOTE: drop it directly, not through

Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- mail-index.h	6 Mar 2003 19:23:44 -0000	1.70
+++ mail-index.h	9 Apr 2003 20:10:01 -0000	1.71
@@ -393,6 +393,14 @@
 	dev_t mbox_dev;
 	ino_t mbox_ino;
 
+	/* last maildir sync: */
+	dev_t uidlist_dev;
+	ino_t uidlist_ino;
+	time_t uidlist_mtime;
+	off_t uidlist_size;
+
+	int maildir_lock_fd;
+
 	int fd; /* opened index file */
 	char *error; /* last error message */
 
@@ -416,6 +424,7 @@
 
 	unsigned int anon_mmap:1;
 	unsigned int opened:1;
+	unsigned int rebuilding:1;
 	unsigned int mail_read_mmaped:1;
 	unsigned int inconsistent:1;
 	unsigned int nodiskspace:1;
@@ -438,7 +447,8 @@
 	0, 0, 0, 0, 0, 0, { 0, 0, 0 }, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-	0, 0, 0, 0, 0
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+	0
 #endif
 
 /* defaults - same as above but prefixed with mail_index_. */




More information about the dovecot-cvs mailing list