mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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:
@@ -1386,6 +1386,7 @@ zvol_os_create_minor(const char *name)
|
||||
uint64_t volsize;
|
||||
uint64_t volmode, hash;
|
||||
int error;
|
||||
bool replayed_zil = B_FALSE;
|
||||
|
||||
ZFS_LOG(1, "Creating ZVOL %s...", name);
|
||||
hash = zvol_name_hash(name);
|
||||
@@ -1490,11 +1491,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;
|
||||
|
||||
/* TODO: prefetch for geom tasting */
|
||||
|
||||
Reference in New Issue
Block a user