[dovecot-cvs] dovecot/src/lib-index mail-cache.c,1.2,1.3
mail-index-open.c,1.42,1.43 mail-index.c,1.95,1.96
mail-index.h,1.87,1.88
cras at procontrol.fi
cras at procontrol.fi
Mon Aug 11 05:56:39 EEST 2003
Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv9360/lib-index
Modified Files:
mail-cache.c mail-index-open.c mail-index.c mail-index.h
Log Message:
Save sync stamp in index header rather than in file's mtime.
Index: mail-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mail-cache.c 11 Aug 2003 01:26:46 -0000 1.2
+++ mail-cache.c 11 Aug 2003 01:56:37 -0000 1.3
@@ -360,7 +360,7 @@
{
struct mail_index_record *rec;
- index->file_sync_stamp = ioloop_time-61;
+ index->sync_stamp = 0;
rec = index->lookup(index, 1);
while (rec != NULL) {
Index: mail-index-open.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-open.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- mail-index-open.c 11 Aug 2003 01:27:50 -0000 1.42
+++ mail-index-open.c 11 Aug 2003 01:56:37 -0000 1.43
@@ -30,7 +30,7 @@
(hdr->flags & MAIL_INDEX_FLAG_MAILDIR_NEW) != 0;
if ((hdr->flags & MAIL_INDEX_HDR_FLAG_DIRTY_MESSAGES) != 0)
- index->next_dirty_flush = ioloop_time;
+ index->next_dirty_flags_flush = ioloop_time;
/* update \Recent message counters */
if ((flags & MAIL_INDEX_OPEN_FLAG_UPDATE_RECENT) != 0 &&
Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- mail-index.c 10 Aug 2003 23:56:22 -0000 1.95
+++ mail-index.c 11 Aug 2003 01:56:37 -0000 1.96
@@ -13,7 +13,6 @@
#include <unistd.h>
#include <fcntl.h>
-#include <utime.h>
static int mmap_verify(struct mail_index *index)
{
@@ -76,6 +75,7 @@
}
index->sync_id = hdr->sync_id;
+ index->sync_stamp = hdr->sync_stamp;
index->mmap_used_length = hdr->used_file_size;
return TRUE;
}
@@ -225,17 +225,6 @@
return !failed;
}
-static void mail_index_update_timestamp(struct mail_index *index)
-{
- struct utimbuf ut;
-
- /* keep index's modify stamp same as the sync file's stamp */
- ut.actime = ioloop_time;
- ut.modtime = index->file_sync_stamp;
- if (utime(index->filepath, &ut) < 0)
- index_set_syscall_error(index, "utime()");
-}
-
int mail_index_fmdatasync(struct mail_index *index, size_t size)
{
i_assert(index->lock_type == MAIL_LOCK_EXCLUSIVE);
@@ -451,6 +440,9 @@
keep_fsck = (index->set_flags & MAIL_INDEX_HDR_FLAG_FSCK) != 0;
mail_index_update_header_changes(index);
+ if (index->sync_dirty_stamp == 0)
+ index->header->sync_stamp = index->sync_stamp;
+
/* remove the FSCK flag only after successful fsync() */
if (mail_index_sync_file(index) && !keep_fsck) {
index->header->flags &= ~MAIL_INDEX_HDR_FLAG_FSCK;
@@ -462,8 +454,6 @@
index_set_syscall_error(index, "msync()");
}
}
-
- mail_index_update_timestamp(index);
}
if (lock_type == MAIL_LOCK_UNLOCK)
Index: mail-index.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -d -r1.87 -r1.88
--- mail-index.h 11 Aug 2003 01:26:46 -0000 1.87
+++ mail-index.h 11 Aug 2003 01:56:37 -0000 1.88
@@ -124,6 +124,8 @@
/* these UIDs may not exist and may not even be unseen */
uint32_t first_unseen_uid_lowwater;
uint32_t first_deleted_uid_lowwater;
+
+ uint32_t sync_stamp;
};
struct mail_index_record {
@@ -293,7 +295,6 @@
/* last maildir sync: */
time_t last_new_mtime, last_uidlist_mtime;
- time_t maildir_cur_dirty, next_dirty_flush;
int maildir_lock_fd;
pool_t new_filename_pool;
struct hash_table *new_filenames;
@@ -309,7 +310,8 @@
size_t header_size;
enum mail_lock_type lock_type;
- time_t file_sync_stamp;
+ time_t sync_stamp, sync_dirty_stamp;
+ time_t next_dirty_flags_flush;
unsigned int first_recent_uid;
mail_lock_notify_callback_t *lock_notify_cb;
More information about the dovecot-cvs
mailing list