[dovecot-cvs] dovecot/src/lib-index mail-cache.c, 1.91, 1.92 mail-hash.c, 1.31, 1.32 mail-index-private.h, 1.78, 1.79 mail-index.c, 1.250, 1.251 mail-index.h, 1.164, 1.165 mail-transaction-log.c, 1.116, 1.117 mailbox-list-index-private.h, 1.3, 1.4 mailbox-list-index.c, 1.3, 1.4

tss at dovecot.org tss at dovecot.org
Thu Dec 28 16:28:33 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv32328/src/lib-index

Modified Files:
	mail-cache.c mail-hash.c mail-index-private.h mail-index.c 
	mail-index.h mail-transaction-log.c 
	mailbox-list-index-private.h mailbox-list-index.c 
Log Message:
Added dotlock_use_excl setting.


Index: mail-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- mail-cache.c	20 Dec 2006 06:20:26 -0000	1.91
+++ mail-cache.c	28 Dec 2006 16:28:28 -0000	1.92
@@ -304,6 +304,7 @@
 		hash_create(default_pool, cache->field_pool, 0,
 			    strcase_hash, (hash_cmp_callback_t *)strcasecmp);
 
+	cache->dotlock_settings.use_excl_lock = index->use_excl_dotlocks;
 	cache->dotlock_settings.timeout = MAIL_CACHE_LOCK_TIMEOUT;
 	cache->dotlock_settings.stale_timeout = MAIL_CACHE_LOCK_CHANGE_TIMEOUT;
 

Index: mail-hash.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-hash.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- mail-hash.c	20 Dec 2006 15:17:32 -0000	1.31
+++ mail-hash.c	28 Dec 2006 16:28:29 -0000	1.32
@@ -53,6 +53,7 @@
 	int lock_type;
 	struct file_lock *file_lock;
 	struct dotlock *dotlock;
+	struct dotlock_settings dotlock_settings;
 
 	struct mail_hash_header *hdr;
 
@@ -71,7 +72,7 @@
 #define HASH_RECORD_IDX(hash, idx) \
 	PTR_OFFSET((hash)->records_base, ((idx) - 1) * (hash)->record_size)
 
-const struct dotlock_settings dotlock_settings = {
+const struct dotlock_settings default_dotlock_settings = {
 	MEMBER(temp_prefix) NULL,
 	MEMBER(lock_suffix) NULL,
 
@@ -414,8 +415,8 @@
 					  &hash->file_lock);
 	} else {
 		i_assert(hash->dotlock == NULL);
-		return file_dotlock_create(&dotlock_settings, hash->filepath,
-					   0, &hash->dotlock);
+		return file_dotlock_create(&hash->dotlock_settings,
+					   hash->filepath, 0, &hash->dotlock);
 	}
 }
 
@@ -493,7 +494,8 @@
 	uoff_t file_size;
 	int fd;
 
-	fd = file_dotlock_open(&dotlock_settings, hash->filepath, 0, &dotlock);
+	fd = file_dotlock_open(&hash->dotlock_settings,
+			       hash->filepath, 0, &dotlock);
 	if (fd == -1) {
 		mail_hash_set_syscall_error(hash, "file_dotlock_open()");
 		return -1;
@@ -559,6 +561,8 @@
 	hash->suffix = i_strdup(suffix);
 	hash->record_size = record_size;
 	hash->fd = -1;
+	hash->dotlock_settings = default_dotlock_settings;
+	hash->dotlock_settings.use_excl_lock = index->use_excl_dotlocks;
 
 	hash->key_hash_cb = key_hash_cb;
 	hash->rec_hash_cb = rec_hash_cb;

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- mail-index-private.h	17 Dec 2006 16:35:32 -0000	1.78
+++ mail-index-private.h	28 Dec 2006 16:28:29 -0000	1.79
@@ -183,6 +183,7 @@
 	unsigned int mmap_disable:1;
 	unsigned int fsync_disable:1;
 	unsigned int mmap_no_write:1;
+	unsigned int use_excl_dotlocks:1;
 	unsigned int readonly:1;
 	unsigned int fsck:1;
 	unsigned int sync_update:1;

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.250
retrieving revision 1.251
diff -u -d -r1.250 -r1.251
--- mail-index.c	20 Dec 2006 03:16:44 -0000	1.250
+++ mail-index.c	28 Dec 2006 16:28:29 -0000	1.251
@@ -1569,6 +1569,8 @@
 			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE) != 0;
 		index->mmap_no_write =
 			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE) != 0;
