Page MenuHomeFreeBSD

Refactor vdev_geom_attach and friends to reduce code duplication
ClosedPublic

Authored by asomers on Apr 15 2016, 8:27 PM.
Tags
None
Referenced Files
F101275874: D5974.id15253.diff
Sun, Oct 27, 1:45 AM
Unknown Object (File)
Sat, Oct 5, 10:46 PM
Unknown Object (File)
Wed, Oct 2, 7:19 AM
Unknown Object (File)
Wed, Oct 2, 3:28 AM
Unknown Object (File)
Sep 26 2024, 2:20 PM
Unknown Object (File)
Sep 24 2024, 2:07 AM
Unknown Object (File)
Sep 23 2024, 7:16 AM
Unknown Object (File)
Sep 23 2024, 4:22 AM
Subscribers

Details

Summary

Move checks for provider's sectorsize and mediasize into a single location
in vdev_geom_attach. Remove the zfs::vdev::taste class; it's ok to use the
regular vdev class for tasting. Consolidate guid checks into a single
location in vdev_attach_ok. Consolidate some error handling code from
vdev_geom_attach into vdev_geom_detach, closing a resource leak of geom
consumers in the process.

Test Plan

ZFS test suite

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

asomers retitled this revision from to Refactor vdev_geom_attach and friends to reduce code duplication.
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added reviewers: avg, smh.
asomers added a subscriber: delphij.

I declare a timeout on the CR. But by all means feel free to criticize it post-commit.

In general I like this change very much as the code becomes safer and more readable.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
285 ↗(On Diff #15253)

Could it happen that the acr was incremented by somebody else and we really shouldn't decrement the access bits?
I would be more comfortable if we passed an explicit flag to this function which would instruct whether we should "unaccess" rather than trying to guess that.

293 ↗(On Diff #15253)

Just curious, in what case this condition could be false?

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
285 ↗(On Diff #15253)

I'll do it.

293 ↗(On Diff #15253)

Uh, never? Looks like this line was copied by mistake.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
318 ↗(On Diff #15253)

This assertion isn't always true in the case of spare vdevs, where two vdevs can share a consumer. I'll remove it. When I commit the change that turns cp->private into a linked list I'll restore a similar assertion.

asomers edited edge metadata.

Apply avg's comments. Remove a tautological assertion, remove an incorrect
assertion, and fix some theoretical null pointer dereferences in
vdev_geom_detach when vfs.zfs.debug=1.

avg edited edge metadata.
This revision is now accepted and ready to land.Apr 29 2016, 6:02 AM
This revision was automatically updated to reflect the committed changes.