Page MenuHomeFreeBSD

Speed up "zpool import" in the presence of many zvols
Needs ReviewPublic

Authored by asomers on Oct 18 2019, 3:11 PM.

Details

Reviewers
avg
mav
Summary

Speed up "zpool import" in the presence of many zvols

By default, zpools may not be backed by zvols (that can be changed with the
"vfs.zfs.vol.recursive sysctl). When that sysctl is set to 0, the kernel
does not attempt to read zvols when looking for vdevs. But the zpool
command still does. This change brings the zpool command into line with the
kernel's behavior. It speeds "zpool import" when an already imported pool
has many zvols.

PR: 241083
Reported by: Martin Birgmeier <d8zNeCFG@aon.at>

Test Plan

Ran all "zpool import"-related tests from the ZFS test suite

Diff Detail

Repository
rS FreeBSD src repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27103
Build 25382: arc lint + arc unit

Event Timeline

asomers created this revision.Oct 18 2019, 3:11 PM

I have recently looked at this function to port adapt it for ZoF. I like the overall idea here, but as a nit please do try matching the surrounding style. I would also find it easier to follow without the extra negations. Calling the bool skip_zvols would read more naturally to me.

	boolean_t skip_zvols = B_FALSE;
	if (sysctlbyname("vfs.zfs.vol.recursive", &value, &size, NULL, 0) == 0 &&
	    value == 0) {
		skip_zvols = B_TRUE;
	}
				if (skip_zvols &&
				    strcmp(mp->lg_name, "ZFS::ZVOL") == 0) {
					continue;
				}