summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2003-03-26 23:40:42 +0000
committertegge <tegge@FreeBSD.org>2003-03-26 23:40:42 +0000
commitede5ebede767d6fee0a2d6efee34a51cc7b61bb7 (patch)
treeb84c95f715ab6a5b3a21a9fb5fb5b689068fd91d /sys/kern
parent5e14826743f78c1b683ca05407f54b99a075c1de (diff)
downloadFreeBSD-src-ede5ebede767d6fee0a2d6efee34a51cc7b61bb7.zip
FreeBSD-src-ede5ebede767d6fee0a2d6efee34a51cc7b61bb7.tar.gz
Add support for reading directly from file to userland buffer when the
O_DIRECT descriptor status flag is set and both offset and length is a multiple of the physical media sector size.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index f904aec..82db7f4 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -52,6 +52,8 @@
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
+#include "opt_directio.h"
+#include "opt_swap.h"
static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer");
@@ -246,6 +248,9 @@ const char *buf_wmesg = BUF_WMESG;
#define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */
#define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */
+#ifdef DIRECTIO
+extern void ffs_rawread_setup(void);
+#endif /* DIRECTIO */
/*
* numdirtywakeup:
*
@@ -463,6 +468,13 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
* We have no less then 16 and no more then 256.
*/
nswbuf = max(min(nbuf/4, 256), 16);
+#ifdef NSWBUF_MIN
+ if (nswbuf < NSWBUF_MIN)
+ nswbuf = NSWBUF_MIN;
+#endif
+#ifdef DIRECTIO
+ ffs_rawread_setup();
+#endif
/*
* Reserve space for the buffer cache buffers
OpenPOWER on IntegriCloud