btrfs-progs: cleanup, kill trivial btrfs_key_type helper
authorDavid Sterba <dsterba@suse.com>
Tue, 13 Sep 2016 10:00:17 +0000 (12:00 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 3 Oct 2016 09:33:15 +0000 (11:33 +0200)
Signed-off-by: David Sterba <dsterba@suse.com>
backref.c
btrfs-convert.c
cmds-check.c
cmds-inspect-dump-tree.c
cmds-restore.c
ctree.h
dir-item.c
extent-tree.c
file-item.c
inode-item.c
volumes.c

index 55be719..d65038d 100644 (file)
--- a/backref.c
+++ b/backref.c
@@ -1030,7 +1030,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
                ret = -ENOENT;
                if (found_key.objectid != inode_objectid)
                        break;
-               if (btrfs_key_type(&found_key) != BTRFS_INODE_EXTREF_KEY)
+               if (found_key.type != BTRFS_INODE_EXTREF_KEY)
                        break;
 
                ret = 0;
index e1e0038..727bfea 100644 (file)
@@ -2759,7 +2759,7 @@ static int do_rollback(const char *devname)
 
                btrfs_item_key_to_cpu(leaf, &key, path.slots[0]);
                if (key.objectid != objectid || key.offset != offset ||
-                   btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
+                   key.type != BTRFS_EXTENT_DATA_KEY)
                        break;
 
                fi = btrfs_item_ptr(leaf, path.slots[0],
index 48fc82c..5f38253 100644 (file)
@@ -8525,7 +8525,7 @@ again:
                        slot = path.slots[0];
                }
                btrfs_item_key_to_cpu(leaf, &found_key, path.slots[0]);
-               if (btrfs_key_type(&found_key) == BTRFS_ROOT_ITEM_KEY) {
+               if (found_key.type == BTRFS_ROOT_ITEM_KEY) {
                        unsigned long offset;
                        u64 last_snapshot;
 
@@ -9807,7 +9807,7 @@ static int check_leaf_items(struct btrfs_root *root, struct extent_buffer *eb)
 
 next:
        btrfs_item_key_to_cpu(eb, &key, slot);
-       type = btrfs_key_type(&key);
+       type = key.type;
 
        switch (type) {
        case BTRFS_EXTENT_DATA_KEY:
index 4bf14b7..f43ef38 100644 (file)
@@ -408,7 +408,7 @@ again:
                }
                btrfs_item_key(leaf, &disk_key, path.slots[0]);
                btrfs_disk_key_to_cpu(&found_key, &disk_key);
-               if (btrfs_key_type(&found_key) == BTRFS_ROOT_ITEM_KEY) {
+               if (found_key.type == BTRFS_ROOT_ITEM_KEY) {
                        unsigned long offset;
                        struct extent_buffer *buf;
                        int skip = extent_only | device_only | uuid_tree_only;
index 455c060..1b3748b 100644 (file)
@@ -1233,7 +1233,7 @@ static int do_list_roots(struct btrfs_root *root)
                }
                btrfs_item_key(leaf, &disk_key, slot);
                btrfs_disk_key_to_cpu(&found_key, &disk_key);
-               if (btrfs_key_type(&found_key) != BTRFS_ROOT_ITEM_KEY) {
+               if (found_key.type != BTRFS_ROOT_ITEM_KEY) {
                        path->slots[0]++;
                        continue;
                }
diff --git a/ctree.h b/ctree.h
index 44d6249..e0dd2e4 100644 (file)
--- a/ctree.h
+++ b/ctree.h
@@ -1834,12 +1834,6 @@ static inline void btrfs_dir_item_key_to_cpu(struct extent_buffer *eb,
        btrfs_disk_key_to_cpu(key, &disk_key);
 }
 
-
-static inline u8 btrfs_key_type(struct btrfs_key *key)
-{
-       return key->type;
-}
-
 /* struct btrfs_header */
 BTRFS_SETGET_HEADER_FUNCS(header_bytenr, struct btrfs_header, bytenr, 64);
 BTRFS_SETGET_HEADER_FUNCS(header_generation, struct btrfs_header,
index 68fc9e7..846fc29 100644 (file)
@@ -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;
 
index 2cdf3c2..f6d0a7c 100644 (file)
@@ -1664,7 +1664,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
                cond_resched();
                if (level == 0) {
                        btrfs_item_key_to_cpu(buf, &key, i);
-                       if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
+                       if (key.type != BTRFS_EXTENT_DATA_KEY)
                                continue;
                        fi = btrfs_item_ptr(buf, i,
                                            struct btrfs_file_extent_item);
index 3d57c6b..97feafa 100644 (file)
@@ -148,7 +148,7 @@ btrfs_lookup_csum(struct btrfs_trans_handle *trans,
                        goto fail;
                path->slots[0]--;
                btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
-               if (btrfs_key_type(&found_key) != BTRFS_EXTENT_CSUM_KEY)
+               if (found_key.type != BTRFS_EXTENT_CSUM_KEY)
                        goto fail;
 
                csum_offset = (bytenr - found_key.offset) / root->sectorsize;
index d563d4e..913b81a 100644 (file)
@@ -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;
                }
index b0edbac..da79751 100644 (file)
--- a/volumes.c
+++ b/volumes.c
@@ -367,7 +367,7 @@ no_more_items:
                                goto check_pending;
                        }
                }
-               if (btrfs_key_type(&key) != BTRFS_DEV_EXTENT_KEY) {
+               if (key.type != BTRFS_DEV_EXTENT_KEY) {
                        goto next;
                }
 
@@ -741,7 +741,7 @@ static int btrfs_device_avail_bytes(struct btrfs_trans_handle *trans,
                        goto next;
                if (key.objectid > device->devid)
                        break;
-               if (btrfs_key_type(&key) != BTRFS_DEV_EXTENT_KEY)
+               if (key.type != BTRFS_DEV_EXTENT_KEY)
                        goto next;
                if (key.offset > search_end)
                        break;