]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use IO_BLOCK_SIZE macro to specify how large read/write syscalls to use.
authorTimo Sirainen <tss@iki.fi>
Fri, 14 May 2010 08:40:24 +0000 (10:40 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 14 May 2010 08:40:24 +0000 (10:40 +0200)
--HG--
branch : HEAD

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

index 39a89812c65c65695ae1325e6d0462d40d05f271..3a61fbf7c33ea31fc19de42e9879bdfdc1726653 100644 (file)
@@ -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 = {
index 99a52325805f4126e471d7098c7cd88ab3b34ba9..d3ad904490cd080acdb8ad27537021e80d616f17 100644 (file)
@@ -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)
 {
index b80acb8eedce9dcecd325e18b0bc854997d30116..cafc79857aa46161ec5b6f16d989bdda7da5ce55 100644 (file)
@@ -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;
index 7623b109c6f15654123a6564d1feff9a8d00dc8a..abc01e45439531b98c35f1cace5f8b9245b90ab7 100644 (file)
@@ -260,4 +260,9 @@ int i_my_clock_gettime(int clk_id, struct timespec *tp);
 int fdatasync(int);
 #endif
 
+/* Try to keep IO operations at least this size */
+#ifndef IO_BLOCK_SIZE
+#  define IO_BLOCK_SIZE 8192
+#endif
+
 #endif
index d19edd4c27b85bfaf296fa037cdb50f444a5a277..88b1e02c06f5eb8701af777e29ef1c05bbac8a50 100644 (file)
@@ -19,7 +19,7 @@ int file_set_size(int fd, off_t size)
 #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;
index d245c6a9ed60bdcea638983af3e19fc8f6196bc3..9b369ae947d99bd754cb9baced98708210daaefe 100644 (file)
@@ -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: */
index 953d6dd01e870096edea38ff09f3031a867dc7ef..d010d1c6a20b4b477742b1b890cc66639344de35 100644 (file)
@@ -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) \
index 28ff49f1df60506d6e16c4ddd26db18984000164..b6ec95752acc15cea6b6343204646ffc347293d0 100644 (file)
@@ -247,7 +247,7 @@ int o_stream_pwrite(struct ostream *stream, const void *data, size_t size,
 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)