btrfs-progs: check: introduce function to check dir_item
[platform/upstream/btrfs-progs.git] / dir-item.c
index bc59d17..846fc29 100644 (file)
@@ -75,7 +75,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
        u32 data_size;
 
        key.objectid = dir;
-       btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
+       key.type = BTRFS_XATTR_ITEM_KEY;
        key.offset = btrfs_name_hash(name, name_len);
        path = btrfs_alloc_path();
        if (!path)
@@ -86,7 +86,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
                                        name, name_len);
        /*
         * FIXME: at some point we should handle xattr's that are larger than
-        * what we can fit in our leaf.  We set location to NULL b/c we arent
+        * what we can fit in our leaf.  We set location to NULL b/c we aren't
         * pointing at anything else, that will change if we store the xattr
         * data in a separate inode.
         */
@@ -125,7 +125,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
        u32 data_size;
 
        key.objectid = dir;
-       btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
+       key.type = BTRFS_DIR_ITEM_KEY;
        key.offset = btrfs_name_hash(name, name_len);
        path = btrfs_alloc_path();
        if (!path)
@@ -156,7 +156,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
        }
        btrfs_release_path(path);
 
-       btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
+       key.type = BTRFS_DIR_INDEX_KEY;
        key.offset = index;
        dir_item = insert_with_overflow(trans, root, path, &key, data_size,
                                        name, name_len);
@@ -196,7 +196,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
        struct extent_buffer *leaf;
 
        key.objectid = dir;
-       btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
+       key.type = BTRFS_DIR_ITEM_KEY;
 
        key.offset = btrfs_name_hash(name, name_len);
 
@@ -213,7 +213,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
        btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
 
        if (found_key.objectid != dir ||
-           btrfs_key_type(&found_key) != BTRFS_DIR_ITEM_KEY ||
+           found_key.type != BTRFS_DIR_ITEM_KEY ||
            found_key.offset != key.offset)
                return NULL;