changeset 7435:6983dfc231d7 HEAD

Small optimization: Don't try to pread() log file if we already know we've read everything.
author Timo Sirainen <tss@iki.fi>
date Fri, 21 Mar 2008 08:27:36 +0200
parents 4407b7265afd
children cdb007c1923d
files src/lib-index/mail-transaction-log-file.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 		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)