Print this page
4374 dn_free_ranges should use range_tree_t
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2013 by Delphix. All rights reserved.
  25  */
  26 
  27 #include <stdio.h>
  28 #include <unistd.h>
  29 #include <stdio_ext.h>
  30 #include <stdlib.h>
  31 #include <ctype.h>
  32 #include <sys/zfs_context.h>
  33 #include <sys/spa.h>
  34 #include <sys/spa_impl.h>
  35 #include <sys/dmu.h>
  36 #include <sys/zap.h>
  37 #include <sys/fs/zfs.h>
  38 #include <sys/zfs_znode.h>
  39 #include <sys/zfs_sa.h>
  40 #include <sys/sa.h>
  41 #include <sys/sa_impl.h>
  42 #include <sys/vdev.h>
  43 #include <sys/vdev_impl.h>
  44 #include <sys/metaslab_impl.h>


2732         (void) traverse_pool(spa, 0, TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA,
2733             zdb_ddt_add_cb, &t);
2734 
2735         spa_config_exit(spa, SCL_CONFIG, FTAG);
2736 
2737         while ((zdde = avl_destroy_nodes(&t, &cookie)) != NULL) {
2738                 ddt_stat_t dds;
2739                 uint64_t refcnt = zdde->zdde_ref_blocks;
2740                 ASSERT(refcnt != 0);
2741 
2742                 dds.dds_blocks = zdde->zdde_ref_blocks / refcnt;
2743                 dds.dds_lsize = zdde->zdde_ref_lsize / refcnt;
2744                 dds.dds_psize = zdde->zdde_ref_psize / refcnt;
2745                 dds.dds_dsize = zdde->zdde_ref_dsize / refcnt;
2746 
2747                 dds.dds_ref_blocks = zdde->zdde_ref_blocks;
2748                 dds.dds_ref_lsize = zdde->zdde_ref_lsize;
2749                 dds.dds_ref_psize = zdde->zdde_ref_psize;
2750                 dds.dds_ref_dsize = zdde->zdde_ref_dsize;
2751 
2752                 ddt_stat_add(&ddh_total.ddh_stat[highbit(refcnt) - 1], &dds, 0);

2753 
2754                 umem_free(zdde, sizeof (*zdde));
2755         }
2756 
2757         avl_destroy(&t);
2758 
2759         ddt_histogram_stat(&dds_total, &ddh_total);
2760 
2761         (void) printf("Simulated DDT histogram:\n");
2762 
2763         zpool_dump_ddt(&dds_total, &ddh_total);
2764 
2765         dump_dedup_ratio(&dds_total);
2766 }
2767 
2768 static void
2769 dump_zpool(spa_t *spa)
2770 {
2771         dsl_pool_t *dp = spa_get_dsl(spa);
2772         int rc = 0;




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  25  */
  26 
  27 #include <stdio.h>
  28 #include <unistd.h>
  29 #include <stdio_ext.h>
  30 #include <stdlib.h>
  31 #include <ctype.h>
  32 #include <sys/zfs_context.h>
  33 #include <sys/spa.h>
  34 #include <sys/spa_impl.h>
  35 #include <sys/dmu.h>
  36 #include <sys/zap.h>
  37 #include <sys/fs/zfs.h>
  38 #include <sys/zfs_znode.h>
  39 #include <sys/zfs_sa.h>
  40 #include <sys/sa.h>
  41 #include <sys/sa_impl.h>
  42 #include <sys/vdev.h>
  43 #include <sys/vdev_impl.h>
  44 #include <sys/metaslab_impl.h>


2732         (void) traverse_pool(spa, 0, TRAVERSE_PRE | TRAVERSE_PREFETCH_METADATA,
2733             zdb_ddt_add_cb, &t);
2734 
2735         spa_config_exit(spa, SCL_CONFIG, FTAG);
2736 
2737         while ((zdde = avl_destroy_nodes(&t, &cookie)) != NULL) {
2738                 ddt_stat_t dds;
2739                 uint64_t refcnt = zdde->zdde_ref_blocks;
2740                 ASSERT(refcnt != 0);
2741 
2742                 dds.dds_blocks = zdde->zdde_ref_blocks / refcnt;
2743                 dds.dds_lsize = zdde->zdde_ref_lsize / refcnt;
2744                 dds.dds_psize = zdde->zdde_ref_psize / refcnt;
2745                 dds.dds_dsize = zdde->zdde_ref_dsize / refcnt;
2746 
2747                 dds.dds_ref_blocks = zdde->zdde_ref_blocks;
2748                 dds.dds_ref_lsize = zdde->zdde_ref_lsize;
2749                 dds.dds_ref_psize = zdde->zdde_ref_psize;
2750                 dds.dds_ref_dsize = zdde->zdde_ref_dsize;
2751 
2752                 ddt_stat_add(&ddh_total.ddh_stat[highbit64(refcnt) - 1],
2753                     &dds, 0);
2754 
2755                 umem_free(zdde, sizeof (*zdde));
2756         }
2757 
2758         avl_destroy(&t);
2759 
2760         ddt_histogram_stat(&dds_total, &ddh_total);
2761 
2762         (void) printf("Simulated DDT histogram:\n");
2763 
2764         zpool_dump_ddt(&dds_total, &ddh_total);
2765 
2766         dump_dedup_ratio(&dds_total);
2767 }
2768 
2769 static void
2770 dump_zpool(spa_t *spa)
2771 {
2772         dsl_pool_t *dp = spa_get_dsl(spa);
2773         int rc = 0;