MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zap_leaf_init

Function zap_leaf_init

freebsd/contrib/openzfs/module/zfs/zap_leaf.c:161–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161void
162zap_leaf_init(zap_leaf_t *l, boolean_t sort)
163{
164 l->l_bs = highbit64(l->l_dbuf->db_size) - 1;
165 zap_memset(&zap_leaf_phys(l)->l_hdr, 0,
166 sizeof (struct zap_leaf_header));
167 zap_memset(zap_leaf_phys(l)->l_hash, CHAIN_END,
168 2*ZAP_LEAF_HASH_NUMENTRIES(l));
169 for (int i = 0; i < ZAP_LEAF_NUMCHUNKS(l); i++) {
170 ZAP_LEAF_CHUNK(l, i).l_free.lf_type = ZAP_CHUNK_FREE;
171 ZAP_LEAF_CHUNK(l, i).l_free.lf_next = i+1;
172 }
173 ZAP_LEAF_CHUNK(l, ZAP_LEAF_NUMCHUNKS(l)-1).l_free.lf_next = CHAIN_END;
174 zap_leaf_phys(l)->l_hdr.lh_block_type = ZBT_LEAF;
175 zap_leaf_phys(l)->l_hdr.lh_magic = ZAP_LEAF_MAGIC;
176 zap_leaf_phys(l)->l_hdr.lh_nfree = ZAP_LEAF_NUMCHUNKS(l);
177 if (sort)
178 zap_leaf_phys(l)->l_hdr.lh_flags |= ZLF_ENTRIES_CDSORTED;
179}
180
181/*
182 * Routines which manipulate leaf chunks (l_chunk[]).

Callers 2

fzap_upgradeFunction · 0.85
zap_create_leafFunction · 0.85

Calls 3

zap_memsetFunction · 0.85
highbit64Function · 0.50
zap_leaf_physFunction · 0.50

Tested by

no test coverage detected