Skip to content

Commit

Permalink
Use existing 'zvol_threads' variable for kstat
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-kv committed Oct 30, 2024
1 parent 46a0b99 commit 20af5e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion include/os/windows/zfs/sys/kstat_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ extern uint64_t zfs_initialize_value;
extern int zfs_autoimport_disable;
extern int zfs_removal_suspend_progress;
extern int cpu_avx_supported;
extern int zvol_io_threads;
extern int zvol_threads;

int kstat_windows_init(void *);
void kstat_windows_fini(void);
Expand Down
5 changes: 2 additions & 3 deletions module/os/windows/zfs/arc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,7 @@ arc_kstat_update_windows(kstat_t *ksp, int rw)
zfs_arc_p_min_shift = ks->arc_zfs_arc_p_min_shift.value.ui64;
zfs_arc_average_blocksize =
ks->arc_zfs_arc_average_blocksize.value.ui64;
zvol_io_threads =
ks->zvol_io_threads.value.ui32;
zvol_threads = ks->zvol_io_threads.value.ui32;

#ifdef _KERNEL
if (ks->zfs_total_memory_limit.value.ui64 > total_memory &&
Expand Down Expand Up @@ -731,7 +730,7 @@ arc_kstat_update_windows(kstat_t *ksp, int rw)
ks->arc_zfs_arc_p_min_shift.value.ui64 = zfs_arc_p_min_shift;
ks->arc_zfs_arc_average_blocksize.value.ui64 =
zfs_arc_average_blocksize;
ks->zvol_io_threads.value.ui32 = zvol_io_threads;
ks->zvol_io_threads.value.ui32 = zvol_threads;

#ifdef _KERNEL
ks->zfs_total_memory_limit.value.ui64 = total_memory;
Expand Down
5 changes: 1 addition & 4 deletions module/os/windows/zfs/zfs_kstat_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ windows_kstat_update(kstat_t *ksp, int rw)
ks->zfs_removal_suspend_progress.value.i32;
cpu_avx_supported =
ks->cpu_avx_supported.value.ui32;
zvol_io_threads =
ks->zvol_io_threads.value.ui32;

} else {

/* kstat READ */
Expand Down Expand Up @@ -575,7 +572,7 @@ windows_kstat_update(kstat_t *ksp, int rw)
ks->cpu_avx_supported.value.ui32 =
cpu_avx_supported;
ks->zvol_io_threads.value.ui32 =
zvol_io_threads;
zvol_threads;
}
arc_kstat_update_windows(ksp, rw);
return (0);
Expand Down
15 changes: 6 additions & 9 deletions module/os/windows/zfs/zvol_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ static uint32_t zvol_major = ZVOL_MAJOR;
unsigned int zvol_request_sync = 0;
unsigned int zvol_prefetch_bytes = (128 * 1024);
unsigned long zvol_max_discard_blocks = 16384;
unsigned int zvol_threads = 32;
int zvol_io_threads = 0;
int zvol_threads = 0;

taskq_t *zvol_taskq;

Expand Down Expand Up @@ -1029,21 +1028,19 @@ const static zvol_platform_ops_t zvol_windows_ops = {
int
zvol_init(void)
{
if (!zvol_io_threads)
zvol_io_threads = zvol_threads;

zvol_threads = zvol_io_threads;

int threads = MIN(MAX(zvol_threads, 1), 1024);
int threads = MIN(MAX((zvol_threads ? zvol_threads: boot_ncpus), 1), 1024);

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

zvol_threads = threads; // Update it so that kstat gets the current value

zvol_init_impl();
zvol_register_ops(&zvol_windows_ops);
return (0);
Expand Down

0 comments on commit 20af5e7

Please sign in to comment.