mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-06-25 02:28:01 +03:00
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:
parent
e8e602d987
commit
e1677d9ee1
@ -93,8 +93,9 @@ extern struct hlist_head *zvol_htable;
|
||||
#define ZVOL_HT_HEAD(hash) (&zvol_htable[(hash) & (ZVOL_HT_SIZE-1)])
|
||||
extern zil_replay_func_t *const zvol_replay_vector[TX_MAX_TYPE];
|
||||
|
||||
extern unsigned int zvol_volmode;
|
||||
extern unsigned int zvol_inhibit_dev;
|
||||
extern unsigned int zvol_prefetch_bytes;
|
||||
extern unsigned int zvol_volmode;
|
||||
extern unsigned int zvol_threads;
|
||||
extern unsigned int zvol_num_taskqs;
|
||||
extern unsigned int zvol_request_sync;
|
||||
|
@ -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:
|
||||
|
@ -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");
|
||||
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include <sys/zvol_impl.h>
|
||||
|
||||
unsigned int zvol_inhibit_dev = 0;
|
||||
unsigned int zvol_prefetch_bytes = (128 * 1024);
|
||||
unsigned int zvol_volmode = ZFS_VOLMODE_GEOM;
|
||||
unsigned int zvol_threads = 0;
|
||||
unsigned int zvol_num_taskqs = 0;
|
||||
@ -2156,6 +2157,8 @@ zvol_fini_impl(void)
|
||||
|
||||
ZFS_MODULE_PARAM(zfs_vol, zvol_, inhibit_dev, UINT, ZMOD_RW,
|
||||
"Do not create zvol device nodes");
|
||||
ZFS_MODULE_PARAM(zfs_vol, zvol_, prefetch_bytes, UINT, ZMOD_RW,
|
||||
"Prefetch N bytes at zvol start+end");
|
||||
ZFS_MODULE_PARAM(zfs_vol, zvol_, threads, UINT, ZMOD_RW,
|
||||
"Number of threads for I/O requests. Set to 0 to use all active CPUs");
|
||||
ZFS_MODULE_PARAM(zfs_vol, zvol_, num_taskqs, UINT, ZMOD_RW,
|
||||
|
Loading…
Reference in New Issue
Block a user