[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-uidlist.c, 1.28.2.14, 1.28.2.15

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


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

Modified Files:
      Tag: branch_1_0
	dbox-uidlist.c 
Log Message:
Added fsync_disable setting.



Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.28.2.14
retrieving revision 1.28.2.15
diff -u -d -r1.28.2.14 -r1.28.2.15
--- dbox-uidlist.c	22 Feb 2007 13:39:12 -0000	1.28.2.14
+++ dbox-uidlist.c	10 Mar 2007 20:58:42 -0000	1.28.2.15
@@ -796,6 +796,7 @@
 static int
 dbox_uidlist_write_append_offsets(struct dbox_uidlist_append_ctx *ctx)
 {
+	struct mail_storage *storage = STORAGE(ctx->uidlist->mbox->storage);
 	struct dbox_save_file *const *files;
         struct dbox_file_header hdr;
 	unsigned int i, count;
@@ -803,6 +804,16 @@
 
 	files = array_get(&ctx->files, &count);
 	for (i = 0; i < count; i++) {
+		if (!ctx->uidlist->mbox->ibox.fsync_disable) {
+			if (fsync(files[i]->file->fd) < 0) {
+				mail_storage_set_critical(storage,
+							"fsync(%s) failed: %m",
+							files[i]->file->path);
+				ret = -1;
+				continue;
+			}
+		}
+
 		DEC2HEX(hdr.append_offset_hex,
 			files[i]->file->output->offset);
 
@@ -810,10 +821,9 @@
 				sizeof(hdr.append_offset_hex),
 				offsetof(struct dbox_file_header,
 					 append_offset_hex)) < 0) {
-			mail_storage_set_critical(
-				STORAGE(ctx->uidlist->mbox->storage),
-				"pwrite_full(%s) failed: %m",
-				files[i]->file->path);
+			mail_storage_set_critical(storage,
+						  "pwrite_full(%s) failed: %m",
+						  files[i]->file->path);
 			ret = -1;
 		}
 	}



More information about the dovecot-cvs mailing list