Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174227061
D59827.id187191.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
D59827.id187191.diff
View Options
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1776,6 +1776,12 @@
timeout_period = max(timeout_period, NVME_MIN_TIMEOUT_PERIOD);
ctrlr->timeout_period = timeout_period;
+ timeout_period = NVME_FORMAT_TIMEOUT_PERIOD;
+ TUNABLE_INT_FETCH("hw.nvme.format_timeout_period", &timeout_period);
+ timeout_period = min(timeout_period, NVME_MAX_FORMAT_TIMEOUT_PERIOD);
+ timeout_period = max(timeout_period, NVME_MIN_TIMEOUT_PERIOD);
+ ctrlr->format_timeout_period = timeout_period;
+
nvme_retry_count = NVME_DEFAULT_RETRY_COUNT;
TUNABLE_INT_FETCH("hw.nvme.retry_count", &nvme_retry_count);
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -80,8 +80,10 @@
#define NVME_ADMIN_TIMEOUT_PERIOD (60) /* in seconds */
#define NVME_DEFAULT_TIMEOUT_PERIOD (30) /* in seconds */
+#define NVME_FORMAT_TIMEOUT_PERIOD (10 * 60) /* in seconds */
#define NVME_MIN_TIMEOUT_PERIOD (5)
#define NVME_MAX_TIMEOUT_PERIOD (120)
+#define NVME_MAX_FORMAT_TIMEOUT_PERIOD (60 * 60)
#define NVME_DEFAULT_RETRY_COUNT (4)
@@ -294,6 +296,7 @@
/** timeout period in seconds */
uint32_t admin_timeout_period;
+ uint32_t format_timeout_period;
uint32_t timeout_period;
/** doorbell stride */
diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -150,6 +150,22 @@
return (0);
}
+static int
+nvme_sysctl_format_timeout_period(SYSCTL_HANDLER_ARGS)
+{
+ uint32_t *ptr = arg1;
+ uint32_t newval = *ptr;
+ int error = sysctl_handle_int(oidp, &newval, 0, req);
+
+ if (error || req->newptr == NULL)
+ return (error);
+ if (newval > NVME_MAX_FORMAT_TIMEOUT_PERIOD ||
+ newval < NVME_MIN_TIMEOUT_PERIOD)
+ return (EINVAL);
+ *ptr = newval;
+ return (0);
+}
+
static void
nvme_qpair_reset_stats(struct nvme_qpair *qpair)
{
@@ -380,6 +396,11 @@
&ctrlr->timeout_period, 0, nvme_sysctl_timeout_period, "IU",
"Timeout period for I/O queues (in seconds)");
+ SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
+ "format_timeout_period", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &ctrlr->format_timeout_period, 0, nvme_sysctl_format_timeout_period,
+ "IU", "Timeout period for Format NVM commands (in seconds)");
+
SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
"num_cmds", CTLTYPE_S64 | CTLFLAG_RD | CTLFLAG_MPSAFE,
ctrlr, 0, nvme_sysctl_num_cmds, "IU",
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 12:54 PM (10 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40048848
Default Alt Text
D59827.id187191.diff (2 KB)
Attached To
Mode
D59827: nvme: add a timeout for Format NVM commands
Attached
Detach File
Event Timeline
Log In to Comment