diff usr/src/uts/common/fs/zfs/spa.c @ 4527:5d5b6ba91b17

PSARC 2007/171 ZFS Separate Intent Log 6339640 Make ZIL use NVRAM when available.
author perrin
date Fri, 22 Jun 2007 20:02:13 -0700
parents 24fbf2d7a5d7
children 12bb2876a62e
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/spa.c	Fri Jun 22 19:47:09 2007 -0700
+++ b/usr/src/uts/common/fs/zfs/spa.c	Fri Jun 22 20:02:13 2007 -0700
@@ -119,6 +119,7 @@
 	spa->spa_state = POOL_STATE_ACTIVE;
 
 	spa->spa_normal_class = metaslab_class_create();
+	spa->spa_log_class = metaslab_class_create();
 
 	for (t = 0; t < ZIO_TYPES; t++) {
 		spa->spa_zio_issue_taskq[t] = taskq_create("spa_zio_issue",
@@ -185,6 +186,9 @@
 	metaslab_class_destroy(spa->spa_normal_class);
 	spa->spa_normal_class = NULL;
 
+	metaslab_class_destroy(spa->spa_log_class);
+	spa->spa_log_class = NULL;
+
 	/*
 	 * If this was part of an import or the open otherwise failed, we may
 	 * still have errors left in the queues.  Empty them just in case.
@@ -1565,7 +1569,7 @@
  */
 
 /*
- * Add capacity to a storage pool.
+ * Add a device to a storage pool.
  */
 int
 spa_vdev_add(spa_t *spa, nvlist_t *nvroot)
@@ -1707,6 +1711,7 @@
 	vdev_t *rvd = spa->spa_root_vdev;
 	vdev_t *oldvd, *newvd, *newrootvd, *pvd, *tvd;
 	vdev_ops_t *pvops;
+	int is_log;
 
 	txg = spa_vdev_enter(spa);
 
@@ -1735,6 +1740,13 @@
 	if ((error = vdev_create(newrootvd, txg, replacing)) != 0)
 		return (spa_vdev_exit(spa, newrootvd, txg, error));
 
+	/*
+	 * Spares can't replace logs
+	 */
+	is_log = oldvd->vdev_islog;
+	if (is_log && newvd->vdev_isspare)
+		return (spa_vdev_exit(spa, newrootvd, txg, ENOTSUP));
+
 	if (!replacing) {
 		/*
 		 * For attach, the only allowable parent is a mirror or the root