Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>

@@ -2543,10 +2543,16 @@
                 if (!dsl_scan_resilvering(spa->spa_dsl_pool) &&
                     vdev_resilver_needed(rvd, NULL, NULL))
                         spa_async_request(spa, SPA_ASYNC_RESILVER);
 
                 /*
+                 * Log the fact that we booted up (so that we can detect if
+                 * we rebooted in the middle of an operation).
+                 */
+                spa_history_log_version(spa, "open");
+
+                /*
                  * Delete any inconsistent datasets.
                  */
                 (void) dmu_objset_find(spa_name(spa),
                     dsl_destroy_inconsistent, NULL, DS_FIND_CHILDREN);
 

@@ -3218,11 +3224,11 @@
 /*
  * Pool Creation
  */
 int
 spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
-    const char *history_str, nvlist_t *zplprops)
+    nvlist_t *zplprops)
 {
         spa_t *spa;
         char *altroot = NULL;
         vdev_t *rvd;
         dsl_pool_t *dp;

@@ -3437,13 +3443,11 @@
          */
         txg_wait_synced(spa->spa_dsl_pool, txg);
 
         spa_config_sync(spa, B_FALSE, B_TRUE);
 
-        if (version >= SPA_VERSION_ZPOOL_HISTORY && history_str != NULL)
-                (void) spa_history_log(spa, history_str, LOG_CMD_POOL_CREATE);
-        spa_history_log_version(spa, LOG_POOL_CREATE);
+        spa_history_log_version(spa, "create");
 
         spa->spa_minref = refcount_count(&spa->spa_refcount);
 
         mutex_exit(&spa_namespace_lock);
 

@@ -3639,11 +3643,10 @@
                 error = EINVAL;
                 goto out;
         }
 
         error = 0;
-        spa_history_log_version(spa, LOG_POOL_IMPORT);
 out:
         spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER);
         vdev_free(rvd);
         spa_config_exit(spa, SCL_ALL, FTAG);
         mutex_exit(&spa_namespace_lock);

@@ -3701,11 +3704,11 @@
                         spa_configfile_set(spa, props, B_FALSE);
 
                 spa_config_sync(spa, B_FALSE, B_TRUE);
 
                 mutex_exit(&spa_namespace_lock);
-                spa_history_log_version(spa, LOG_POOL_IMPORT);
+                spa_history_log_version(spa, "import");
 
                 return (0);
         }
 
         spa_activate(spa, mode);

@@ -3832,11 +3835,11 @@
          * We kick off an async task to handle this for us.
          */
         spa_async_request(spa, SPA_ASYNC_AUTOEXPAND);
 
         mutex_exit(&spa_namespace_lock);
-        spa_history_log_version(spa, LOG_POOL_IMPORT);
+        spa_history_log_version(spa, "import");
 
         return (0);
 }
 
 nvlist_t *

@@ -4370,11 +4373,11 @@
         /*
          * Commit the config
          */
         (void) spa_vdev_exit(spa, newrootvd, dtl_max_txg, 0);
 
