mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Optionally skip zil_close during zvol_create_minor_impl
If there were no zil entries to replay, skip zil_close. zil_close waits for a transaction to sync. That can take several seconds, for example during pool import of a resilvering pool. Skipping zil_close can cut the time for "zpool import" from 2 hours to 45 seconds on a resilvering pool with a thousand zvols. Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Sponsored-by: Axcient Closes #13999 Closes #14015
This commit is contained in:
@@ -1279,6 +1279,7 @@ zvol_os_create_minor(const char *name)
|
||||
int error = 0;
|
||||
int idx;
|
||||
uint64_t hash = zvol_name_hash(name);
|
||||
bool replayed_zil = B_FALSE;
|
||||
|
||||
if (zvol_inhibit_dev)
|
||||
return (0);
|
||||
@@ -1420,11 +1421,12 @@ zvol_os_create_minor(const char *name)
|
||||
zv->zv_zilog = zil_open(os, zvol_get_data, &zv->zv_kstat.dk_zil_sums);
|
||||
if (spa_writeable(dmu_objset_spa(os))) {
|
||||
if (zil_replay_disable)
|
||||
zil_destroy(zv->zv_zilog, B_FALSE);
|
||||
replayed_zil = zil_destroy(zv->zv_zilog, B_FALSE);
|
||||
else
|
||||
zil_replay(os, zv, zvol_replay_vector);
|
||||
replayed_zil = zil_replay(os, zv, zvol_replay_vector);
|
||||
}
|
||||
zil_close(zv->zv_zilog);
|
||||
if (replayed_zil)
|
||||
zil_close(zv->zv_zilog);
|
||||
zv->zv_zilog = NULL;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user