Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153366616
D7756.id19974.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D7756.id19974.diff
View Options
Index: lib/libstand/nfs.c
===================================================================
--- lib/libstand/nfs.c
+++ lib/libstand/nfs.c
@@ -36,6 +36,7 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <string.h>
+#include <stddef.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -50,7 +51,8 @@
#define NFS_DEBUGxx
-#define NFSREAD_SIZE 1024
+#define NFSREAD_MIN_SIZE 1024
+#define NFSREAD_MAX_SIZE 4096
/* Define our own NFS attributes without NQNFS stuff. */
#ifdef OLD_NFSV2
@@ -83,7 +85,7 @@
n_long errno;
struct nfsv2_fattrs fa;
n_long count;
- u_char data[NFSREAD_SIZE];
+ u_char data[NFSREAD_MAX_SIZE];
};
#ifndef NFS_NOSYMLINK
@@ -210,6 +212,8 @@
nfs_readdir
};
+static int nfs_read_size = NFSREAD_MIN_SIZE;
+
#ifdef OLD_NFSV2
/*
* Fetch the root file handle (call mount daemon)
@@ -264,6 +268,17 @@
if (repl->errno)
return (ntohl(repl->errno));
bcopy(repl->fh, fhp, sizeof(repl->fh));
+
+ /*
+ * Improve boot performance over NFS
+ */
+ if (getenv("nfs.read_size") != NULL)
+ nfs_read_size = strtol(getenv("nfs.read_size"), NULL, 0);
+ if (nfs_read_size < NFSREAD_MIN_SIZE)
+ nfs_read_size = NFSREAD_MIN_SIZE;
+ if (nfs_read_size > NFSREAD_MAX_SIZE)
+ nfs_read_size = NFSREAD_MAX_SIZE;
+
return (0);
}
@@ -401,11 +416,11 @@
bcopy(d->fh, args->fh, NFS_FHSIZE);
args->off = htonl((n_long)off);
- if (len > NFSREAD_SIZE)
- len = NFSREAD_SIZE;
+ if (len > nfs_read_size)
+ len = nfs_read_size;
args->len = htonl((n_long)len);
args->xxx = htonl((n_long)0);
- hlen = sizeof(*repl) - NFSREAD_SIZE;
+ hlen = offsetof(struct nfs_read_rpl, data[0]);
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READ,
args, sizeof(*args),
@@ -1025,7 +1040,7 @@
uint32_t count;
uint32_t eof;
uint32_t len;
- u_char data[NFSREAD_SIZE];
+ u_char data[NFSREAD_MAX_SIZE];
} *repl;
struct {
uint32_t h[RPC_HEADER_WORDS];
@@ -1048,10 +1063,10 @@
pos = roundup(d->fhsize, sizeof(uint32_t)) / sizeof(uint32_t);
args->fhoffcnt[pos++] = 0;
args->fhoffcnt[pos++] = htonl((uint32_t)off);
- if (len > NFSREAD_SIZE)
- len = NFSREAD_SIZE;
+ if (len > nfs_read_size)
+ len = nfs_read_size;
args->fhoffcnt[pos] = htonl((uint32_t)len);
- hlen = sizeof(*repl) - NFSREAD_SIZE;
+ hlen = offsetof(struct repl, data[0]);
cc = rpc_call(d->iodesc, NFS_PROG, NFS_VER3, NFSPROCV3_READ,
args, 4 * sizeof(uint32_t) + roundup(d->fhsize, sizeof(uint32_t)),
Index: sys/boot/i386/pxeldr/pxeboot.8
===================================================================
--- sys/boot/i386/pxeldr/pxeboot.8
+++ sys/boot/i386/pxeldr/pxeboot.8
@@ -73,6 +73,14 @@
.Ed
.Nm
+defaults to a conservative 1024 byte NFS data packet size. This
+may be changed by setting the
+.Va nfs.read_size
+variable in
+.Pa /boot/loader.conf .
+Valid values range is from 1024 to 4096 bytes.
+.Pp
+.Nm
recognizes
.Va next-server
and
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 6:10 PM (5 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31924771
Default Alt Text
D7756.id19974.diff (2 KB)
Attached To
Mode
D7756: pxeboot: add nfs.read_size tunable
Attached
Detach File
Event Timeline
Log In to Comment