[dovecot-cvs] dovecot/src/lib-index/maildir maildir-open.c,1.10,1.11 maildir-update.c,1.12,1.13

cras at procontrol.fi cras at procontrol.fi
Thu Nov 21 22:31:05 EET 2002


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

Modified Files:
	maildir-open.c maildir-update.c 
Log Message:
mail_read_mmaped: Use mmap() instead of read() to read mail files. read()
seems to be a bit faster with my Linux/x86 and it's better with NFS, so
that's the default.



Index: maildir-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/maildir/maildir-open.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- maildir-open.c	27 Oct 2002 06:37:18 -0000	1.10
+++ maildir-open.c	21 Nov 2002 20:31:03 -0000	1.11
@@ -53,6 +53,11 @@
 		}
 	}
 
-	return i_buffer_create_mmap(fd, default_pool, MAIL_MMAP_BLOCK_SIZE,
-				    0, 0, TRUE);
+	if (index->mail_read_mmaped) {
+		return i_buffer_create_mmap(fd, default_pool,
+					    MAIL_MMAP_BLOCK_SIZE, 0, 0, TRUE);
+	} else {
+		return i_buffer_create_file(fd, default_pool,
+					    MAIL_READ_BLOCK_SIZE, TRUE);
+	}
 }

Index: maildir-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/maildir/maildir-update.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- maildir-update.c	27 Oct 2002 06:37:18 -0000	1.12
+++ maildir-update.c	21 Nov 2002 20:31:03 -0000	1.13
@@ -16,8 +16,13 @@
 		return TRUE;
 
 	t_push();
-	inbuf = i_buffer_create_mmap(fd, data_stack_pool, MAIL_MMAP_BLOCK_SIZE,
-				     0, 0, FALSE);
+	if (index->mail_read_mmaped) {
+		inbuf = i_buffer_create_mmap(fd, data_stack_pool,
+					     MAIL_MMAP_BLOCK_SIZE, 0, 0, FALSE);
+	} else {
+		inbuf = i_buffer_create_file(fd, data_stack_pool,
+					     MAIL_READ_BLOCK_SIZE, FALSE);
+	}
 	mail_index_update_headers(update, inbuf, cache_fields, NULL, NULL);
 	i_buffer_unref(inbuf);
 	t_pop();




More information about the dovecot-cvs mailing list