summaryrefslogtreecommitdiffstats
path: root/lib/libstand/open.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-09-05 09:52:50 +0000
committermsmith <msmith@FreeBSD.org>2000-09-05 09:52:50 +0000
commit6ff92c14b7a65f64dea4e0d4e8d19b2dcf3f57b3 (patch)
treeded2222e22c2d532e900757ec03c1d5306a3e570 /lib/libstand/open.c
parent75c63c707d89253e9bd44217d8975ec16bec5aa5 (diff)
downloadFreeBSD-src-6ff92c14b7a65f64dea4e0d4e8d19b2dcf3f57b3.zip
FreeBSD-src-6ff92c14b7a65f64dea4e0d4e8d19b2dcf3f57b3.tar.gz
Implement readahead buffering for non-raw files. This drastically improves
the efficiency of byte-by-byte read operations on filesystems not already supported by the block cache (especially NFS). This should be a welcome change for users booting via PXE, as the loader now reads its startup files almost instantly, instead of taking tens of seconds.
Diffstat (limited to 'lib/libstand/open.c')
-rw-r--r--lib/libstand/open.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libstand/open.c b/lib/libstand/open.c
index 3a9127c..471f937 100644
--- a/lib/libstand/open.c
+++ b/lib/libstand/open.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/* $NetBSD: open.c,v 1.16 1997/01/28 09:41:03 pk Exp $ */
/*-
@@ -79,6 +80,13 @@ o_gethandle(void)
return(-1);
}
+static void
+o_rainit(struct open_file *f)
+{
+ f->f_rabuf = malloc(SOPEN_RASIZE);
+ f->f_ralen = 0;
+ f->f_raoffset = 0;
+}
int
open(const char *fname, int mode)
@@ -118,6 +126,7 @@ open(const char *fname, int mode)
if (error == 0) {
f->f_ops = file_system[i];
+ o_rainit(f);
return (fd);
}
if (error != EINVAL)
OpenPOWER on IntegriCloud