dovecot-1.1: Small optimization: Don't try to pread() log file i...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 21 08:27:39 EET 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/6983dfc231d7
changeset: 7435:6983dfc231d7
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Mar 21 08:27:36 2008 +0200
description:
Small optimization: Don't try to pread() log file if we already know we've
read everything.

diffstat:

1 file changed, 3 insertions(+), 2 deletions(-)
src/lib-index/mail-transaction-log-file.c |    5 +++--

diffs (15 lines):

diff -r 4407b7265afd -r 6983dfc231d7 src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Thu Mar 20 16:55:44 2008 +0200
+++ b/src/lib-index/mail-transaction-log-file.c	Fri Mar 21 08:27:36 2008 +0200
@@ -1065,8 +1065,9 @@ mail_transaction_log_file_map_mmap(struc
 		return 0;
 	}
 
-	if ((uoff_t)st.st_size == file->mmap_size) {
-		/* we already have the whole file mmaped */
+	if (file->buffer != NULL &&
+	    (uoff_t)st.st_size == file->buffer_offset + file->buffer->used) {
+		/* we already have the whole file mapped */
 		if ((ret = mail_transaction_log_file_sync(file)) < 0)
 			return 0;
 		if (ret > 0)


More information about the dovecot-cvs mailing list