Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zdb/zdb.c
          +++ new/usr/src/cmd/zdb/zdb.c
↓ open down ↓ 46 lines elided ↑ open up ↑
  47   47  #include <sys/stat.h>
  48   48  #include <sys/resource.h>
  49   49  #include <sys/dmu_traverse.h>
  50   50  #include <sys/zio_checksum.h>
  51   51  #include <sys/zio_compress.h>
  52   52  #include <sys/zfs_fuid.h>
  53   53  #include <sys/arc.h>
  54   54  #undef ZFS_MAXNAMELEN
  55   55  #undef verify
  56   56  #include <libzfs.h>
       57 +#include <sys/zio_crypt.h>
  57   58  
  58   59  const char cmdname[] = "zdb";
  59   60  uint8_t dump_opt[256];
  60   61  
  61   62  typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
  62   63  
  63   64  extern void dump_intent_log(zilog_t *);
  64   65  uint64_t *zopt_object = NULL;
  65   66  int zopt_objects = 0;
  66   67  libzfs_handle_t *g_zfs;
  67   68  boolean_t zdb_sig_user_data = B_TRUE;
  68      -int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256;
       69 +int zdb_sig_cksumalg = ZIO_CHECKSUM_FUNCTIONS - 1;
  69   70  
  70   71  /*
  71   72   * These libumem hooks provide a reasonable set of defaults for the allocator's
  72   73   * debugging facilities.
  73   74   */
  74   75  const char *
  75   76  _umem_debug_init()
  76   77  {
  77   78          return ("default,verbose"); /* $UMEM_DEBUG setting */
  78   79  }
↓ open down ↓ 986 lines elided ↑ open up ↑
1065 1066          if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) {
1066 1067                  (void) snprintf(aux + strlen(aux), sizeof (aux), " (K=%s)",
1067 1068                      zio_checksum_table[doi.doi_checksum].ci_name);
1068 1069          }
1069 1070  
1070 1071          if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) {
1071 1072                  (void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)",
1072 1073                      zio_compress_table[doi.doi_compress].ci_name);
1073 1074          }
1074 1075  
     1076 +        if (doi.doi_crypt != ZIO_CRYPT_INHERIT || verbosity >= 6) {
     1077 +                (void) snprintf(aux + strlen(aux), sizeof (aux), " (E=%s)",
     1078 +                    zio_crypt_table[doi.doi_crypt].ci_name);
     1079 +        }
     1080 +
