]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/str_hash.h
Update bcachefs sources to ed6b7f81a7 six locks: Disable percpu read lock mode in...
[bcachefs-tools-debian] / libbcachefs / str_hash.h
index 5c327b3128da2cb0cd5f6385cd7c90a3e99ebc8c..ae21a8cca1b49d4d9bbfe2b38a330c78b9abc023 100644 (file)
@@ -144,7 +144,9 @@ struct bch_hash_desc {
 static inline bool is_visible_key(struct bch_hash_desc desc, subvol_inum inum, struct bkey_s_c k)
 {
        return k.k->type == desc.key_type &&
-               (!desc.is_visible || desc.is_visible(inum, k));
+               (!desc.is_visible ||
+                !inum.inum ||
+                desc.is_visible(inum, k));
 }
 
 static __always_inline int
@@ -179,7 +181,7 @@ bch2_hash_lookup(struct btree_trans *trans,
        }
        bch2_trans_iter_exit(trans, iter);
 
-       return ret ?: -ENOENT;
+       return ret ?: -BCH_ERR_ENOENT_str_hash_lookup;
 }
 
 static __always_inline int
@@ -205,7 +207,7 @@ bch2_hash_hole(struct btree_trans *trans,
                        return 0;
        bch2_trans_iter_exit(trans, iter);
 
-       return ret ?: -ENOSPC;
+       return ret ?: -BCH_ERR_ENOSPC_str_hash_create;
 }
 
 static __always_inline
@@ -258,7 +260,7 @@ int bch2_hash_set_snapshot(struct btree_trans *trans,
                                snapshot),
                           POS(insert->k.p.inode, U64_MAX),
                           BTREE_ITER_SLOTS|BTREE_ITER_INTENT, k, ret) {
-               if (!inum.subvol || is_visible_key(desc, inum, k)) {
+               if (is_visible_key(desc, inum, k)) {
                        if (!desc.cmp_bkey(k, bkey_i_to_s_c(insert)))
                                goto found;
 
@@ -275,7 +277,7 @@ int bch2_hash_set_snapshot(struct btree_trans *trans,
        }
 
        if (!ret)
-               ret = -ENOSPC;
+               ret = -BCH_ERR_ENOSPC_str_hash_create;
 out:
        bch2_trans_iter_exit(trans, &slot);
        bch2_trans_iter_exit(trans, &iter);
@@ -286,7 +288,7 @@ found:
 not_found:
 
        if (!found && (flags & BCH_HASH_SET_MUST_REPLACE)) {
-               ret = -ENOENT;
+               ret = -BCH_ERR_ENOENT_str_hash_set_must_replace;
        } else if (found && (flags & BCH_HASH_SET_MUST_CREATE)) {
                ret = -EEXIST;
        } else {