[dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.42.2.4, 1.42.2.5 mail-cache-transaction.c, 1.49.2.4, 1.49.2.5 mail-index-lock.c, 1.54.2.3, 1.54.2.4 mail-index-private.h, 1.69.2.5, 1.69.2.6 mail-index.c, 1.230.2.24, 1.230.2.25 mail-index.h, 1.158.2.4, 1.158.2.5

tss at dovecot.org tss at dovecot.org
Sat Mar 10 22:58:44 EET 2007


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

Modified Files:
      Tag: branch_1_0
	mail-cache-compress.c mail-cache-transaction.c 
	mail-index-lock.c mail-index-private.h mail-index.c 
	mail-index.h 
Log Message:
Added fsync_disable setting.



Index: mail-cache-compress.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-compress.c,v
retrieving revision 1.42.2.4
retrieving revision 1.42.2.5
diff -u -d -r1.42.2.4 -r1.42.2.5
--- mail-cache-compress.c	18 Jan 2007 15:36:09 -0000	1.42.2.4
+++ mail-cache-compress.c	10 Mar 2007 20:58:41 -0000	1.42.2.5
@@ -229,10 +229,12 @@
 
 	o_stream_destroy(&output);
 
-	if (fdatasync(fd) < 0) {
-		mail_cache_set_syscall_error(cache, "fdatasync()");
-		(void)mail_index_transaction_rollback(&t);
-		return -1;
+	if (!cache->index->fsync_disable) {
+		if (fdatasync(fd) < 0) {
+			mail_cache_set_syscall_error(cache, "fdatasync()");
+			(void)mail_index_transaction_rollback(&t);
+			return -1;
+		}
 	}
 
 	return mail_index_transaction_commit(&t, &seq, &offset);

Index: mail-cache-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-transaction.c,v
retrieving revision 1.49.2.4
retrieving revision 1.49.2.5
diff -u -d -r1.49.2.4 -r1.49.2.5
--- mail-cache-transaction.c	22 Feb 2007 13:45:40 -0000	1.49.2.4
+++ mail-cache-transaction.c	10 Mar 2007 20:58:41 -0000	1.49.2.5
@@ -668,7 +668,7 @@
 		ret = -1;
 	else if (mail_cache_write(cache, data, size, offset) < 0)
 		ret = -1;
-	else if (fdatasync(cache->fd) < 0) {
+	else if (!cache->index->fsync_disable && fdatasync(cache->fd) < 0) {
 		mail_cache_set_syscall_error(cache, "fdatasync()");
 		ret = -1;
 	} else if (mail_cache_header_fields_get_next_offset(cache,

Index: mail-index-lock.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-lock.c,v
retrieving revision 1.54.2.3
retrieving revision 1.54.2.4
diff -u -d -r1.54.2.3 -r1.54.2.4
--- mail-index-lock.c	17 Jan 2007 16:17:38 -0000	1.54.2.3
+++ mail-index-lock.c	10 Mar 2007 20:58:41 -0000	1.54.2.4
@@ -343,10 +343,13 @@
 {
 	int ret = 0;
 
-	if (fsync(index->fd) < 0) {
-		mail_index_file_set_syscall_error(index, index->copy_lock_path,
-						  "fsync()");
-		ret = -1;
+	if (!index->fsync_disable) {
+		if (fsync(index->fd) < 0) {
+			mail_index_file_set_syscall_error(index,
+							  index->copy_lock_path,
+							  "fsync()");
+			ret = -1;
+		}
 	}
 
 	if (ret == 0) {

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.69.2.5
retrieving revision 1.69.2.6
diff -u -d -r1.69.2.5 -r1.69.2.6
--- mail-index-private.h	17 Jan 2007 23:33:26 -0000	1.69.2.5
+++ mail-index-private.h	10 Mar 2007 20:58:41 -0000	1.69.2.6
@@ -174,6 +174,7 @@
 	unsigned int opened:1;
 	unsigned int log_locked:1;
 	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;

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.230.2.24
retrieving revision 1.230.2.25
diff -u -d -r1.230.2.24 -r1.230.2.25
--- mail-index.c	10 Mar 2007 19:30:24 -0000	1.230.2.24
+++ mail-index.c	10 Mar 2007 20:58:41 -0000	1.230.2.25
@@ -1646,6 +1646,8 @@
 			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE) != 0;
 		index->mmap_no_write =
 			(flags & MAIL_INDEX_OPEN_FLAG_MMAP_NO_WRITE) != 0;
+		index->fsync_disable =
+			(flags & MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE) != 0;
 		index->use_excl_dotlocks =
 			(flags & MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL) != 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.158.2.4
retrieving revision 1.158.2.5
diff -u -d -r1.158.2.4 -r1.158.2.5
--- mail-index.h	28 Dec 2006 16:27:42 -0000	1.158.2.4
+++ mail-index.h	10 Mar 2007 20:58:41 -0000	1.158.2.5
@@ -18,7 +18,9 @@
 	   (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
+	MAIL_INDEX_OPEN_FLAG_DOTLOCK_USE_EXCL	= 0x10,
+	/* Don't fsync() or fdatasync() */
+	MAIL_INDEX_OPEN_FLAG_FSYNC_DISABLE	= 0x20
 };
 
 enum mail_index_lock_method {



More information about the dovecot-cvs mailing list