zvol: Implement zvol threading as a Property

Currently, zvol threading can be switched through the zvol_request_sync
module parameter system-wide. By making it a zvol property, zvol
threading can be switched per zvol.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
Closes #15409
This commit is contained in:
Ameer Hamza
2023-10-25 02:53:27 +05:00
committed by Brian Behlendorf
parent dbe839a9ca
commit 60387facd2
9 changed files with 51 additions and 2 deletions
+9
View File
@@ -2522,6 +2522,15 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
case ZFS_PROP_VOLSIZE:
err = zvol_set_volsize(dsname, intval);
break;
case ZFS_PROP_VOLTHREADING:
err = zvol_set_volthreading(dsname, intval);
/*
* Set err to -1 to force the zfs_set_prop_nvlist code down the
* default path to set the value in the nvlist.
*/
if (err == 0)
err = -1;
break;
case ZFS_PROP_SNAPDEV:
case ZFS_PROP_VOLMODE:
err = zvol_set_common(dsname, prop, source, intval);
+14
View File
@@ -369,6 +369,20 @@ out:
return (SET_ERROR(error));
}
/*
* Update volthreading.
*/
int
zvol_set_volthreading(const char *name, boolean_t value)
{
zvol_state_t *zv = zvol_find_by_name(name, RW_NONE);
if (zv == NULL)
return (ENOENT);
zv->zv_threading = value;
mutex_exit(&zv->zv_state_lock);
return (0);
}
/*
* Sanity check volume block size.
*/