btrfs-progs: cleanup, kill trivial btrfs_key_type helper

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-09-13 12:00:17 +02:00
parent 555743075b
commit 890f4a61d7
11 changed files with 13 additions and 19 deletions

View File

@ -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;

View 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],

View 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:

View 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;

View 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;
}

View File

@ -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,

View 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;

View 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);

View 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;

View 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;
}

View File

@ -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;