]> git.proxmox.com Git - mirror_zfs-debian.git/commit
Use stored whole_disk property when opening a vdev
authorNed Bass <bass6@llnl.gov>
Mon, 4 Oct 2010 20:08:24 +0000 (13:08 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 4 Oct 2010 20:53:18 +0000 (13:53 -0700)
commit3a7381e531f55929f894fa2e81b79e1980de6f22
tree39f5e359b145641e5025fc8ad859c41c5255030d
parent0151834d65bb05f02a43c7f1b6128030aa3e76c4
Use stored whole_disk property when opening a vdev

This commit fixes a bug in vdev_disk_open() in which the whole_disk property
was getting set to 0 for disk devices, even when it was stored as a 1 when the
zpool was created.  The whole_disk property lets us detect when the partition
suffix should be stripped from the device name in CLI output.  It is also used
to determine how writeback cache should be set for a device.

When an existing zpool is imported its configuration is read from the vdev
label by user space in zpool_read_label().  The whole_disk property is saved in
the nvlist which gets passed into the kernel, where it in turn gets saved in
the vdev struct in vdev_alloc().  Therefore, this value is available in
vdev_disk_open() and should not be overridden by checking the provided device
path, since that path will likely point to a partition and the check will
return the wrong result.

We also add an ASSERT that the whole_disk property is set.  We are not aware of
any cases where vdev_disk_open() should be called with a config that doesn't
have this property set.  The ASSERT is there so that when debugging is enabled
we can identify any legitimate cases that we are missing.  If we never hit the
ASSERT, we can at some point remove it along with the conditional whole_disk
check.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/zfs/vdev_disk.c