1075 1081          (void) printf("%10lld  %3u  %5s  %5s  %5s  %5s  %s%s\n",
1076 1082              (u_longlong_t)object, doi.doi_indirection, iblk, dblk, lsize,
1077 1083              asize, dmu_ot[doi.doi_type].ot_name, aux);
1078 1084  
1079 1085          if (doi.doi_bonus_type != DMU_OT_NONE && verbosity > 3) {
1080 1086                  (void) printf("%10s  %3s  %5s  %5s  %5s  %5s  %s\n",
1081 1087                      "", "", "", "", bonus_size, "bonus",
1082 1088                      dmu_ot[doi.doi_bonus_type].ot_name);
1083 1089          }
1084 1090  
↓ open down ↓ 387 lines elided ↑ open up ↑
1472 1478          if (dump_opt['S']) {
1473 1479                  boolean_t print_sig;
1474 1480  
1475 1481                  print_sig = !zdb_sig_user_data || (BP_GET_LEVEL(bp) == 0 &&
1476 1482                      BP_GET_TYPE(bp) == DMU_OT_PLAIN_FILE_CONTENTS);
1477 1483  
1478 1484                  if (BP_GET_CHECKSUM(bp) < zdb_sig_cksumalg)
1479 1485                          print_sig = B_FALSE;
1480 1486  
1481 1487                  if (print_sig) {
1482      -                        (void) printf("%llu\t%lld\t%lld\t%s\t%s\t%s\t"
     1488 +                        (void) printf("%llu\t%lld\t%lld\t%s\t%s\t%s\t%s\t"
1483 1489                              "%llx:%llx:%llx:%llx\n",
1484 1490                              (u_longlong_t)BP_GET_LEVEL(bp),
1485 1491                              (longlong_t)BP_GET_PSIZE(bp),
1486 1492                              (longlong_t)BP_GET_NDVAS(bp),
1487 1493                              dmu_ot[BP_GET_TYPE(bp)].ot_name,
1488 1494                              zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name,
1489 1495                              zio_compress_table[BP_GET_COMPRESS(bp)].ci_name,
     1496 +                            zio_crypt_table[BP_GET_CRYPT(bp)].ci_name,
1490 1497                              (u_longlong_t)bp->blk_cksum.zc_word[0],
1491 1498                              (u_longlong_t)bp->blk_cksum.zc_word[1],
1492 1499                              (u_longlong_t)bp->blk_cksum.zc_word[2],
1493 1500                              (u_longlong_t)bp->blk_cksum.zc_word[3]);
1494 1501                  }
1495 1502          }
1496 1503  
1497 1504          if (!dump_opt['L'])
1498 1505                  VERIFY(zio_wait(zio_claim(NULL, spa, spa_first_txg(spa), bp,
1499 1506                      NULL, NULL, ZIO_FLAG_MUSTSUCCEED)) == 0);
↓ open down ↓ 338 lines elided ↑ open up ↑
1838 1845                      BP_GET_COMPRESS(bp) != 0 ? "d" : "");
1839 1846          }
1840 1847          (void) printf("\tLSIZE:  %-16llx\t\tPSIZE: %llx\n",
1841 1848              (longlong_t)BP_GET_LSIZE(bp), (longlong_t)BP_GET_PSIZE(bp));
1842 1849          (void) printf("\tENDIAN: %6s\t\t\t\t\tTYPE:  %s\n",
1843 1850              BP_GET_BYTEORDER(bp) ? "LITTLE" : "BIG",
1844 1851              dmu_ot[BP_GET_TYPE(bp)].ot_name);
1845 1852          (void) printf("\tBIRTH:  %-16llx   LEVEL: %-2llu\tFILL:  %llx\n",
1846 1853              (u_longlong_t)bp->blk_birth, (u_longlong_t)BP_GET_LEVEL(bp),
1847 1854              (u_longlong_t)bp->blk_fill);
1848      -        (void) printf("\tCKFUNC: %-16s\t\tCOMP:  %s\n",
     1855 +        (void) printf("\tCKFUNC: %-16s\t\tCOMP:  %s\t\tCRYPT:  %s\n",
1849 1856              zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name,
1850      -            zio_compress_table[BP_GET_COMPRESS(bp)].ci_name);
     1857 +            zio_compress_table[BP_GET_COMPRESS(bp)].ci_name,
     1858 +            zio_crypt_table[BP_GET_CRYPT(bp)].ci_name);
1851 1859          (void) printf("\tCKSUM:  %llx:%llx:%llx:%llx\n",
1852 1860              (u_longlong_t)bp->blk_cksum.zc_word[0],
1853 1861              (u_longlong_t)bp->blk_cksum.zc_word[1],
1854 1862              (u_longlong_t)bp->blk_cksum.zc_word[2],
1855 1863              (u_longlong_t)bp->blk_cksum.zc_word[3]);
1856 1864  }
1857 1865  
1858 1866  static void
1859 1867  zdb_dump_indirect(blkptr_t *bp, int nbps, int flags)
1860 1868  {
↓ open down ↓ 429 lines elided ↑ open up ↑
2290 2298                          zdb_sig_user_data = (strncmp(optarg, "user:", 5) == 0);
2291 2299                          if (!zdb_sig_user_data && strncmp(optarg, "all:", 4))
2292 2300                                  usage();
2293 2301                          endstr = strchr(optarg, ':') + 1;
2294 2302                          if (strcmp(endstr, "fletcher2") == 0)
2295 2303                                  zdb_sig_cksumalg = ZIO_CHECKSUM_FLETCHER_2;
2296 2304                          else if (strcmp(endstr, "fletcher4") == 0)
2297 2305                                  zdb_sig_cksumalg = ZIO_CHECKSUM_FLETCHER_4;
2298 2306                          else if (strcmp(endstr, "sha256") == 0)
2299 2307                                  zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256;
     2308 +                        else if (strcmp(endstr, "sha256+mac") == 0)
     2309 +                                zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256_MAC;
2300 2310                          else if (strcmp(endstr, "all") == 0)
2301 2311                                  zdb_sig_cksumalg = ZIO_CHECKSUM_FLETCHER_2;
2302 2312                          else
2303 2313                                  usage();
2304 2314                          break;
2305 2315                  case 't':
2306 2316                          ub_max_txg = strtoull(optarg, NULL, 0);
2307 2317                          if (ub_max_txg < TXG_INITIAL) {
2308 2318                                  (void) fprintf(stderr, "incorrect txg "
2309 2319                                      "specified: %s\n", optarg);
↓ open down ↓ 140 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX