[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-mail.c, 1.17,
1.18 mbox-storage.c, 1.101, 1.102 mbox-transaction.c, 1.8, 1.9
cras at dovecot.org
cras at dovecot.org
Sun Oct 10 20:44:56 EEST 2004
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv12240/lib-storage/index/mbox
Modified Files:
mbox-mail.c mbox-storage.c mbox-transaction.c
Log Message:
Don't lock/unlock mbox separately for each message. Drop the lock only at
the end of the transaction.
Index: mbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- mbox-mail.c 28 Aug 2004 16:39:54 -0000 1.17
+++ mbox-mail.c 10 Oct 2004 17:44:54 -0000 1.18
@@ -16,6 +16,8 @@
static int mbox_mail_seek(struct index_mail *mail)
{
+ struct mbox_transaction_context *t =
+ (struct mbox_transaction_context *)mail->trans;
struct index_mailbox *ibox = mail->ibox;
enum mbox_sync_flags sync_flags = 0;
int ret, deleted;
@@ -30,7 +32,7 @@
return -1;
i_assert(ibox->mbox_lock_type != F_UNLCK);
- ibox->mbox_mail_lock_id = ibox->mbox_lock_id;
+ t->mbox_lock_id = ibox->mbox_lock_id;
}
if (mbox_file_open_stream(ibox) < 0)
@@ -49,8 +51,8 @@
if (ret == 0) {
/* we'll need to re-sync it completely */
if (ibox->mbox_lock_type == F_RDLCK) {
- if (ibox->mbox_mail_lock_id == ibox->mbox_lock_id)
- ibox->mbox_mail_lock_id = 0;
+ if (ibox->mbox_lock_id == t->mbox_lock_id)
+ t->mbox_lock_id = 0;
(void)mbox_unlock(mail->ibox, ibox->mbox_lock_id);
ibox->mbox_lock_id = 0;
i_assert(ibox->mbox_lock_type == F_UNLCK);
Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -d -r1.101 -r1.102
--- mbox-storage.c 3 Oct 2004 16:32:59 -0000 1.101
+++ mbox-storage.c 10 Oct 2004 17:44:54 -0000 1.102
@@ -365,14 +365,6 @@
return t_strconcat(storage->dir, "/", name, NULL);
}
-static void mbox_mail_deinit(struct index_mail *mail)
-{
- if (mail->ibox->mbox_mail_lock_id != 0) {
- (void)mbox_unlock(mail->ibox, mail->ibox->mbox_mail_lock_id);
- mail->ibox->mbox_mail_lock_id = 0;
- }
-}
-
static int mbox_mail_is_recent(struct index_mailbox *ibox __attr_unused__,
uint32_t uid __attr_unused__)
{
@@ -416,7 +408,6 @@
ibox->mbox_lock_type = F_UNLCK;
ibox->mbox_ext_idx = mbox_ext_idx;
- ibox->mail_deinit = mbox_mail_deinit;
ibox->is_recent = mbox_mail_is_recent;
ibox->mail_interface = &mbox_mail;
ibox->mbox_do_dirty_syncs = getenv("MBOX_DIRTY_SYNCS") != NULL;
Index: mbox-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-transaction.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mbox-transaction.c 24 Sep 2004 11:47:30 -0000 1.8
+++ mbox-transaction.c 10 Oct 2004 17:44:54 -0000 1.9
@@ -37,6 +37,12 @@
}
t = NULL;
+ if (lock_id != 0 && ibox->mbox_lock_type != F_WRLCK) {
+ /* unlock before writing any changes */
+ (void)mbox_unlock(ibox, lock_id);
+ lock_id = 0;
+ }
+
if (ret == 0) {
enum mbox_sync_flags mbox_sync_flags = MBOX_SYNC_LAST_COMMIT;
if ((flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0)
More information about the dovecot-cvs
mailing list