[Midnightbsd-cvs] src [9479] trunk/sys/geom/geom_dev.c: Added a sysctl to control the maximum size of a delete request

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 5 15:00:04 EST 2017


Revision: 9479
          http://svnweb.midnightbsd.org/src/?rev=9479
Author:   laffer1
Date:     2017-03-05 15:00:04 -0500 (Sun, 05 Mar 2017)
Log Message:
-----------
Added a sysctl to control the maximum size of a delete request

Modified Paths:
--------------
    trunk/sys/geom/geom_dev.c

Modified: trunk/sys/geom/geom_dev.c
===================================================================
--- trunk/sys/geom/geom_dev.c	2017-03-05 19:59:43 UTC (rev 9478)
+++ trunk/sys/geom/geom_dev.c	2017-03-05 20:00:04 UTC (rev 9479)
@@ -53,6 +53,7 @@
 #include <sys/disk.h>
 #include <sys/fcntl.h>
 #include <sys/limits.h>
+#include <sys/sysctl.h>
 #include <geom/geom.h>
 #include <geom/geom_int.h>
 #include <machine/stdarg.h>
@@ -94,6 +95,19 @@
 	.attrchanged = g_dev_attrchanged
 };
 
+/*
+ * We target 262144 (8 x 32768) sectors by default as this significantly
+ * increases the throughput on commonly used SSD's with a marginal
+ * increase in non-interruptible request latency.
+ */
+static uint64_t g_dev_del_max_sectors = 262144;
+SYSCTL_DECL(_kern_geom);
+SYSCTL_NODE(_kern_geom, OID_AUTO, dev, CTLFLAG_RW, 0, "GEOM_DEV stuff");
+SYSCTL_QUAD(_kern_geom_dev, OID_AUTO, delete_max_sectors, CTLFLAG_RW,
+    &g_dev_del_max_sectors, 0, "Maximum number of sectors in a single "
+    "delete request sent to the provider. Larger requests are chunked "
+    "so they can be interrupted. (0 = disable chunking)");
+
 static void
 g_dev_destroy(void *arg, int flags __unused)
 {
@@ -413,8 +427,11 @@
 		}
 		while (length > 0) { 
 			chunk = length;
-			if (chunk > 65536 * cp->provider->sectorsize)
-				chunk = 65536 * cp->provider->sectorsize;
+			if (g_dev_del_max_sectors != 0 && chunk >
+			    g_dev_del_max_sectors * cp->provider->sectorsize) {
+				chunk = g_dev_del_max_sectors *
+				    cp->provider->sectorsize;
+			}
 			error = g_delete_data(cp, offset, chunk);
 			length -= chunk;
 			offset += chunk;
@@ -421,9 +438,9 @@
 			if (error)
 				break;
 			/*
-			 * Since the request size is unbounded, the service
-			 * time is likewise.  We make this ioctl interruptible
-			 * by checking for signals for each bio.
+			 * Since the request size can be large, the service
+			 * time can be is likewise.  We make this ioctl
+			 * interruptible by checking for signals for each bio.
 			 */
 			if (SIGPENDING(td))
 				break;



More information about the Midnightbsd-cvs mailing list