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>

@@ -55,10 +55,11 @@
 #include <sys/zio_compress.h>
 #include <sys/zfs_fuid.h>
 #include <sys/arc.h>
 #include <sys/ddt.h>
 #include <sys/zfeature.h>
+#include <zfs_comutil.h>
 #undef ZFS_MAXNAMELEN
 #undef verify
 #include <libzfs.h>
 
 #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \

@@ -202,10 +203,31 @@
         dump_nvlist(nv, 8);
 
         nvlist_free(nv);
 }
 
+/* ARGSUSED */
+static void
+dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size)
+{
+        spa_history_phys_t *shp = data;
+
+        if (shp == NULL)
+                return;
+
+        (void) printf("\t\tpool_create_len = %llu\n",
+            (u_longlong_t)shp->sh_pool_create_len);
+        (void) printf("\t\tphys_max_off = %llu\n",
+            (u_longlong_t)shp->sh_phys_max_off);
+        (void) printf("\t\tbof = %llu\n",
+            (u_longlong_t)shp->sh_bof);
+        (void) printf("\t\teof = %llu\n",
+            (u_longlong_t)shp->sh_eof);
+        (void) printf("\t\trecords_lost = %llu\n",
+            (u_longlong_t)shp->sh_records_lost);
+}
+
 static void
 zdb_nicenum(uint64_t num, char *buf)
 {
         if (dump_opt['P'])
                 (void) sprintf(buf, "%llu", (longlong_t)num);

@@ -851,25 +873,26 @@
 
         (void) printf("\nHistory:\n");
         for (int i = 0; i < num; i++) {
                 uint64_t time, txg, ievent;
                 char *cmd, *intstr;
+                boolean_t printed = B_FALSE;
 
                 if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME,
                     &time) != 0)
-                        continue;
+                        goto next;
                 if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD,
                     &cmd) != 0) {
                         if (nvlist_lookup_uint64(events[i],
                             ZPOOL_HIST_INT_EVENT, &ievent) != 0)
-                                continue;
+                                goto next;
                         verify(nvlist_lookup_uint64(events[i],
                             ZPOOL_HIST_TXG, &txg) == 0);
                         verify(nvlist_lookup_string(events[i],
                             ZPOOL_HIST_INT_STR, &intstr) == 0);
-                        if (ievent >= LOG_END)
-                                continue;
+                        if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS)
+                                goto next;
 
                         (void) snprintf(internalstr,
                             sizeof (internalstr),
                             "[internal %s txg:%lld] %s",
                             zfs_history_event_names[ievent], txg,

@@ -878,10 +901,18 @@
                 }
                 tsec = time;
                 (void) localtime_r(&tsec, &t);
                 (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t);
                 (void) printf("%s %s\n", tbuf, cmd);
+                printed = B_TRUE;
+
+next:
+                if (dump_opt['h'] > 1) {
+                        if (!printed)
+                                (void) printf("unrecognized record:\n");
+                        dump_nvlist(events[i], 2);
+                }
         }
 }
 
 /*ARGSUSED*/
 static void

@@ -1454,11 +1485,11 @@
         dump_uint8,             /* other uint8[]                */
         dump_uint64,            /* other uint64[]               */
         dump_zap,               /* other ZAP                    */
         dump_zap,               /* persistent error log         */
         dump_uint8,             /* SPA history                  */
-        dump_uint64,            /* SPA history offsets          */
+        dump_history_offsets,   /* SPA history offsets          */
         dump_zap,               /* Pool properties              */
         dump_zap,               /* DSL permissions              */
         dump_acl,               /* ZFS ACL                      */
         dump_uint8,             /* ZFS SYSACL                   */
         dump_none,              /* FUID nvlist                  */