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>


   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 2011 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright (c) 2013 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/zfs_context.h>
  29 #include <sys/fm/fs/zfs.h>
  30 #include <sys/spa.h>
  31 #include <sys/spa_impl.h>
  32 #include <sys/dmu.h>
  33 #include <sys/dmu_tx.h>
  34 #include <sys/vdev_impl.h>
  35 #include <sys/uberblock_impl.h>
  36 #include <sys/metaslab.h>
  37 #include <sys/metaslab_impl.h>
  38 #include <sys/space_map.h>
  39 #include <sys/space_reftree.h>
  40 #include <sys/zio.h>
  41 #include <sys/zap.h>
  42 #include <sys/fs/zfs.h>
  43 #include <sys/arc.h>
  44 #include <sys/zil.h>
  45 #include <sys/dsl_scan.h>


1536 
1537         /*
1538          * Recursively load DTLs and initialize all labels.
1539          */
1540         if ((error = vdev_dtl_load(vd)) != 0 ||
1541             (error = vdev_label_init(vd, txg, isreplacing ?
1542             VDEV_LABEL_REPLACE : VDEV_LABEL_CREATE)) != 0) {
1543                 vdev_close(vd);
1544                 return (error);
1545         }
1546 
1547         return (0);
1548 }
1549 
1550 void
1551 vdev_metaslab_set_size(vdev_t *vd)
1552 {
1553         /*
1554          * Aim for roughly 200 metaslabs per vdev.
1555          */
1556         vd->vdev_ms_shift = highbit(vd->vdev_asize / 200);
1557         vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT);
1558 }
1559 
1560 void
1561 vdev_dirty(vdev_t *vd, int flags, void *arg, uint64_t txg)
1562 {
1563         ASSERT(vd == vd->vdev_top);
1564         ASSERT(!vd->vdev_ishole);
1565         ASSERT(ISP2(flags));
1566         ASSERT(spa_writeable(vd->vdev_spa));
1567 
1568         if (flags & VDD_METASLAB)
1569                 (void) txg_list_add(&vd->vdev_ms_list, arg, txg);
1570 
1571         if (flags & VDD_DTL)
1572                 (void) txg_list_add(&vd->vdev_dtl_list, arg, txg);
1573 
1574         (void) txg_list_add(&vd->vdev_spa->spa_vdev_txg_list, vd, txg);
1575 }
1576 




   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 2011 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/zfs_context.h>
  29 #include <sys/fm/fs/zfs.h>
  30 #include <sys/spa.h>
  31 #include <sys/spa_impl.h>
  32 #include <sys/dmu.h>
  33 #include <sys/dmu_tx.h>
  34 #include <sys/vdev_impl.h>
  35 #include <sys/uberblock_impl.h>
  36 #include <sys/metaslab.h>
  37 #include <sys/metaslab_impl.h>
  38 #include <sys/space_map.h>
  39 #include <sys/space_reftree.h>
  40 #include <sys/zio.h>
  41 #include <sys/zap.h>
  42 #include <sys/fs/zfs.h>
  43 #include <sys/arc.h>
  44 #include <sys/zil.h>
  45 #include <sys/dsl_scan.h>


1536 
1537         /*
1538          * Recursively load DTLs and initialize all labels.
1539          */
1540         if ((error = vdev_dtl_load(vd)) != 0 ||
1541             (error = vdev_label_init(vd, txg, isreplacing ?
1542             VDEV_LABEL_REPLACE : VDEV_LABEL_CREATE)) != 0) {
1543                 vdev_close(vd);
1544                 return (error);
1545         }
1546 
1547         return (0);
1548 }
1549 
1550 void
1551 vdev_metaslab_set_size(vdev_t *vd)
1552 {
1553         /*
1554          * Aim for roughly 200 metaslabs per vdev.
1555          */
1556         vd->vdev_ms_shift = highbit64(vd->vdev_asize / 200);
1557         vd->vdev_ms_shift = MAX(vd->vdev_ms_shift, SPA_MAXBLOCKSHIFT);
1558 }
1559 
1560 void
1561 vdev_dirty(vdev_t *vd, int flags, void *arg, uint64_t txg)
1562 {
1563         ASSERT(vd == vd->vdev_top);
1564         ASSERT(!vd->vdev_ishole);
1565         ASSERT(ISP2(flags));
1566         ASSERT(spa_writeable(vd->vdev_spa));
1567 
1568         if (flags & VDD_METASLAB)
1569                 (void) txg_list_add(&vd->vdev_ms_list, arg, txg);
1570 
1571         if (flags & VDD_DTL)
1572                 (void) txg_list_add(&vd->vdev_dtl_list, arg, txg);
1573 
1574         (void) txg_list_add(&vd->vdev_spa->spa_vdev_txg_list, vd, txg);
1575 }
1576