]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - module/zfs/zap_leaf.c
New upstream version 0.7.2
[mirror_zfs-debian.git] / module / zfs / zap_leaf.c
index 3abc08cff476f09c634567a6681d236b75c82ec3..c342695c7f425dfd24fa1f2dba4de7bd164d90ff 100644 (file)
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
  */
 
 /*
@@ -364,7 +366,7 @@ zap_leaf_array_match(zap_leaf_t *l, zap_name_t *zn,
        }
 
        ASSERT(zn->zn_key_intlen == 1);
-       if (zn->zn_matchtype == MT_FIRST) {
+       if (zn->zn_matchtype & MT_NORMALIZE) {
                char *thisname = kmem_alloc(array_numints, KM_SLEEP);
                boolean_t match;
 
@@ -406,7 +408,6 @@ zap_leaf_lookup(zap_leaf_t *l, zap_name_t *zn, zap_entry_handle_t *zeh)
 
        ASSERT3U(zap_leaf_phys(l)->l_hdr.lh_magic, ==, ZAP_LEAF_MAGIC);
 
-again:
        for (chunkp = LEAF_HASH_ENTPTR(l, zn->zn_hash);
            *chunkp != CHAIN_END; chunkp = &le->le_next) {
                uint16_t chunk = *chunkp;
@@ -421,9 +422,9 @@ again:
                /*
                 * NB: the entry chain is always sorted by cd on
                 * normalized zap objects, so this will find the
-                * lowest-cd match for MT_FIRST.
+                * lowest-cd match for MT_NORMALIZE.
                 */
-               ASSERT(zn->zn_matchtype == MT_EXACT ||
+               ASSERT((zn->zn_matchtype == 0) ||
                    (zap_leaf_phys(l)->l_hdr.lh_flags & ZLF_ENTRIES_CDSORTED));
                if (zap_leaf_array_match(l, zn, le->le_name_chunk,
                    le->le_name_numints)) {
@@ -437,15 +438,6 @@ again:
                }
        }
 
-       /*
-        * NB: we could of course do this in one pass, but that would be
-        * a pain.  We'll see if MT_BEST is even used much.
-        */
-       if (zn->zn_matchtype == MT_BEST) {
-               zn->zn_matchtype = MT_FIRST;
-               goto again;
-       }
-
        return (SET_ERROR(ENOENT));
 }
 
@@ -538,7 +530,7 @@ zap_entry_read_name(zap_t *zap, const zap_entry_handle_t *zeh, uint16_t buflen,
 
 int
 zap_entry_update(zap_entry_handle_t *zeh,
-       uint8_t integer_size, uint64_t num_integers, const void *buf)
+    uint8_t integer_size, uint64_t num_integers, const void *buf)
 {
        int delta_chunks;
        zap_leaf_t *l = zeh->zeh_leaf;
@@ -700,7 +692,7 @@ zap_entry_normalization_conflict(zap_entry_handle_t *zeh, zap_name_t *zn,
                        continue;
 
                if (zn == NULL) {
-                       zn = zap_name_alloc(zap, name, MT_FIRST);
+                       zn = zap_name_alloc(zap, name, MT_NORMALIZE);
                        allocdzn = B_TRUE;
                }
                if (zap_leaf_array_match(zeh->zeh_leaf, zn,