]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Small optimization: Don't try to pread() log file if we already know we've
authorTimo Sirainen <tss@iki.fi>
Fri, 21 Mar 2008 06:27:36 +0000 (08:27 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 21 Mar 2008 06:27:36 +0000 (08:27 +0200)
read everything.

--HG--
branch : HEAD

src/lib-index/mail-transaction-log-file.c

index 23d40b06bc0cd7c672e34004392e489c837754a2..eb88fcb7c62127b4043189f12f5cb7a1ae974a5c 100644 (file)
@@ -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)