Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153172156
D8491.id26289.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8491.id26289.diff
View Options
Index: lib/libstand/nfs.c
===================================================================
--- lib/libstand/nfs.c
+++ lib/libstand/nfs.c
@@ -214,6 +214,38 @@
static int nfs_read_size = NFSREAD_MIN_SIZE;
+/*
+ * Improve boot performance over NFS
+ */
+static void
+set_nfs_read_size(void)
+{
+ char *env, *end;
+ char buf[10];
+
+ if ((env = getenv("nfs.read_size")) != NULL) {
+ errno = 0;
+ nfs_read_size = (int)strtol(env, &end, 0);
+ if (errno != 0 || *env == '\0' || *end != '\0') {
+ printf("%s: bad value: \"%s\", defaulting to %d\n",
+ "nfs.read_size", env, NFSREAD_MIN_SIZE);
+ nfs_read_size = NFSREAD_MIN_SIZE;
+ }
+ }
+ if (nfs_read_size < NFSREAD_MIN_SIZE) {
+ printf("%s: bad value: \"%d\", defaulting to %d\n",
+ "nfs.read_size", nfs_read_size, NFSREAD_MIN_SIZE);
+ nfs_read_size = NFSREAD_MIN_SIZE;
+ }
+ if (nfs_read_size > NFSREAD_MAX_SIZE) {
+ printf("%s: bad value: \"%d\", defaulting to %d\n",
+ "nfs.read_size", nfs_read_size, NFSREAD_MIN_SIZE);
+ nfs_read_size = NFSREAD_MAX_SIZE;
+ }
+ snprintf(buf, sizeof (buf), "%d", nfs_read_size);
+ setenv("nfs.read_size", buf, 1);
+}
+
#ifdef OLD_NFSV2
/*
* Fetch the root file handle (call mount daemon)
@@ -269,16 +301,7 @@
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;
-
+ set_nfs_read_size();
return (0);
}
@@ -885,6 +908,8 @@
return (ntohl(repl->errno));
*fhlenp = ntohl(repl->fhsize);
bcopy(repl->fh, fhp, *fhlenp);
+
+ set_nfs_read_size();
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 20, 2:31 PM (13 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31845565
Default Alt Text
D8491.id26289.diff (1 KB)
Attached To
Mode
D8491: libstand: verify value provided by nfs.read_size
Attached
Detach File
Event Timeline
Log In to Comment