Deleted Added
full compact
zap_leaf.c (256281) zap_leaf.c (265740)
1/*
2 * CDDL HEADER START
3 *
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

--- 6 unchanged lines hidden (view full) ---

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 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
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

--- 6 unchanged lines hidden (view full) ---

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 * 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 */
25
26/*
27 * The 512-byte leaf is broken into 32 16-byte chunks.
28 * chunk number n means l_chunk[n], even though the header precedes it.
29 * the names are stored null-terminated.
30 */
31

--- 68 unchanged lines hidden (view full) ---

100 return (0xFEEDFACEDEADBEEFULL);
101}
102
103void
104zap_leaf_byteswap(zap_leaf_phys_t *buf, int size)
105{
106 int i;
107 zap_leaf_t l;
24 */
25
26/*
27 * The 512-byte leaf is broken into 32 16-byte chunks.
28 * chunk number n means l_chunk[n], even though the header precedes it.
29 * the names are stored null-terminated.
30 */
31

--- 68 unchanged lines hidden (view full) ---

100 return (0xFEEDFACEDEADBEEFULL);
101}
102
103void
104zap_leaf_byteswap(zap_leaf_phys_t *buf, int size)
105{
106 int i;
107 zap_leaf_t l;
108 l.l_bs = highbit(size)-1;
108 l.l_bs = highbit64(size) - 1;
109 l.l_phys = buf;
110
109 l.l_phys = buf;
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
119 for (i = 0; i < ZAP_LEAF_HASH_NUMENTRIES(&l); i++)
120 buf->l_hash[i] = BSWAP_16(buf->l_hash[i]);
121
122 for (i = 0; i < ZAP_LEAF_NUMCHUNKS(&l); i++) {
123 zap_leaf_chunk_t *lc = &ZAP_LEAF_CHUNK(&l, i);
124 struct zap_leaf_entry *le;
125

--- 26 unchanged lines hidden (view full) ---

152 }
153}
154
155void
156zap_leaf_init(zap_leaf_t *l, boolean_t sort)
157{
158 int i;
159
118
119 for (i = 0; i < ZAP_LEAF_HASH_NUMENTRIES(&l); i++)
120 buf->l_hash[i] = BSWAP_16(buf->l_hash[i]);
121
122 for (i = 0; i < ZAP_LEAF_NUMCHUNKS(&l); i++) {
123 zap_leaf_chunk_t *lc = &ZAP_LEAF_CHUNK(&l, i);
124 struct zap_leaf_entry *le;
125

--- 26 unchanged lines hidden (view full) ---

152 }
153}
154
155void
156zap_leaf_init(zap_leaf_t *l, boolean_t sort)
157{
158 int i;
159
160 l->l_bs = highbit(l->l_dbuf->db_size)-1;
160 l->l_bs = highbit64(l->l_dbuf->db_size) - 1;
161 zap_memset(&l->l_phys->l_hdr, 0, sizeof (struct zap_leaf_header));
162 zap_memset(l->l_phys->l_hash, CHAIN_END, 2*ZAP_LEAF_HASH_NUMENTRIES(l));
163 for (i = 0; i < ZAP_LEAF_NUMCHUNKS(l); i++) {
164 ZAP_LEAF_CHUNK(l, i).l_free.lf_type = ZAP_CHUNK_FREE;
165 ZAP_LEAF_CHUNK(l, i).l_free.lf_next = i+1;
166 }
167 ZAP_LEAF_CHUNK(l, ZAP_LEAF_NUMCHUNKS(l)-1).l_free.lf_next = CHAIN_END;
168 l->l_phys->l_hdr.lh_block_type = ZBT_LEAF;

--- 705 unchanged lines hidden ---
161 zap_memset(&l->l_phys->l_hdr, 0, sizeof (struct zap_leaf_header));
162 zap_memset(l->l_phys->l_hash, CHAIN_END, 2*ZAP_LEAF_HASH_NUMENTRIES(l));
163 for (i = 0; i < ZAP_LEAF_NUMCHUNKS(l); i++) {
164 ZAP_LEAF_CHUNK(l, i).l_free.lf_type = ZAP_CHUNK_FREE;
165 ZAP_LEAF_CHUNK(l, i).l_free.lf_next = i+1;
166 }
167 ZAP_LEAF_CHUNK(l, ZAP_LEAF_NUMCHUNKS(l)-1).l_free.lf_next = CHAIN_END;
168 l->l_phys->l_hdr.lh_block_type = ZBT_LEAF;

--- 705 unchanged lines hidden ---