From 890f4a61d7f4563af24617e7b2a5002cb2bf04cf Mon Sep 17 00:00:00 2001 From: David Sterba Date: Tue, 13 Sep 2016 12:00:17 +0200 Subject: btrfs-progs: cleanup, kill trivial btrfs_key_type helper Signed-off-by: David Sterba --- backref.c | 2 +- btrfs-convert.c | 2 +- cmds-check.c | 4 ++-- cmds-inspect-dump-tree.c | 2 +- cmds-restore.c | 2 +- ctree.h | 6 ------ dir-item.c | 2 +- extent-tree.c | 2 +- file-item.c | 2 +- inode-item.c | 4 ++-- volumes.c | 4 ++-- 11 files changed, 13 insertions(+), 19 deletions(-) diff --git a/backref.c b/backref.c index 55be719b..d65038dc 100644 --- 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; diff --git a/btrfs-convert.c b/btrfs-convert.c index e1e0038e..727bfea1 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -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], diff --git a/cmds-check.c b/cmds-check.c index 48fc82c4..5f382534 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -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: diff --git a/cmds-inspect-dump-tree.c b/cmds-inspect-dump-tree.c index 4bf14b7c..f43ef386 100644 --- a/cmds-inspect-dump-tree.c +++ b/cmds-inspect-dump-tree.c @@ -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; diff --git a/cmds-restore.c b/cmds-restore.c index 455c060d..1b3748b2 100644 --- a/cmds-restore.c +++ b/cmds-restore.c @@ -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 44d62490..e0dd2e40 100644 --- 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, diff --git a/dir-item.c b/dir-item.c index 68fc9e76..846fc292 100644 --- a/dir-item.c +++ b/dir-item.c @@ -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; diff --git a/extent-tree.c b/extent-tree.c index 2cdf3c27..f6d0a7c1 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -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); diff --git a/file-item.c b/file-item.c index 3d57c6bd..97feafa8 100644 --- a/file-item.c +++ b/file-item.c @@ -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; diff --git a/inode-item.c b/inode-item.c index d563d4ee..913b81ad 100644 --- a/inode-item.c +++ b/inode-item.c @@ -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; } diff --git a/volumes.c b/volumes.c index b0edbacb..da797517 100644 --- 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; -- cgit v1.2.3