[dovecot-cvs] dovecot/src/lib-index mail-index.c, 1.230.2.21, 1.230.2.22

tss at dovecot.org tss at dovecot.org
Sat Mar 10 21:22:55 EET 2007


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv6530

Modified Files:
      Tag: branch_1_0
	mail-index.c 
Log Message:
mmap_disable=yes crashes with recent changes.



Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.230.2.21
retrieving revision 1.230.2.22
diff -u -d -r1.230.2.21 -r1.230.2.22
--- mail-index.c	8 Mar 2007 20:02:33 -0000	1.230.2.21
+++ mail-index.c	10 Mar 2007 19:22:53 -0000	1.230.2.22
@@ -9,6 +9,7 @@
 #include "read-full.h"
 #include "write-full.h"
 #include "mail-index-private.h"
+#include "mail-index-view-private.h"
 #include "mail-index-sync-private.h"
 #include "mail-transaction-log.h"
 #include "mail-cache.h"
@@ -877,7 +878,6 @@
 {
 	const struct mail_index_header *map_hdr = &(*map)->hdr;
 	struct mail_index_view *view;
-	struct mail_transaction_log_view *log_view;
 	struct mail_index_sync_map_ctx sync_map_ctx;
 	struct mail_index_header hdr;
 	const struct mail_transaction_header *thdr;
@@ -925,29 +925,29 @@
 		max_offset = (uoff_t)-1;
 	}
 
-	log_view = mail_transaction_log_view_open(index->log);
-	if (mail_transaction_log_view_set(log_view,
+	index->map = *map;
+
+	view = mail_index_view_open(index);
+	if (mail_transaction_log_view_set(view->log_view,
 					  map_hdr->log_file_seq,
 					  map_hdr->log_file_int_offset,
 					  max_seq, max_offset,
 					  MAIL_TRANSACTION_TYPE_MASK) <= 0) {
 		/* can't use it. sync by re-reading index. */
-		mail_transaction_log_view_close(&log_view);
+		mail_index_view_close(&view);
 		return 0;
 	}
 
-	index->map = *map;
-
-	view = mail_index_view_open(index);
 	mail_index_sync_map_init(&sync_map_ctx, view,
 				 MAIL_INDEX_SYNC_HANDLER_HEAD);
 
 	check_ext_offsets = TRUE; broken = FALSE;
-	while ((ret = mail_transaction_log_view_next(log_view, &thdr, &tdata,
-						     &skipped)) > 0) {
+	while ((ret = mail_transaction_log_view_next(view->log_view, &thdr,
+						     &tdata, &skipped)) > 0) {
 		if ((thdr->type & MAIL_TRANSACTION_EXTERNAL) != 0 &&
 		    check_ext_offsets) {
-			if (mail_index_is_ext_synced(log_view, index->map))
+			if (mail_index_is_ext_synced(view->log_view,
+						     index->map))
 				continue;
 			check_ext_offsets = FALSE;
 		}
@@ -961,7 +961,7 @@
 	if (ret == 0 && !broken)
 		ret = 1;
 
-	mail_transaction_log_view_get_prev_pos(log_view, &prev_seq,
+	mail_transaction_log_view_get_prev_pos(view->log_view, &prev_seq,
 					       &prev_offset);
 	i_assert(prev_seq <= max_seq &&
 		 (prev_seq != max_seq || prev_offset <= max_offset));
@@ -972,7 +972,6 @@
 
 	mail_index_sync_map_deinit(&sync_map_ctx);
 	mail_index_view_close(&view);
-	mail_transaction_log_view_close(&log_view);
 
 	*map = index->map;
 	index->map = NULL;



More information about the dovecot-cvs mailing list