From: Timo Sirainen Date: Fri, 21 Mar 2008 06:27:36 +0000 (+0200) Subject: Small optimization: Don't try to pread() log file if we already know we've X-Git-Tag: 1.1.rc4~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c026384095b555cc86d032b043d107cc371aacec;p=thirdparty%2Fdovecot%2Fcore.git Small optimization: Don't try to pread() log file if we already know we've read everything. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 23d40b06bc..eb88fcb7c6 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -1065,8 +1065,9 @@ mail_transaction_log_file_map_mmap(struct mail_transaction_log_file *file, 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)