dovecot: When updating dovecot.index file, write the header always.
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 20 01:56:46 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/f61313136530
changeset: 5780:f61313136530
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 19 18:37:27 2007 +0300
description:
When updating dovecot.index file, write the header always.
map->write_base_header now tells only if the file needs to be updated at all
if nothing else has changed.
diffstat:
2 files changed, 6 insertions(+), 8 deletions(-)
src/lib-index/mail-index-sync-update.c | 2 --
src/lib-index/mail-index-write.c | 12 ++++++------
diffs (41 lines):
diff -r b25c9ca2142b -r f61313136530 src/lib-index/mail-index-sync-update.c
--- a/src/lib-index/mail-index-sync-update.c Tue Jun 19 16:33:05 2007 +0300
+++ b/src/lib-index/mail-index-sync-update.c Tue Jun 19 18:37:27 2007 +0300
@@ -332,7 +332,6 @@ static int sync_append(const struct mail
mail_index_sync_write_seq_update(ctx, map->hdr.messages_count,
map->hdr.messages_count);
- map->write_base_header = TRUE;
if ((rec->flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0)
map->hdr.flags |= MAIL_INDEX_HDR_FLAG_HAVE_DIRTY;
@@ -360,7 +359,6 @@ static int sync_flag_update(const struct
mail_index_sync_move_to_private(ctx);
mail_index_sync_write_seq_update(ctx, seq1, seq2);
- view->map->write_base_header = TRUE;
hdr = &view->map->hdr;
if ((u->add_flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0)
diff -r b25c9ca2142b -r f61313136530 src/lib-index/mail-index-write.c
--- a/src/lib-index/mail-index-write.c Tue Jun 19 16:33:05 2007 +0300
+++ b/src/lib-index/mail-index-write.c Tue Jun 19 18:37:27 2007 +0300
@@ -82,12 +82,12 @@ static int mail_index_write_map_over(str
return -1;
}
- /* write base header */
- if (map->write_base_header) {
- base_size = I_MIN(map->hdr.base_header_size, sizeof(map->hdr));
- if (pwrite_full(index->fd, &map->hdr, base_size, 0) < 0)
- return -1;
- }
+ /* write base header. it has changed practically always, so
+ map->write_base_header might not be TRUE here in all situations.
+ It's used only to figure out if we want to write the map at all. */
+ base_size = I_MIN(map->hdr.base_header_size, sizeof(map->hdr));
+ if (pwrite_full(index->fd, &map->hdr, base_size, 0) < 0)
+ return -1;
/* write extended headers */
if (map->write_ext_header) {
More information about the dovecot-cvs
mailing list