[dovecot-cvs] dovecot/src/lib-index mail-cache.c, 1.95, 1.96 mail-index-private.h, 1.83, 1.84 mail-index.c, 1.273, 1.274 mail-index.h, 1.167, 1.168 mail-transaction-log.c, 1.130, 1.131

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


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

Modified Files:
	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.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- mail-cache.c	15 Mar 2007 01:50:35 -0000	1.95
+++ mail-cache.c	16 May 2007 15:25:29 -0000	1.96
@@ -327,7 +327,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.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- mail-index-private.h	29 Mar 2007 14:19:47 -0000	1.83
+++ mail-index-private.h	16 May 2007 15:25:29 -0000	1.84
@@ -191,7 +191,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.273
retrieving revision 1.274
diff -u -d -r1.273 -r1.274
--- mail-index.c	13 May 2007 16:53:41 -0000	1.273
+++ mail-index.c	16 May 2007 15:25:29 -0000	1.274
@@ -1650,8 +1650,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->use_excl_dotlocks =
 			(flags & MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL) != 0;
 		index->fsync_disable =

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- mail-index.h	13 May 2007 16:53:41 -0000	1.167
+++ mail-index.h	16 May 2007 15:25:29 -0000	1.168
@@ -16,10 +16,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.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- mail-transaction-log.c	16 Mar 2007 16:02:26 -0000	1.130
+++ mail-transaction-log.c	16 May 2007 15:25:29 -0000	1.131
@@ -1246,7 +1246,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);
 
@@ -1265,11 +1265,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);
@@ -1277,7 +1272,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()");
@@ -1305,7 +1300,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;
 	}
@@ -1317,7 +1312,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