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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zdb/zdb.c
          +++ new/usr/src/cmd/zdb/zdb.c
↓ open down ↓ 49 lines elided ↑ open up ↑
  50   50  #include <sys/zil_impl.h>
  51   51  #include <sys/stat.h>
  52   52  #include <sys/resource.h>
  53   53  #include <sys/dmu_traverse.h>
  54   54  #include <sys/zio_checksum.h>
  55   55  #include <sys/zio_compress.h>
  56   56  #include <sys/zfs_fuid.h>
  57   57  #include <sys/arc.h>
  58   58  #include <sys/ddt.h>
  59   59  #include <sys/zfeature.h>
       60 +#include <zfs_comutil.h>
  60   61  #undef ZFS_MAXNAMELEN
  61   62  #undef verify
  62   63  #include <libzfs.h>
  63   64  
  64   65  #define ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \
  65   66      zio_compress_table[(idx)].ci_name : "UNKNOWN")
  66   67  #define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \
  67   68      zio_checksum_table[(idx)].ci_name : "UNKNOWN")
  68   69  #define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \
  69   70      dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
↓ open down ↓ 127 lines elided ↑ open up ↑
 197  198  
 198  199          VERIFY(nvlist_unpack(packed, nvsize, &nv, 0) == 0);
 199  200  
 200  201          umem_free(packed, nvsize);
 201  202  
 202  203          dump_nvlist(nv, 8);
 203  204  
 204  205          nvlist_free(nv);
 205  206  }
 206  207  
      208 +/* ARGSUSED */
      209 +static void
      210 +dump_history_offsets(objset_t *os, uint64_t object, void *data, size_t size)
      211 +{
      212 +        spa_history_phys_t *shp = data;
      213 +
      214 +        if (shp == NULL)
      215 +                return;
      216 +
      217 +        (void) printf("\t\tpool_create_len = %llu\n",
      218 +            (u_longlong_t)shp->sh_pool_create_len);
      219 +        (void) printf("\t\tphys_max_off = %llu\n",
      220 +            (u_longlong_t)shp->sh_phys_max_off);
      221 +        (void) printf("\t\tbof = %llu\n",
      222 +            (u_longlong_t)shp->sh_bof);
      223 +        (void) printf("\t\teof = %llu\n",
      224 +            (u_longlong_t)shp->sh_eof);
      225 +        (void) printf("\t\trecords_lost = %llu\n",
      226 +            (u_longlong_t)shp->sh_records_lost);
      227 +}
      228 +
 207  229  static void
 208  230  zdb_nicenum(uint64_t num, char *buf)
 209  231  {
 210  232          if (dump_opt['P'])
 211  233                  (void) sprintf(buf, "%llu", (longlong_t)num);
 212  234          else
 213  235                  nicenum(num, buf);
 214  236  }
 215  237  
 216  238  const char dump_zap_stars[] = "****************************************";
↓ open down ↓ 629 lines elided ↑ open up ↑
 846  868                  if (zpool_history_unpack(buf, len, &resid, &events, &num) != 0)
 847  869                          break;
 848  870  
 849  871                  off -= resid;
 850  872          } while (len != 0);
 851  873  
 852  874          (void) printf("\nHistory:\n");
 853  875          for (int i = 0; i < num; i++) {
 854  876                  uint64_t time, txg, ievent;
 855  877                  char *cmd, *intstr;
      878 +                boolean_t printed = B_FALSE;
 856  879  
 857  880                  if (nvlist_lookup_uint64(events[i], ZPOOL_HIST_TIME,
 858  881                      &time) != 0)
 859      -                        continue;
      882 +                        goto next;
 860  883                  if (nvlist_lookup_string(events[i], ZPOOL_HIST_CMD,
 861  884                      &cmd) != 0) {
 862  885                          if (nvlist_lookup_uint64(events[i],
 863  886                              ZPOOL_HIST_INT_EVENT, &ievent) != 0)
 864      -                                continue;
      887 +                                goto next;
 865  888                          verify(nvlist_lookup_uint64(events[i],
 866  889                              ZPOOL_HIST_TXG, &txg) == 0);
 867  890                          verify(nvlist_lookup_string(events[i],
 868  891                              ZPOOL_HIST_INT_STR, &intstr) == 0);
 869      -                        if (ievent >= LOG_END)
 870      -                                continue;
      892 +                        if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS)
      893 +                                goto next;
 871  894  
 872  895                          (void) snprintf(internalstr,
 873  896                              sizeof (internalstr),
 874  897                              "[internal %s txg:%lld] %s",
 875  898                              zfs_history_event_names[ievent], txg,
 876  899                              intstr);
 877  900                          cmd = internalstr;
 878  901                  }
 879  902                  tsec = time;
 880  903                  (void) localtime_r(&tsec, &t);
 881  904                  (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t);
 882  905                  (void) printf("%s %s\n", tbuf, cmd);
      906 +                printed = B_TRUE;
      907 +
      908 +next:
      909 +                if (dump_opt['h'] > 1) {
      910 +                        if (!printed)
      911 +                                (void) printf("unrecognized record:\n");
      912 +                        dump_nvlist(events[i], 2);
      913 +                }
 883  914          }
 884  915  }
 885  916  
 886  917  /*ARGSUSED*/
 887  918  static void
 888  919  dump_dnode(objset_t *os, uint64_t object, void *data, size_t size)
 889  920  {
 890  921  }
 891  922  
 892  923  static uint64_t
↓ open down ↓ 556 lines elided ↑ open up ↑
1449 1480          dump_zpldir,            /* ZFS directory                */
1450 1481          dump_zap,               /* ZFS master node              */
1451 1482          dump_zap,               /* ZFS delete queue             */
1452 1483          dump_uint8,             /* zvol object                  */
1453 1484          dump_zap,               /* zvol prop                    */
1454 1485          dump_uint8,             /* other uint8[]                */
1455 1486          dump_uint64,            /* other uint64[]               */
1456 1487          dump_zap,               /* other ZAP                    */
1457 1488          dump_zap,               /* persistent error log         */
1458 1489          dump_uint8,             /* SPA history                  */
1459      -        dump_uint64,            /* SPA history offsets          */
     1490 +        dump_history_offsets,   /* SPA history offsets          */
1460 1491          dump_zap,               /* Pool properties              */
1461 1492          dump_zap,               /* DSL permissions              */
1462 1493          dump_acl,               /* ZFS ACL                      */
1463 1494          dump_uint8,             /* ZFS SYSACL                   */
1464 1495          dump_none,              /* FUID nvlist                  */
1465 1496          dump_packed_nvlist,     /* FUID nvlist size             */
1466 1497          dump_zap,               /* DSL dataset next clones      */
1467 1498          dump_zap,               /* DSL scrub queue              */
1468 1499          dump_zap,               /* ZFS user/group used          */
1469 1500          dump_zap,               /* ZFS user/group quota         */
↓ open down ↓ 1750 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX