changeset 11309:88d7a36c7fa5 HEAD

Use IO_BLOCK_SIZE macro to specify how large read/write syscalls to use.
author Timo Sirainen <tss@iki.fi>
date Fri, 14 May 2010 10:40:24 +0200
parents df2599ab2cee
children 2937ca64faa9
files src/lib-storage/index/dbox-common/dbox-file.c src/lib-storage/index/mbox/mbox-file.c src/lib-storage/mail-storage-private.h src/lib/compat.h src/lib/file-set-size.c src/lib/istream-internal.h src/lib/ostream-file.c src/lib/ostream.c
diffstat 8 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 = {
--- 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)
 {
--- 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;
--- 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
--- 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;
--- 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: */
--- 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) \
--- 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)