From: Timo Sirainen Date: Thu, 29 May 2003 14:15:57 +0000 (+0300) Subject: flag updates and expunge now set the cur/ dirty-synced to avoid extra sync X-Git-Tag: 1.1.alpha1~4594 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=819cb2d6994edf2fe2dc927c5fa9712ebe364600;p=thirdparty%2Fdovecot%2Fcore.git flag updates and expunge now set the cur/ dirty-synced to avoid extra sync after them. --HG-- branch : HEAD --- diff --git a/src/lib-index/maildir/maildir-expunge.c b/src/lib-index/maildir/maildir-expunge.c index cdc2cad3f3..6cdb37115b 100644 --- a/src/lib-index/maildir/maildir-expunge.c +++ b/src/lib-index/maildir/maildir-expunge.c @@ -1,6 +1,7 @@ /* Copyright (C) 2002 Timo Sirainen */ #include "lib.h" +#include "ioloop.h" #include "maildir-index.h" #include "mail-index-util.h" @@ -54,7 +55,7 @@ int maildir_expunge_mail(struct mail_index *index, for (i = 0;; i++) { ret = maildir_expunge_mail_file(index, rec, &fname); if (ret > 0) - return TRUE; + break; if (ret < 0) return FALSE; @@ -72,4 +73,9 @@ int maildir_expunge_mail(struct mail_index *index, return TRUE; } } + + /* cur/ was updated, set it dirty-synced */ + index->maildir_cur_dirty = ioloop_time; + index->file_sync_stamp = ioloop_time; + return TRUE; } diff --git a/src/lib-index/maildir/maildir-update-flags.c b/src/lib-index/maildir/maildir-update-flags.c index ea91868228..5893a6579c 100644 --- a/src/lib-index/maildir/maildir-update-flags.c +++ b/src/lib-index/maildir/maildir-update-flags.c @@ -1,6 +1,7 @@ /* Copyright (C) 2002 Timo Sirainen */ #include "lib.h" +#include "ioloop.h" #include "maildir-index.h" #include "mail-index-util.h" @@ -83,11 +84,21 @@ static int maildir_rename_mail(struct mail_index *index, if (ret == -1) return FALSE; - if (ret == 1 && index->maildir_keep_new) { - /* looks like we have some more space again, - see if we could move mails from new/ to - cur/ again */ - index->maildir_keep_new = FALSE; + if (ret == 1) { + if (index->maildir_keep_new && + (rec->index_flags & + INDEX_MAIL_FLAG_MAILDIR_NEW) != 0) { + /* looks like we have some more space + again, see if we could move mails + from new/ to cur/ again */ + index->maildir_keep_new = FALSE; + rec->index_flags &= + ~INDEX_MAIL_FLAG_MAILDIR_NEW; + } + + /* cur/ was updated, set it dirty-synced */ + index->file_sync_stamp = ioloop_time; + index->maildir_cur_dirty = ioloop_time; } }