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/zap_leaf.c
          +++ new/usr/src/uts/common/fs/zfs/zap_leaf.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  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      - * Copyright (c) 2013 by Delphix. All rights reserved.
       23 + * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
  24   24   */
  25   25  
  26   26  /*
  27   27   * The 512-byte leaf is broken into 32 16-byte chunks.
  28   28   * chunk number n means l_chunk[n], even though the header precedes it.
  29   29   * the names are stored null-terminated.
  30   30   */
  31   31  
  32   32  #include <sys/zio.h>
  33   33  #include <sys/spa.h>
↓ open down ↓ 64 lines elided ↑ open up ↑
  98   98          }
  99   99          ASSERT(!"bad int len");
 100  100          return (0xFEEDFACEDEADBEEFULL);
 101  101  }
 102  102  
 103  103  void
 104  104  zap_leaf_byteswap(zap_leaf_phys_t *buf, int size)
 105  105  {
 106  106          int i;
 107  107          zap_leaf_t l;
 108      -        l.l_bs = highbit(size)-1;
      108 +        l.l_bs = highbit64(size) - 1;
 109  109          l.l_phys = buf;
 110  110  
 111      -        buf->l_hdr.lh_block_type =      BSWAP_64(buf->l_hdr.lh_block_type);
 112      -        buf->l_hdr.lh_prefix =          BSWAP_64(buf->l_hdr.lh_prefix);
 113      -        buf->l_hdr.lh_magic =           BSWAP_32(buf->l_hdr.lh_magic);
 114      -        buf->l_hdr.lh_nfree =           BSWAP_16(buf->l_hdr.lh_nfree);
 115      -        buf->l_hdr.lh_nentries =        BSWAP_16(buf->l_hdr.lh_nentries);
 116      -        buf->l_hdr.lh_prefix_len =      BSWAP_16(buf->l_hdr.lh_prefix_len);
 117      -        buf->l_hdr.lh_freelist =        BSWAP_16(buf->l_hdr.lh_freelist);
      111 +        buf->l_hdr.lh_block_type =      BSWAP_64(buf->l_hdr.lh_block_type);
      112 +        buf->l_hdr.lh_prefix =          BSWAP_64(buf->l_hdr.lh_prefix);
      113 +        buf->l_hdr.lh_magic =           BSWAP_32(buf->l_hdr.lh_magic);
      114 +        buf->l_hdr.lh_nfree =           BSWAP_16(buf->l_hdr.lh_nfree);
      115 +        buf->l_hdr.lh_nentries =        BSWAP_16(buf->l_hdr.lh_nentries);
      116 +        buf->l_hdr.lh_prefix_len =      BSWAP_16(buf->l_hdr.lh_prefix_len);
      117 +        buf->l_hdr.lh_freelist =        BSWAP_16(buf->l_hdr.lh_freelist);
 118  118  
 119  119          for (i = 0; i < ZAP_LEAF_HASH_NUMENTRIES(&l); i++)
 120  120                  buf->l_hash[i] = BSWAP_16(buf->l_hash[i]);
 121  121  
 122  122          for (i = 0; i < ZAP_LEAF_NUMCHUNKS(&l); i++) {
 123  123                  zap_leaf_chunk_t *lc = &ZAP_LEAF_CHUNK(&l, i);
 124  124                  struct zap_leaf_entry *le;
 125  125  
 126  126                  switch (lc->l_free.lf_type) {
 127  127                  case ZAP_CHUNK_ENTRY:
↓ open down ↓ 22 lines elided ↑ open up ↑
 150  150                          ASSERT(!"bad leaf type");
 151  151                  }
 152  152          }
 153  153  }
 154  154  
 155  155  void
 156  156  zap_leaf_init(zap_leaf_t *l, boolean_t sort)
 157  157  {
 158  158          int i;
 159  159  
 160      -        l->l_bs = highbit(l->l_dbuf->db_size)-1;
      160 +        l->l_bs = highbit64(l->l_dbuf->db_size) - 1;
 161  161          zap_memset(&l->l_phys->l_hdr, 0, sizeof (struct zap_leaf_header));
 162  162          zap_memset(l->l_phys->l_hash, CHAIN_END, 2*ZAP_LEAF_HASH_NUMENTRIES(l));
 163  163          for (i = 0; i < ZAP_LEAF_NUMCHUNKS(l); i++) {
 164  164                  ZAP_LEAF_CHUNK(l, i).l_free.lf_type = ZAP_CHUNK_FREE;
 165  165                  ZAP_LEAF_CHUNK(l, i).l_free.lf_next = i+1;
 166  166          }
 167  167          ZAP_LEAF_CHUNK(l, ZAP_LEAF_NUMCHUNKS(l)-1).l_free.lf_next = CHAIN_END;
 168  168          l->l_phys->l_hdr.lh_block_type = ZBT_LEAF;
 169  169          l->l_phys->l_hdr.lh_magic = ZAP_LEAF_MAGIC;
 170  170          l->l_phys->l_hdr.lh_nfree = ZAP_LEAF_NUMCHUNKS(l);
↓ open down ↓ 703 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX