[dovecot-cvs] dovecot/src/lib-index mail-cache.c, 1.80.2.9, 1.80.2.10 mail-index-private.h, 1.69.2.7, 1.69.2.8 mail-index.c, 1.230.2.29, 1.230.2.30 mail-index.h, 1.158.2.5, 1.158.2.6 mail-transaction-log.c, 1.111.2.18, 1.111.2.19

tss at dovecot.org tss at dovecot.org
Wed May 16 18:14:16 EEST 2007


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

Modified Files:
      Tag: branch_1_0
	mail-cache.c mail-index-private.h mail-index.c mail-index.h 
	mail-transaction-log.c 
Log Message:
Removed mmap_no_write setting. The only OS requiring it is OpenBSD, so we're
now forcing mmap_disable=yes with it instead. dovecot.index.cache file is
the most important file to mmap(), but since this didn't work with
mmap_no_write, there's not much point in keeping special code paths for
minimal gains.



Index: mail-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.80.2.9
retrieving revision 1.80.2.10
diff -u -d -r1.80.2.9 -r1.80.2.10
--- mail-cache.c	15 Mar 2007 01:50:32 -0000	1.80.2.9
+++ mail-cache.c	16 May 2007 15:14:13 -0000	1.80.2.10
@@ -321,7 +321,7 @@
 	cache->dotlock_settings.stale_timeout = MAIL_CACHE_LOCK_CHANGE_TIMEOUT;
 
 	if (!MAIL_INDEX_IS_IN_MEMORY(index)) {
-		if (index->mmap_disable || index->mmap_no_write)
+		if (index->mmap_disable)
 			cache->file_cache = file_cache_new(-1);
 	}
 

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.69.2.7
retrieving revision 1.69.2.8
diff -u -d -r1.69.2.7 -r1.69.2.8
--- mail-index-private.h	24 Mar 2007 21:20:04 -0000	1.69.2.7
+++ mail-index-private.h	16 May 2007 15:14:13 -0000	1.69.2.8
@@ -175,7 +175,6 @@
 	unsigned int log_locked:1;
 	unsigned int mmap_disable:1;
 	unsigned int fsync_disable:1;
-	unsigned int mmap_no_write:1;
 	unsigned int use_excl_dotlocks:1;
 	unsigned int readonly:1;
 	unsigned int fsck:1;

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.230.2.29
retrieving revision 1.230.2.30
diff -u -d -r1.230.2.29 -r1.230.2.30
--- mail-index.c	26 Mar 2007 16:42:06 -0000	1.230.2.29
+++ mail-index.c	16 May 2007 15:14:13 -0000	1.230.2.30
@@ -1645,8 +1645,6 @@
 		index->log_locked = FALSE;
 		index->mmap_disable =
 			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE) != 0;
-		index->mmap_no_write =
-			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE) != 0;
 		index->fsync_disable =
 			(flags & MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE) != 0;
 		index->use_excl_dotlocks =

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.158.2.5
retrieving revision 1.158.2.6
diff -u -d -r1.158.2.5 -r1.158.2.6
--- mail-index.h	10 Mar 2007 20:58:41 -0000	1.158.2.5
+++ mail-index.h	16 May 2007 15:14:13 -0000	1.158.2.6
@@ -13,10 +13,6 @@
 	MAIL_INDEX_OPEN_FLAG_CREATE		= 0x01,
 	/* Don't try to mmap() index files */
 	MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE	= 0x04,
-	/* Don't try to write() to mmap()ed index files. Required for the few
-	   OSes that don't have unified buffer cache
-	   (currently OpenBSD <= 3.5) */
-	MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE	= 0x08,
 	/* Rely on O_EXCL when creating dotlocks */
 	MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL	= 0x10,
 	/* Don't fsync() or fdatasync() */

Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.111.2.18
retrieving revision 1.111.2.19
diff -u -d -r1.111.2.18 -r1.111.2.19
--- mail-transaction-log.c	16 Mar 2007 16:02:22 -0000	1.111.2.18
+++ mail-transaction-log.c	16 May 2007 15:14:13 -0000	1.111.2.19
@@ -1252,7 +1252,7 @@
 	struct mail_index *index = file->log->index;
 	size_t size;
 	struct stat st;
-	int ret, use_mmap;
+	int ret;
 
 	i_assert(start_offset <= end_offset);
 
@@ -1271,11 +1271,6 @@
 	if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file))
 		return 1;
 
-	/* with mmap_no_write we could alternatively just write to log with
-	   msync() rather than pwrite(). but since there aren't many such OSes
-	   left, it's easier to just use mmap_disable behavior with it */
-	use_mmap = !index->mmap_disable && !index->mmap_no_write;
-
 	if (file->buffer != NULL && file->buffer_offset <= start_offset) {
 		/* see if we already have it */
 		size = buffer_get_used_size(file->buffer);
@@ -1283,7 +1278,7 @@
 			return 1;
 	}
 
-	if (use_mmap) {
+	if (!index->mmap_disable) {
 		if (fstat(file->fd, &st) < 0) {
 			mail_index_file_set_syscall_error(index, file->filepath,
 							  "fstat()");
@@ -1311,7 +1306,7 @@
 	}
 
 	if (file->buffer != NULL &&
-	    (file->mmap_base != NULL || use_mmap)) {
+	    (file->mmap_base != NULL || !index->mmap_disable)) {
 		buffer_free(file->buffer);
 		file->buffer = NULL;
 	}
@@ -1323,7 +1318,7 @@
 		file->mmap_base = NULL;
 	}
 
-	if (!use_mmap) {
+	if (index->mmap_disable) {
 		ret = mail_transaction_log_file_read(file, start_offset);
 		if (ret <= 0) {
 			/* make sure we don't leave ourself in



More information about the dovecot-cvs mailing list