[dovecot-cvs] dovecot/src/lib-index/mbox mbox-rewrite.c,1.59,1.60
mbox-sync.c,1.33,1.34
cras at procontrol.fi
cras at procontrol.fi
Mon Aug 11 05:56:39 EEST 2003
- Previous message: [dovecot-cvs]
dovecot/src/lib-index/maildir maildir-expunge.c,1.5,1.6
maildir-sync.c,1.60,1.61 maildir-update-flags.c,1.8,1.9
- Next message: [dovecot-cvs] dovecot/src/lib-index Makefile.am,1.14,1.15
mail-index-file.c,1.1,1.2 mail-index-open.c,1.43,1.44
mail-index.c,1.96,1.97 mail-index-compress.c,1.27,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/dovecot/src/lib-index/mbox
In directory danu:/tmp/cvs-serv9360/lib-index/mbox
Modified Files:
mbox-rewrite.c mbox-sync.c
Log Message:
Save sync stamp in index header rather than in file's mtime.
Index: mbox-rewrite.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-rewrite.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- mbox-rewrite.c 6 Aug 2003 20:15:32 -0000 1.59
+++ mbox-rewrite.c 11 Aug 2003 01:56:37 -0000 1.60
@@ -551,7 +551,7 @@
/* All ok. Just make sure the timestamps of index and
mbox differ, so index will be updated at next sync */
- index->file_sync_stamp = ioloop_time-61;
+ index->sync_stamp = 0;
if (o_stream_seek(output, 0) < 0) {
mbox_set_syscall_error(index, "o_stream_seek()");
Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mbox/mbox-sync.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mbox-sync.c 6 Aug 2003 20:15:32 -0000 1.33
+++ mbox-sync.c 11 Aug 2003 01:56:37 -0000 1.34
@@ -69,7 +69,6 @@
enum mail_lock_type data_lock_type, int *changes)
{
struct stat st;
- time_t index_mtime;
uoff_t filesize;
int count, fd;
@@ -90,15 +89,6 @@
i_assert(index->lock_type != MAIL_LOCK_SHARED);
- if (index->fd == -1) {
- /* anon-mmaped */
- index_mtime = index->file_sync_stamp;
- } else {
- if (fstat(index->fd, &st) < 0)
- return index_set_syscall_error(index, "fstat()");
- index_mtime = st.st_mtime;
- }
-
count = 0;
while (stat(index->mailbox_path, &st) < 0) {
if (errno != ENOENT || ++count == 3)
@@ -125,33 +115,28 @@
mbox_file_close_fd(index);
}
- if (index_mtime != st.st_mtime || index->mbox_size != filesize) {
- mbox_file_close_stream(index);
-
+ if (index->mbox_sync_counter == 0) {
+ /* first sync, get expected mbox size */
index->mbox_size = get_indexed_mbox_size(index);
- if (index->file_sync_stamp == 0 &&
- index->mbox_size == filesize) {
- /* just opened the mailbox, and the file size is same
- as we expected. don't bother checking it any
- further. */
- } else {
- if (changes != NULL)
- *changes = TRUE;
+ }
- if (!mbox_lock_and_sync_full(index, data_lock_type))
- return FALSE;
+ if (index->sync_stamp != st.st_mtime || index->mbox_size != filesize) {
+ mbox_file_close_stream(index);
- if ((index->set_flags &
- MAIL_INDEX_HDR_FLAG_REBUILD) != 0) {
- /* uidvalidity probably changed, rebuild */
- if (!index->rebuild(index))
- return FALSE;
- }
+ if (changes != NULL)
+ *changes = TRUE;
- index->mbox_size = filesize;
+ if (!mbox_lock_and_sync_full(index, data_lock_type))
+ return FALSE;
+
+ if ((index->set_flags & MAIL_INDEX_HDR_FLAG_REBUILD) != 0) {
+ /* uidvalidity probably changed, rebuild */
+ if (!index->rebuild(index))
+ return FALSE;
}
- index->file_sync_stamp = st.st_mtime;
+ index->mbox_size = filesize;
+ index->sync_stamp = st.st_mtime;
}
/* we need some index lock to be able to lock mbox */
- Previous message: [dovecot-cvs]
dovecot/src/lib-index/maildir maildir-expunge.c,1.5,1.6
maildir-sync.c,1.60,1.61 maildir-update-flags.c,1.8,1.9
- Next message: [dovecot-cvs] dovecot/src/lib-index Makefile.am,1.14,1.15
mail-index-file.c,1.1,1.2 mail-index-open.c,1.43,1.44
mail-index.c,1.96,1.97 mail-index-compress.c,1.27,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list