[Midnightbsd-cvs] src [9413] trunk/sys/kern/vfs_cluster.c: add sysctl vfs.read_min to complement the existing vfs.read_max.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Mar 4 16:46:45 EST 2017


Revision: 9413
          http://svnweb.midnightbsd.org/src/?rev=9413
Author:   laffer1
Date:     2017-03-04 16:46:45 -0500 (Sat, 04 Mar 2017)
Log Message:
-----------
add sysctl vfs.read_min to complement the existing vfs.read_max. It defaults to 1 meaning that it is off.

Modified Paths:
--------------
    trunk/sys/kern/vfs_cluster.c

Modified: trunk/sys/kern/vfs_cluster.c
===================================================================
--- trunk/sys/kern/vfs_cluster.c	2017-03-04 21:45:58 UTC (rev 9412)
+++ trunk/sys/kern/vfs_cluster.c	2017-03-04 21:46:45 UTC (rev 9413)
@@ -75,6 +75,10 @@
 SYSCTL_INT(_vfs, OID_AUTO, read_max, CTLFLAG_RW, &read_max, 0,
     "Cluster read-ahead max block count");
 
+static int read_min = 1;
+SYSCTL_INT(_vfs, OID_AUTO, read_min, CTLFLAG_RW, &read_min, 0,
+    "Cluster read min block count");
+
 /* Page expended to mark partially backed buffers */
 extern vm_page_t	bogus_page;
 
@@ -169,6 +173,7 @@
 	} else {
 		off_t firstread = bp->b_offset;
 		int nblks;
+		long minread;
 
 		KASSERT(bp->b_offset != NOOFFSET,
 		    ("cluster_read: no buffer offset"));
@@ -176,6 +181,13 @@
 		ncontig = 0;
 
 		/*
+		 * Adjust totread if needed
+		 */
+		minread = read_min * size;
+		if (minread > totread)
+			totread = minread;
+
+		/*
 		 * Compute the total number of blocks that we should read
 		 * synchronously.
 		 */



More information about the Midnightbsd-cvs mailing list