dovecot-2.0: Use IO_BLOCK_SIZE macro to specify how large read/w...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 14 11:41:16 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/88d7a36c7fa5
changeset: 11309:88d7a36c7fa5
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 14 10:40:24 2010 +0200
description:
Use IO_BLOCK_SIZE macro to specify how large read/write syscalls to use.

diffstat:

 src/lib-storage/index/dbox-common/dbox-file.c |  2 +-
 src/lib-storage/index/mbox/mbox-file.c        |  2 +-
 src/lib-storage/mail-storage-private.h        |  2 +-
 src/lib/compat.h                              |  5 +++++
 src/lib/file-set-size.c                       |  2 +-
 src/lib/istream-internal.h                    |  2 +-
 src/lib/ostream-file.c                        |  2 +-
 src/lib/ostream.c                             |  2 +-
 8 files changed, 12 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib-storage/index/dbox-common/dbox-file.c
--- a/src/lib-storage/index/dbox-common/dbox-file.c	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-file.c	Fri May 14 10:40:24 2010 +0200
@@ -23,7 +23,7 @@
 #include <ctype.h>
 #include <fcntl.h>
 
-#define DBOX_READ_BLOCK_SIZE 4096
+#define DBOX_READ_BLOCK_SIZE IO_BLOCK_SIZE
 
 #ifndef DBOX_FILE_LOCK_METHOD_FLOCK
 static const struct dotlock_settings dotlock_set = {
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib-storage/index/mbox/mbox-file.c
--- a/src/lib-storage/index/mbox/mbox-file.c	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib-storage/index/mbox/mbox-file.c	Fri May 14 10:40:24 2010 +0200
@@ -10,7 +10,7 @@
 #include <sys/stat.h>
 #include <utime.h>
 
-#define MBOX_READ_BLOCK_SIZE (1024*4)
+#define MBOX_READ_BLOCK_SIZE IO_BLOCK_SIZE
 
 int mbox_file_open(struct mbox_mailbox *mbox)
 {
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib-storage/mail-storage-private.h	Fri May 14 10:40:24 2010 +0200
@@ -11,7 +11,7 @@
 /* Block size when read()ing message header. */
 #define MAIL_READ_HDR_BLOCK_SIZE (1024*4)
 /* Block size when read()ing message (header and) body. */
-#define MAIL_READ_FULL_BLOCK_SIZE (1024*8)
+#define MAIL_READ_FULL_BLOCK_SIZE IO_BLOCK_SIZE
 
 struct mail_storage_module_register {
 	unsigned int id;
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib/compat.h
--- a/src/lib/compat.h	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib/compat.h	Fri May 14 10:40:24 2010 +0200
@@ -260,4 +260,9 @@
 int fdatasync(int);
 #endif
 
+/* Try to keep IO operations at least this size */
+#ifndef IO_BLOCK_SIZE
+#  define IO_BLOCK_SIZE 8192
 #endif
+
+#endif
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib/file-set-size.c
--- a/src/lib/file-set-size.c	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib/file-set-size.c	Fri May 14 10:40:24 2010 +0200
@@ -19,7 +19,7 @@
 #ifdef HAVE_POSIX_FALLOCATE
 	static bool posix_fallocate_supported = TRUE;
 #endif
-	char block[4096];
+	char block[IO_BLOCK_SIZE];
 	off_t offset;
 	ssize_t ret;
 	struct stat st;
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib/istream-internal.h
--- a/src/lib/istream-internal.h	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib/istream-internal.h	Fri May 14 10:40:24 2010 +0200
@@ -4,7 +4,7 @@
 #include "istream.h"
 #include "iostream-internal.h"
 
-#define I_STREAM_MIN_SIZE 4096
+#define I_STREAM_MIN_SIZE IO_BLOCK_SIZE
 
 struct istream_private {
 /* inheritance: */
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib/ostream-file.c
--- a/src/lib/ostream-file.c	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib/ostream-file.c	Fri May 14 10:40:24 2010 +0200
@@ -19,7 +19,7 @@
 
 /* try to keep the buffer size within 4k..128k. ReiserFS may actually return
    128k as optimal size. */
-#define DEFAULT_OPTIMAL_BLOCK_SIZE 4096
+#define DEFAULT_OPTIMAL_BLOCK_SIZE IO_BLOCK_SIZE
 #define MAX_OPTIMAL_BLOCK_SIZE (128*1024)
 
 #define IS_STREAM_EMPTY(fstream) \
diff -r df2599ab2cee -r 88d7a36c7fa5 src/lib/ostream.c
--- a/src/lib/ostream.c	Fri May 14 10:33:19 2010 +0200
+++ b/src/lib/ostream.c	Fri May 14 10:40:24 2010 +0200
@@ -247,7 +247,7 @@
 static off_t o_stream_default_send_istream(struct ostream_private *outstream,
 					   struct istream *instream)
 {
-	return io_stream_copy(&outstream->ostream, instream, 1024);
+	return io_stream_copy(&outstream->ostream, instream, IO_BLOCK_SIZE);
 }
 
 struct ostream *o_stream_create(struct ostream_private *_stream)


More information about the dovecot-cvs mailing list