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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dbuf.c
          +++ new/usr/src/uts/common/fs/zfs/dbuf.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24      - * Copyright (c) 2013 by Delphix. All rights reserved.
       24 + * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  25   25   * Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
  26   26   * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  27   27   */
  28   28  
  29   29  #include <sys/zfs_context.h>
  30   30  #include <sys/dmu.h>
  31   31  #include <sys/dmu_send.h>
  32   32  #include <sys/dmu_impl.h>
  33   33  #include <sys/dbuf.h>
  34   34  #include <sys/dmu_objset.h>
  35   35  #include <sys/dsl_dataset.h>
  36   36  #include <sys/dsl_dir.h>
  37   37  #include <sys/dmu_tx.h>
  38   38  #include <sys/spa.h>
  39   39  #include <sys/zio.h>
  40   40  #include <sys/dmu_zfetch.h>
  41   41  #include <sys/sa.h>
  42   42  #include <sys/sa_impl.h>
       43 +#include <sys/range_tree.h>
  43   44  
  44   45  /*
  45   46   * Number of times that zfs_free_range() took the slow path while doing
  46   47   * a zfs receive.  A nonzero value indicates a potential performance problem.
  47   48   */
  48   49  uint64_t zfs_free_range_recv_miss;
  49   50  
  50   51  static void dbuf_destroy(dmu_buf_impl_t *db);
  51   52  static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
  52   53  static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx);
↓ open down ↓ 1117 lines elided ↑ open up ↑
1170 1171          *drp = dr;
1171 1172  
1172 1173          /*
1173 1174           * We could have been freed_in_flight between the dbuf_noread
1174 1175           * and dbuf_dirty.  We win, as though the dbuf_noread() had
1175 1176           * happened after the free.
1176 1177           */
1177 1178          if (db->db_level == 0 && db->db_blkid != DMU_BONUS_BLKID &&
1178 1179              db->db_blkid != DMU_SPILL_BLKID) {
1179 1180                  mutex_enter(&dn->dn_mtx);
1180      -                dnode_clear_range(dn, db->db_blkid, 1, tx);
     1181 +                if (dn->dn_free_ranges[txgoff] != NULL) {
     1182 +                        range_tree_clear(dn->dn_free_ranges[txgoff],
     1183 +                            db->db_blkid, 1);
     1184 +                }
1181 1185                  mutex_exit(&dn->dn_mtx);
1182 1186                  db->db_freed_in_flight = FALSE;
1183 1187          }
1184 1188  
1185 1189          /*
1186 1190           * This buffer is now part of this txg
1187 1191           */
1188 1192          dbuf_add_ref(db, (void *)(uintptr_t)tx->tx_txg);
1189 1193          db->db_dirtycnt += 1;
1190 1194          ASSERT3U(db->db_dirtycnt, <=, 3);
↓ open down ↓ 1583 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX