Skip to content

Commit 20af5e7

Browse files
committed
Use existing 'zvol_threads' variable for kstat
1 parent 46a0b99 commit 20af5e7

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

include/os/windows/zfs/sys/kstat_windows.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ extern uint64_t zfs_initialize_value;
260260
extern int zfs_autoimport_disable;
261261
extern int zfs_removal_suspend_progress;
262262
extern int cpu_avx_supported;
263-
extern int zvol_io_threads;
263+
extern int zvol_threads;
264264

265265
int kstat_windows_init(void *);
266266
void kstat_windows_fini(void);

module/os/windows/zfs/arc_os.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ arc_kstat_update_windows(kstat_t *ksp, int rw)
695695
zfs_arc_p_min_shift = ks->arc_zfs_arc_p_min_shift.value.ui64;
696696
zfs_arc_average_blocksize =
697697
ks->arc_zfs_arc_average_blocksize.value.ui64;
698-
zvol_io_threads =
699-
ks->zvol_io_threads.value.ui32;
698+
zvol_threads = ks->zvol_io_threads.value.ui32;
700699

701700
#ifdef _KERNEL
702701
if (ks->zfs_total_memory_limit.value.ui64 > total_memory &&
@@ -731,7 +730,7 @@ arc_kstat_update_windows(kstat_t *ksp, int rw)
731730
ks->arc_zfs_arc_p_min_shift.value.ui64 = zfs_arc_p_min_shift;
732731
ks->arc_zfs_arc_average_blocksize.value.ui64 =
733732
zfs_arc_average_blocksize;
734-
ks->zvol_io_threads.value.ui32 = zvol_io_threads;
733+
ks->zvol_io_threads.value.ui32 = zvol_threads;
735734

736735
#ifdef _KERNEL
737736
ks->zfs_total_memory_limit.value.ui64 = total_memory;

module/os/windows/zfs/zfs_kstat_windows.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,6 @@ windows_kstat_update(kstat_t *ksp, int rw)
383383
ks->zfs_removal_suspend_progress.value.i32;
384384
cpu_avx_supported =
385385
ks->cpu_avx_supported.value.ui32;
386-
zvol_io_threads =
387-
ks->zvol_io_threads.value.ui32;
388-
389386
} else {
390387

391388
/* kstat READ */
@@ -575,7 +572,7 @@ windows_kstat_update(kstat_t *ksp, int rw)
575572
ks->cpu_avx_supported.value.ui32 =
576573
cpu_avx_supported;
577574
ks->zvol_io_threads.value.ui32 =
578-
zvol_io_threads;
575+
zvol_threads;
579576
}
580577
arc_kstat_update_windows(ksp, rw);
581578
return (0);

module/os/windows/zfs/zvol_os.c

+6-9
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ static uint32_t zvol_major = ZVOL_MAJOR;
4545
unsigned int zvol_request_sync = 0;
4646
unsigned int zvol_prefetch_bytes = (128 * 1024);
4747
unsigned long zvol_max_discard_blocks = 16384;
48-
unsigned int zvol_threads = 32;
49-
int zvol_io_threads = 0;
48+
int zvol_threads = 0;
5049

5150
taskq_t *zvol_taskq;
5251

@@ -1029,21 +1028,19 @@ const static zvol_platform_ops_t zvol_windows_ops = {
10291028
int
10301029
zvol_init(void)
10311030
{
1032-
if (!zvol_io_threads)
1033-
zvol_io_threads = zvol_threads;
1034-
1035-
zvol_threads = zvol_io_threads;
1036-
1037-
int threads = MIN(MAX(zvol_threads, 1), 1024);
1031+
int threads = MIN(MAX((zvol_threads ? zvol_threads: boot_ncpus), 1), 1024);
10381032

10391033
KdPrintEx((DPFLTR_IHVDRIVER_ID, DPFLTR_ERROR_LEVEL,
1040-
"%s: zvol taskq threads %d regvalue: %d\n", __func__, threads, zvol_io_threads));
1034+
"%s: number of zvol taskq threads to be created: %d, registry value: %d ncpus: %d\n",
1035+
__func__, threads, zvol_threads, boot_ncpus));
10411036
zvol_taskq = taskq_create(ZVOL_DRIVER, threads, maxclsyspri,
10421037
threads * 2, INT_MAX, TASKQ_PREPOPULATE | TASKQ_DYNAMIC);
10431038
if (zvol_taskq == NULL) {
10441039
return (-ENOMEM);
10451040
}
10461041

1042+
zvol_threads = threads; // Update it so that kstat gets the current value
1043+
10471044
zvol_init_impl();
10481045
zvol_register_ops(&zvol_windows_ops);
10491046
return (0);

0 commit comments

Comments
 (0)