-        spa_history_log_internal(LOG_POOL_VDEV_ATTACH, spa, NULL,
+        spa_history_log_internal(spa, "vdev attach", NULL,
             "%s vdev=%s %s vdev=%s",
             replacing && newvd_isspare ? "spare in" :
             replacing ? "replace" : "attach", newvdpath,
             replacing ? "for" : "to", oldvdpath);
 

@@ -4587,11 +4590,11 @@
         /* hang on to the spa before we release the lock */
         spa_open_ref(spa, FTAG);
 
         error = spa_vdev_exit(spa, vd, txg, 0);
 
-        spa_history_log_internal(LOG_POOL_VDEV_DETACH, spa, NULL,
+        spa_history_log_internal(spa, "detach", NULL,
             "vdev=%s", vdpath);
         spa_strfree(vdpath);
 
         /*
          * If this was the removal of the original device in a hot spare vdev,

@@ -4856,13 +4859,12 @@
                 dmu_tx_abort(tx);
         for (c = 0; c < children; c++) {
                 if (vml[c] != NULL) {
                         vdev_split(vml[c]);
                         if (error == 0)
-                                spa_history_log_internal(LOG_POOL_VDEV_DETACH,
-                                    spa, tx, "vdev=%s",
-                                    vml[c]->vdev_path);
+                                spa_history_log_internal(spa, "detach", tx,
+                                    "vdev=%s", vml[c]->vdev_path);
                         vdev_free(vml[c]);
                 }
         }
         vdev_config_dirty(spa->spa_root_vdev);
         spa->spa_config_splitting = NULL;

@@ -4873,12 +4875,12 @@
 
         if (zio_injection_enabled)
                 zio_handle_panic_injection(spa, FTAG, 3);
 
         /* split is complete; log a history record */
-        spa_history_log_internal(LOG_POOL_SPLIT, newspa, NULL,
-            "split new pool %s from pool %s", newname, spa_name(spa));
+        spa_history_log_internal(newspa, "split", NULL,
+            "from pool %s", spa_name(spa));
 
         kmem_free(vml, children * sizeof (vdev_t *));
 
         /* if we're not going to mount the filesystems in userland, export */
         if (exp)

@@ -5460,12 +5462,11 @@
                 /*
                  * If the pool grew as a result of the config update,
                  * then log an internal history event.
                  */
                 if (new_space != old_space) {
-                        spa_history_log_internal(LOG_POOL_VDEV_ONLINE,
-                            spa, NULL,
+                        spa_history_log_internal(spa, "vdev online", NULL,
                             "pool '%s' size: %llu(+%llu)",
                             spa_name(spa), new_space, new_space - old_space);
                 }
         }
 

@@ -5697,10 +5698,11 @@
         ASSERT(version <= SPA_VERSION);
         ASSERT(version >= spa_version(spa));
 
         spa->spa_uberblock.ub_version = version;
         vdev_config_dirty(spa->spa_root_vdev);
+        spa_history_log_internal(spa, "set", tx, "version=%lld", version);
 }
 
 /*
  * Set zpool properties.
  */

@@ -5731,10 +5733,12 @@
 
                         fname = strchr(nvpair_name(elem), '@') + 1;
                         VERIFY3U(0, ==, zfeature_lookup_name(fname, &feature));
 
                         spa_feature_enable(spa, feature, tx);
+                        spa_history_log_internal(spa, "set", tx,
+                            "%s=enabled", nvpair_name(elem));
                         break;
 
                 case ZPOOL_PROP_VERSION:
                         VERIFY(nvpair_value_uint64(elem, &intval) == 0);
                         /*

@@ -5770,10 +5774,12 @@
                          * to do this for pool creation since the vdev's
                          * configuratoin has already been dirtied.
                          */
                         if (tx->tx_txg != TXG_INITIAL)
                                 vdev_config_dirty(spa->spa_root_vdev);
+                        spa_history_log_internal(spa, "set", tx,
+                            "%s=%s", nvpair_name(elem), strval);
                         break;
                 default:
                         /*
                          * Set pool property values in the poolprops mos object.
                          */

@@ -5792,11 +5798,12 @@
                                 ASSERT(proptype == PROP_TYPE_STRING);
                                 VERIFY(nvpair_value_string(elem, &strval) == 0);
                                 VERIFY(zap_update(mos,
                                     spa->spa_pool_props_object, propname,
                                     1, strlen(strval) + 1, strval, tx) == 0);
-
+                                spa_history_log_internal(spa, "set", tx,
+                                    "%s=%s", nvpair_name(elem), strval);
                         } else if (nvpair_type(elem) == DATA_TYPE_UINT64) {
                                 VERIFY(nvpair_value_uint64(elem, &intval) == 0);
 
                                 if (proptype == PROP_TYPE_INDEX) {
                                         const char *unused;

@@ -5804,10 +5811,12 @@
                                             prop, intval, &unused) == 0);
                                 }
                                 VERIFY(zap_update(mos,
                                     spa->spa_pool_props_object, propname,
                                     8, 1, &intval, tx) == 0);
+                                spa_history_log_internal(spa, "set", tx,
+                                    "%s=%lld", nvpair_name(elem), intval);
                         } else {
                                 ASSERT(0); /* not allowed */
                         }
 
                         switch (prop) {

@@ -5832,17 +5841,10 @@
                         default:
                                 break;
                         }
                 }
 
-                /* log internal history if this is not a zpool create */
-                if (spa_version(spa) >= SPA_VERSION_ZPOOL_HISTORY &&
-                    tx->tx_txg != TXG_INITIAL) {
-                        spa_history_log_internal(LOG_POOL_PROPSET,
-                            spa, tx, "%s %lld %s",
-                            nvpair_name(elem), intval, spa_name(spa));
-                }
         }
 
         mutex_exit(&spa->spa_props_lock);
 }