aboutsummaryrefslogtreecommitdiff
path: root/module/zfs/vdev.c
diff options
context:
space:
mode:
authorJorgen Lundman <lundman@lundman.net>2012-12-17 01:33:57 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2012-12-18 19:02:28 +0000
commit6c2856726fbae681649930d9620d9087080e58fc (patch)
tree8221f09d650f39d29569c82c8d50fb19bdea370f /module/zfs/vdev.c
parent5e6320cd1262de6eada39751807c31c059517d01 (diff)
downloadsrc-6c2856726fbae681649930d9620d9087080e58fc.tar.gz
src-6c2856726fbae681649930d9620d9087080e58fc.zip
Fix using zvol as slog device
During the original ZoL port the vdev_uses_zvols() function was disabled until it could be properly implemented. This prevented a zpool from use a zvol for its slog device. This patch implements that missing functionality by adding a zvol_is_zvol() function to zvol.c. Given the full path to a device it will lookup the device and verify its major number against the registered zvol major number for the system. If they match we know the device is a zvol. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1131
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r--module/zfs/vdev.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index e0d82e6737c4..e374f6d78222 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -42,6 +42,7 @@
#include <sys/arc.h>
#include <sys/zil.h>
#include <sys/dsl_scan.h>
+#include <sys/zvol.h>
/*
* Virtual device management.
@@ -1074,27 +1075,20 @@ vdev_open_child(void *arg)
vd->vdev_open_thread = NULL;
}
-boolean_t
+static boolean_t
vdev_uses_zvols(vdev_t *vd)
{
-/*
- * Stacking zpools on top of zvols is unsupported until we implement a method
- * for determining if an arbitrary block device is a zvol without using the
- * path. Solaris would check the 'zvol' path component but this does not
- * exist in the Linux port, so we really should do something like stat the
- * file and check the major number. This is complicated by the fact that
- * we need to do this portably in user or kernel space.
- */
-#if 0
int c;
- if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
- strlen(ZVOL_DIR)) == 0)
+#ifdef _KERNEL
+ if (zvol_is_zvol(vd->vdev_path))
return (B_TRUE);
+#endif
+
for (c = 0; c < vd->vdev_children; c++)
if (vdev_uses_zvols(vd->vdev_child[c]))
return (B_TRUE);
-#endif
+
return (B_FALSE);
}