ZVOL: Make zvol_prefetch_bytes module parameter platform-independent

The module parameter now is represented in FreeBSD sysctls list
with name: 'vfs.zfs.vol.prefetch_bytes'. The default value is 131072,
same as on Linux side.

Sponsored-by: vStack, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Signed-off-by: Fedor Uporov <fuporov.vstack@gmail.com>
Closes #17385
This commit is contained in:
Fedor Uporov
2025-05-31 16:58:54 +03:00
committed by GitHub
parent e8e602d987
commit e1677d9ee1
4 changed files with 12 additions and 7 deletions
+7 -2
View File
@@ -1369,7 +1369,7 @@ zvol_os_create_minor(const char *name)
objset_t *os;
dmu_object_info_t *doi;
uint64_t volsize;
uint64_t volmode, hash;
uint64_t volmode, hash, len;
int error;
bool replayed_zil = B_FALSE;
@@ -1480,7 +1480,12 @@ zvol_os_create_minor(const char *name)
zil_close(zv->zv_zilog);
zv->zv_zilog = NULL;
/* TODO: prefetch for geom tasting */
len = MIN(zvol_prefetch_bytes, SPA_MAXBLOCKSIZE);
if (len > 0) {
dmu_prefetch(os, ZVOL_OBJ, 0, 0, len, ZIO_PRIORITY_ASYNC_READ);
dmu_prefetch(os, ZVOL_OBJ, 0, volsize - len, len,
ZIO_PRIORITY_ASYNC_READ);
}
zv->zv_objset = NULL;
out_dmu_objset_disown:
-4
View File
@@ -51,7 +51,6 @@ static void zvol_request_impl(zvol_state_t *zv, struct bio *bio,
struct request *rq, boolean_t force_sync);
static unsigned int zvol_major = ZVOL_MAJOR;
static unsigned int zvol_prefetch_bytes = (128 * 1024);
static unsigned long zvol_max_discard_blocks = 16384;
#ifndef HAVE_BLKDEV_GET_ERESTARTSYS
@@ -1796,9 +1795,6 @@ MODULE_PARM_DESC(zvol_major, "Major number for zvol device");
module_param(zvol_max_discard_blocks, ulong, 0444);
MODULE_PARM_DESC(zvol_max_discard_blocks, "Max number of blocks to discard");
module_param(zvol_prefetch_bytes, uint, 0644);
MODULE_PARM_DESC(zvol_prefetch_bytes, "Prefetch N bytes at zvol start+end");
module_param(zvol_volmode, uint, 0644);
MODULE_PARM_DESC(zvol_volmode, "Default volmode property value");