btrfs-progs: add OPEN_CTREE_INVALIDATE_FST flag
[platform/upstream/btrfs-progs.git] / inode-item.c
index 993f309..f7b6ead 100644 (file)
@@ -19,7 +19,7 @@
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
-#include "crc32c.h"
+#include "hash.h"
 
 static int find_name_in_backref(struct btrfs_path *path, const char * name,
                         int name_len, struct btrfs_inode_ref **ref_ret)
@@ -64,7 +64,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
 
        key.objectid = inode_objectid;
        key.offset = ref_objectid;
-       btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
+       key.type = BTRFS_INODE_REF_KEY;
 
        path = btrfs_alloc_path();
        if (!path)
@@ -89,7 +89,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
                ptr = (unsigned long)(ref + 1);
                ret = 0;
        } else if (ret < 0) {
-               if (ret == EOVERFLOW)
+               if (ret == -EOVERFLOW)
                        ret = -EMLINK;
                goto out;
        } else {
@@ -128,13 +128,13 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
        struct btrfs_key found_key;
 
        ret = btrfs_search_slot(trans, root, location, path, ins_len, cow);
-       if (ret > 0 && btrfs_key_type(location) == BTRFS_ROOT_ITEM_KEY &&
+       if (ret > 0 && location->type == BTRFS_ROOT_ITEM_KEY &&
            location->offset == (u64)-1 && path->slots[0] != 0) {
                slot = path->slots[0] - 1;
                leaf = path->nodes[0];
                btrfs_item_key_to_cpu(leaf, &found_key, slot);
                if (found_key.objectid == location->objectid &&
-                   btrfs_key_type(&found_key) == btrfs_key_type(location)) {
+                   found_key.type == location->type) {
                        path->slots[0]--;
                        return 0;
                }
@@ -184,12 +184,6 @@ out:
                return ret_inode_ref;
 }
 
-static inline u64 btrfs_extref_hash(u64 parent_ino, const char *name,
-                                   int namelen)
-{
-       return (u64)btrfs_crc32c(parent_ino, name, namelen);
-}
-
 static int btrfs_find_name_in_ext_backref(struct btrfs_path *path,
                u64 parent_ino, const char *name, int namelen,
                struct btrfs_inode_extref **extref_ret)