[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.82,1.83 mail-index.h,1.64,1.65 mail-modifylog.c,1.39,1.40
cras at procontrol.fi
cras at procontrol.fi
Wed Jan 22 21:52:19 EET 2003
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,1.19,1.20 maildir-save.c,1.15,1.16 maildir-storage.c,1.23,1.24 maildir-storage.h,1.11,1.12
- Next message: [dovecot-cvs] dovecot/src/imap imap-fetch-body-section.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv6886
Modified Files:
mail-index.c mail-index.h mail-modifylog.c
Log Message:
Modify log used to test if there were other users for every changed flag or
expunged message, causing two fcntl() syscalls every time -> SLOW. Now we
check it only once after exclusively locking the index.
Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- mail-index.c 11 Jan 2003 19:55:56 -0000 1.82
+++ mail-index.c 22 Jan 2003 19:52:17 -0000 1.83
@@ -391,6 +391,7 @@
/* while holding exclusive lock, keep the FSCK flag on.
when the lock is released, the FSCK flag will also be
removed. */
+ index->excl_lock_counter++;
index->header->flags |= MAIL_INDEX_FLAG_FSCK;
if (!mail_index_fmdatasync(index,
sizeof(struct mail_index_header))) {
@@ -421,6 +422,7 @@
}
if (index->lock_type == MAIL_LOCK_EXCLUSIVE) {
+ index->excl_lock_counter++;
if (index->modifylog != NULL)
mail_modifylog_notify_lock_drop(index->modifylog);
Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- mail-index.h 11 Jan 2003 19:55:56 -0000 1.64
+++ mail-index.h 22 Jan 2003 19:52:17 -0000 1.65
@@ -362,6 +362,9 @@
unsigned int indexid;
unsigned int sync_id;
+ /* updated whenever exclusive lock is set/unset */
+ unsigned int excl_lock_counter;
+
int mbox_fd;
struct istream *mbox_stream;
enum mail_lock_type mbox_lock_type;
@@ -421,7 +424,7 @@
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
- 0
+ 0, 0
#endif
/* defaults - same as above but prefixed with mail_index_. */
Index: mail-modifylog.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-modifylog.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- mail-modifylog.c 9 Jan 2003 12:35:16 -0000 1.39
+++ mail-modifylog.c 22 Jan 2003 19:52:17 -0000 1.40
@@ -60,6 +60,9 @@
struct modify_log_file file1, file2;
struct modify_log_file *head, *tail;
+
+ int cache_have_others;
+ unsigned int cache_lock_counter;
};
static const struct modify_log_expunge no_expunges = { 0, 0, 0 };
@@ -707,16 +710,32 @@
i_assert((*rec)->seq1 != 0);
i_assert((*rec)->uid1 != 0);
- if (!external_change) {
+ if (!external_change &&
+ file->log->cache_lock_counter !=
+ file->log->index->excl_lock_counter) {
switch (modifylog_have_other_users(file->log, FALSE)) {
case 0:
/* we're the only one having this log open,
no need for modify log. */
+ file->log->cache_have_others = FALSE;
+ file->log->cache_lock_counter =
+ file->log->index->excl_lock_counter;
+
*rec = NULL;
return TRUE;
case -1:
return FALSE;
+ default:
+ file->log->cache_have_others = TRUE;
+ file->log->cache_lock_counter =
+ file->log->index->excl_lock_counter;
+ break;
}
+ }
+
+ if (!file->log->cache_have_others) {
+ *rec = NULL;
+ return FALSE;
}
if (file->mmap_used_length == file->mmap_full_length) {
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,1.19,1.20 maildir-save.c,1.15,1.16 maildir-storage.c,1.23,1.24 maildir-storage.h,1.11,1.12
- Next message: [dovecot-cvs] dovecot/src/imap imap-fetch-body-section.c,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list