+		index->use_excl_dotlocks =
+			(flags & MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL) != 0;
 		index->fsync_disable =
 			(flags & MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE) != 0;
 		index->lock_method = lock_method;

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- mail-index.h	17 Dec 2006 16:35:32 -0000	1.164
+++ mail-index.h	28 Dec 2006 16:28:29 -0000	1.165
@@ -20,8 +20,10 @@
 	   OSes that don't have unified buffer cache
 	   (currently OpenBSD <= 3.5) */
 	MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE	= 0x08,
+	/* Rely on O_EXCL when creating dotlocks */
+	MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL	= 0x10,
 	/* Don't fsync() or fdatasync() */
-	MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE	= 0x10
+	MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE	= 0x20
 };
 
 enum mail_index_header_compat_flags {

Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- mail-transaction-log.c	6 Dec 2006 15:08:32 -0000	1.116
+++ mail-transaction-log.c	28 Dec 2006 16:28:29 -0000	1.117
@@ -223,6 +223,7 @@
 	log = i_new(struct mail_transaction_log, 1);
 	log->index = index;
 
+	log->dotlock_settings.use_excl_lock = index->use_excl_dotlocks;
 	log->dotlock_settings.timeout = LOG_DOTLOCK_TIMEOUT;
 	log->dotlock_settings.stale_timeout = LOG_DOTLOCK_STALE_TIMEOUT;
 

Index: mailbox-list-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mailbox-list-index-private.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mailbox-list-index-private.h	20 Dec 2006 08:16:41 -0000	1.3
+++ mailbox-list-index-private.h	28 Dec 2006 16:28:30 -0000	1.4
@@ -1,6 +1,7 @@
 #ifndef __MAILBOX_LIST_INDEX_PRIVATE_H
 #define __MAILBOX_LIST_INDEX_PRIVATE_H
 
+#include "file-dotlock.h"
 #include "mailbox-list-index.h"
 
 #define MAILBOX_LIST_INDEX_MAJOR_VERSION 1
@@ -55,6 +56,7 @@
 	char separator;
 	struct mail_index *mail_index;
 	struct file_cache *file_cache;
+	struct dotlock_settings dotlock_set;
 
 	int fd;
 

Index: mailbox-list-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mailbox-list-index.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mailbox-list-index.c	20 Dec 2006 08:16:41 -0000	1.3
+++ mailbox-list-index.c	28 Dec 2006 16:28:30 -0000	1.4
@@ -35,7 +35,7 @@
 	unsigned int failed:1;
 };
 
-const struct dotlock_settings dotlock_set = {
+const struct dotlock_settings default_dotlock_set = {
 	MEMBER(temp_prefix) NULL,
 	MEMBER(lock_suffix) NULL,
 
@@ -219,7 +219,8 @@
 	struct dotlock *dotlock;
 	int fd, ret;
 
-	fd = file_dotlock_open(&dotlock_set, index->filepath, 0, &dotlock);
+	fd = file_dotlock_open(&index->dotlock_set, index->filepath,
+			       0, &dotlock);
 	if (fd == -1) {
 		mailbox_list_index_set_syscall_error(index,
 						     "file_dotlock_open()");
@@ -314,6 +315,8 @@
 	index->mail_index = mail_index;
 	index->fd = -1;
 	index->mmap_disable = mail_index->mmap_disable;
+	index->dotlock_set = default_dotlock_set;
+	index->dotlock_set.use_excl_lock = mail_index->use_excl_dotlocks;
 	return index;
 }
 



More information about the dovecot-cvs mailing list