about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-02-11 07:28:45 +0000
committerEric Wong <normalperson@yhbt.net>2012-02-11 07:30:55 +0000
commitaba0194feafb3765ee86cfb40e5d7c7607c8aa42 (patch)
tree8f0cab39a7a5524bdbb7aa39b742c1fa7e1c683b
parentc103886fadfc54360093964d658b44403cf2df9b (diff)
downloadcmogstored-aba0194feafb3765ee86cfb40e5d7c7607c8aa42.tar.gz
BUFSIZ is only 1024 on FreeBSD, this is too small to be
optimal for large I/O operations.
-rw-r--r--alloc.c4
-rw-r--r--thrpool.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/alloc.c b/alloc.c
index d4e8c04..cdddff7 100644
--- a/alloc.c
+++ b/alloc.c
@@ -7,13 +7,13 @@
 static size_t l1_cache_line_size = L1_CACHE_LINE_MAX;
 static pthread_key_t mog_rbuf_key; /* for small socket/pipe reads (headers) */
 static pthread_key_t mog_fsbuf_key; /* large for filesystem I/O */
-static size_t FSBUF_SIZE = BUFSIZ; /* trust stdio, BUFSIZ=8192 on glibc */
+static size_t FSBUF_SIZE = 8192;
 
 #define MOG_MASK(align)        (~((size_t)align - 1))
 #define MOG_ALIGN(align,val)   (((val) + (size_t)align - 1) & MOG_MASK(align))
 
 /*
- * Just in case the system page size is larger than BUFSIZ,
+ * Just in case the system page size is larger than 8192,
  * crank up FSBUF_SIZE to match since mmap() will internally
  * round up the allocation anyways
  */
diff --git a/thrpool.c b/thrpool.c
index 2bc276f..593993b 100644
--- a/thrpool.c
+++ b/thrpool.c
@@ -9,7 +9,7 @@
  * We also use syslog() and *printf() functions which take a lot of
  * stack under glibc, so we'll add BUFSIZ (8192 on glibc) to that
  */
-#define MOG_THR_STACK_SIZE ((16 * 1024) + BUFSIZ)
+#define MOG_THR_STACK_SIZE ((16 * 1024) + MAX(8192,BUFSIZ))
 
 #if defined(PTHREAD_STACK_MIN) && (PTHREAD_STACK_MIN > MOG_THR_STACK_SIZE)
 #  undef MOG_THR_STACK_SIZE