forked from Minki/linux
btrfs: kill the key type accessor helpers
btrfs_set_key_type and btrfs_key_type are used inconsistently along with open coded variants. Other members of btrfs_key are accessed directly without any helpers anyway. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
3abdbd780e
commit
962a298f35
@ -1193,7 +1193,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
|
|||||||
unsigned long ptr;
|
unsigned long ptr;
|
||||||
|
|
||||||
key.objectid = inode_objectid;
|
key.objectid = inode_objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_EXTREF_KEY);
|
key.type = BTRFS_INODE_EXTREF_KEY;
|
||||||
key.offset = start_off;
|
key.offset = start_off;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
@ -1233,7 +1233,7 @@ int btrfs_find_one_extref(struct btrfs_root *root, u64 inode_objectid,
|
|||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
if (found_key.objectid != inode_objectid)
|
if (found_key.objectid != inode_objectid)
|
||||||
break;
|
break;
|
||||||
if (btrfs_key_type(&found_key) != BTRFS_INODE_EXTREF_KEY)
|
if (found_key.type != BTRFS_INODE_EXTREF_KEY)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -1042,7 +1042,7 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = node->inode_id;
|
key.objectid = node->inode_id;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
|
|
||||||
if (test_bit(BTRFS_DELAYED_NODE_DEL_IREF, &node->flags))
|
if (test_bit(BTRFS_DELAYED_NODE_DEL_IREF, &node->flags))
|
||||||
@ -1099,7 +1099,7 @@ err_out:
|
|||||||
search:
|
search:
|
||||||
btrfs_release_path(path);
|
btrfs_release_path(path);
|
||||||
|
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_EXTREF_KEY);
|
key.type = BTRFS_INODE_EXTREF_KEY;
|
||||||
key.offset = -1;
|
key.offset = -1;
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1473,7 +1473,7 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
|
|||||||
}
|
}
|
||||||
|
|
||||||
delayed_item->key.objectid = btrfs_ino(dir);
|
delayed_item->key.objectid = btrfs_ino(dir);
|
||||||
btrfs_set_key_type(&delayed_item->key, BTRFS_DIR_INDEX_KEY);
|
delayed_item->key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
delayed_item->key.offset = index;
|
delayed_item->key.offset = index;
|
||||||
|
|
||||||
dir_item = (struct btrfs_dir_item *)delayed_item->data;
|
dir_item = (struct btrfs_dir_item *)delayed_item->data;
|
||||||
@ -1542,7 +1542,7 @@ int btrfs_delete_delayed_dir_index(struct btrfs_trans_handle *trans,
|
|||||||
return PTR_ERR(node);
|
return PTR_ERR(node);
|
||||||
|
|
||||||
item_key.objectid = btrfs_ino(dir);
|
item_key.objectid = btrfs_ino(dir);
|
||||||
btrfs_set_key_type(&item_key, BTRFS_DIR_INDEX_KEY);
|
item_key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
item_key.offset = index;
|
item_key.offset = index;
|
||||||
|
|
||||||
ret = btrfs_delete_delayed_insertion_item(root, node, &item_key);
|
ret = btrfs_delete_delayed_insertion_item(root, node, &item_key);
|
||||||
|
@ -86,7 +86,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
|
|||||||
BUG_ON(name_len + data_len > BTRFS_MAX_XATTR_SIZE(root));
|
BUG_ON(name_len + data_len > BTRFS_MAX_XATTR_SIZE(root));
|
||||||
|
|
||||||
key.objectid = objectid;
|
key.objectid = objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
|
key.type = BTRFS_XATTR_ITEM_KEY;
|
||||||
key.offset = btrfs_name_hash(name, name_len);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
|
|
||||||
data_size = sizeof(*dir_item) + name_len + data_len;
|
data_size = sizeof(*dir_item) + name_len + data_len;
|
||||||
@ -137,7 +137,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||||||
u32 data_size;
|
u32 data_size;
|
||||||
|
|
||||||
key.objectid = btrfs_ino(dir);
|
key.objectid = btrfs_ino(dir);
|
||||||
btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
|
key.type = BTRFS_DIR_ITEM_KEY;
|
||||||
key.offset = btrfs_name_hash(name, name_len);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
@ -204,7 +204,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
|||||||
int cow = mod != 0;
|
int cow = mod != 0;
|
||||||
|
|
||||||
key.objectid = dir;
|
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);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = dir;
|
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);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
@ -297,7 +297,7 @@ btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
|
|||||||
int cow = mod != 0;
|
int cow = mod != 0;
|
||||||
|
|
||||||
key.objectid = dir;
|
key.objectid = dir;
|
||||||
btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
|
key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
key.offset = objectid;
|
key.offset = objectid;
|
||||||
|
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
|
ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
|
||||||
@ -367,7 +367,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
|
|||||||
int cow = mod != 0;
|
int cow = mod != 0;
|
||||||
|
|
||||||
key.objectid = dir;
|
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);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
|
ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -70,7 +70,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
|
|||||||
return ERR_PTR(-ESTALE);
|
return ERR_PTR(-ESTALE);
|
||||||
|
|
||||||
key.objectid = root_objectid;
|
key.objectid = root_objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
index = srcu_read_lock(&fs_info->subvol_srcu);
|
index = srcu_read_lock(&fs_info->subvol_srcu);
|
||||||
@ -82,7 +82,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
key.objectid = objectid;
|
key.objectid = objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
|
|
||||||
inode = btrfs_iget(sb, &key, root, NULL);
|
inode = btrfs_iget(sb, &key, root, NULL);
|
||||||
|
@ -3097,7 +3097,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
|
|||||||
for (i = 0; i < nritems; i++) {
|
for (i = 0; i < nritems; i++) {
|
||||||
if (level == 0) {
|
if (level == 0) {
|
||||||
btrfs_item_key_to_cpu(buf, &key, i);
|
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;
|
continue;
|
||||||
fi = btrfs_item_ptr(buf, i,
|
fi = btrfs_item_ptr(buf, i,
|
||||||
struct btrfs_file_extent_item);
|
struct btrfs_file_extent_item);
|
||||||
@ -6464,7 +6464,7 @@ static noinline int find_free_extent(struct btrfs_root *orig_root,
|
|||||||
bool have_caching_bg = false;
|
bool have_caching_bg = false;
|
||||||
|
|
||||||
WARN_ON(num_bytes < root->sectorsize);
|
WARN_ON(num_bytes < root->sectorsize);
|
||||||
btrfs_set_key_type(ins, BTRFS_EXTENT_ITEM_KEY);
|
ins->type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
ins->objectid = 0;
|
ins->objectid = 0;
|
||||||
ins->offset = 0;
|
ins->offset = 0;
|
||||||
|
|
||||||
@ -9009,7 +9009,7 @@ int btrfs_read_block_groups(struct btrfs_root *root)
|
|||||||
root = info->extent_root;
|
root = info->extent_root;
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
btrfs_set_key_type(&key, BTRFS_BLOCK_GROUP_ITEM_KEY);
|
key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -4224,7 +4224,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
|
|||||||
WARN_ON(!ret);
|
WARN_ON(!ret);
|
||||||
path->slots[0]--;
|
path->slots[0]--;
|
||||||
btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]);
|
btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]);
|
||||||
found_type = btrfs_key_type(&found_key);
|
found_type = found_key.type;
|
||||||
|
|
||||||
/* No extents, but there might be delalloc bits */
|
/* No extents, but there might be delalloc bits */
|
||||||
if (found_key.objectid != btrfs_ino(inode) ||
|
if (found_key.objectid != btrfs_ino(inode) ||
|
||||||
|
@ -55,7 +55,7 @@ int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
file_key.objectid = objectid;
|
file_key.objectid = objectid;
|
||||||
file_key.offset = pos;
|
file_key.offset = pos;
|
||||||
btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY);
|
file_key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
|
||||||
path->leave_spinning = 1;
|
path->leave_spinning = 1;
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
||||||
@ -100,7 +100,7 @@ btrfs_lookup_csum(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
||||||
file_key.offset = bytenr;
|
file_key.offset = bytenr;
|
||||||
btrfs_set_key_type(&file_key, BTRFS_EXTENT_CSUM_KEY);
|
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow);
|
ret = btrfs_search_slot(trans, root, &file_key, path, 0, cow);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -111,7 +111,7 @@ btrfs_lookup_csum(struct btrfs_trans_handle *trans,
|
|||||||
goto fail;
|
goto fail;
|
||||||
path->slots[0]--;
|
path->slots[0]--;
|
||||||
btrfs_item_key_to_cpu(leaf, &found_key, 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;
|
goto fail;
|
||||||
|
|
||||||
csum_offset = (bytenr - found_key.offset) >>
|
csum_offset = (bytenr - found_key.offset) >>
|
||||||
@ -148,7 +148,7 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
file_key.objectid = objectid;
|
file_key.objectid = objectid;
|
||||||
file_key.offset = offset;
|
file_key.offset = offset;
|
||||||
btrfs_set_key_type(&file_key, BTRFS_EXTENT_DATA_KEY);
|
file_key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow);
|
ret = btrfs_search_slot(trans, root, &file_key, path, ins_len, cow);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -720,7 +720,7 @@ again:
|
|||||||
bytenr = sums->bytenr + total_bytes;
|
bytenr = sums->bytenr + total_bytes;
|
||||||
file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
file_key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
||||||
file_key.offset = bytenr;
|
file_key.offset = bytenr;
|
||||||
btrfs_set_key_type(&file_key, BTRFS_EXTENT_CSUM_KEY);
|
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
|
|
||||||
item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
|
item = btrfs_lookup_csum(trans, root, path, bytenr, 1);
|
||||||
if (!IS_ERR(item)) {
|
if (!IS_ERR(item)) {
|
||||||
@ -790,7 +790,7 @@ again:
|
|||||||
csum_offset = (bytenr - found_key.offset) >>
|
csum_offset = (bytenr - found_key.offset) >>
|
||||||
root->fs_info->sb->s_blocksize_bits;
|
root->fs_info->sb->s_blocksize_bits;
|
||||||
|
|
||||||
if (btrfs_key_type(&found_key) != BTRFS_EXTENT_CSUM_KEY ||
|
if (found_key.type != BTRFS_EXTENT_CSUM_KEY ||
|
||||||
found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
|
found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
|
||||||
csum_offset >= MAX_CSUM_ITEMS(root, csum_size)) {
|
csum_offset >= MAX_CSUM_ITEMS(root, csum_size)) {
|
||||||
goto insert;
|
goto insert;
|
||||||
|
@ -299,7 +299,7 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
/* get the inode */
|
/* get the inode */
|
||||||
key.objectid = defrag->root;
|
key.objectid = defrag->root;
|
||||||
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
index = srcu_read_lock(&fs_info->subvol_srcu);
|
index = srcu_read_lock(&fs_info->subvol_srcu);
|
||||||
@ -311,7 +311,7 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
key.objectid = defrag->ino;
|
key.objectid = defrag->ino;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
inode = btrfs_iget(fs_info->sb, &key, inode_root, NULL);
|
inode = btrfs_iget(fs_info->sb, &key, inode_root, NULL);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
|
@ -135,7 +135,7 @@ static int btrfs_del_inode_extref(struct btrfs_trans_handle *trans,
|
|||||||
u32 item_size;
|
u32 item_size;
|
||||||
|
|
||||||
key.objectid = inode_objectid;
|
key.objectid = inode_objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_EXTREF_KEY);
|
key.type = BTRFS_INODE_EXTREF_KEY;
|
||||||
key.offset = btrfs_extref_hash(ref_objectid, name, name_len);
|
key.offset = btrfs_extref_hash(ref_objectid, name, name_len);
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
@ -209,7 +209,7 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
key.objectid = inode_objectid;
|
key.objectid = inode_objectid;
|
||||||
key.offset = ref_objectid;
|
key.offset = ref_objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
|
key.type = BTRFS_INODE_REF_KEY;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -337,7 +337,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
key.objectid = inode_objectid;
|
key.objectid = inode_objectid;
|
||||||
key.offset = ref_objectid;
|
key.offset = ref_objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_REF_KEY);
|
key.type = BTRFS_INODE_REF_KEY;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -400,7 +400,7 @@ int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
|
|||||||
struct btrfs_key key;
|
struct btrfs_key key;
|
||||||
int ret;
|
int ret;
|
||||||
key.objectid = objectid;
|
key.objectid = objectid;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||||
@ -420,13 +420,13 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||||||
struct btrfs_key found_key;
|
struct btrfs_key found_key;
|
||||||
|
|
||||||
ret = btrfs_search_slot(trans, root, location, path, ins_len, cow);
|
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) {
|
location->offset == (u64)-1 && path->slots[0] != 0) {
|
||||||
slot = path->slots[0] - 1;
|
slot = path->slots[0] - 1;
|
||||||
leaf = path->nodes[0];
|
leaf = path->nodes[0];
|
||||||
btrfs_item_key_to_cpu(leaf, &found_key, slot);
|
btrfs_item_key_to_cpu(leaf, &found_key, slot);
|
||||||
if (found_key.objectid == location->objectid &&
|
if (found_key.objectid == location->objectid &&
|
||||||
btrfs_key_type(&found_key) == btrfs_key_type(location)) {
|
found_key.type == location->type) {
|
||||||
path->slots[0]--;
|
path->slots[0]--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
key.objectid = btrfs_ino(inode);
|
key.objectid = btrfs_ino(inode);
|
||||||
key.offset = start;
|
key.offset = start;
|
||||||
btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY);
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
|
||||||
datasize = btrfs_file_extent_calc_inline_size(cur_size);
|
datasize = btrfs_file_extent_calc_inline_size(cur_size);
|
||||||
path->leave_spinning = 1;
|
path->leave_spinning = 1;
|
||||||
@ -3159,7 +3159,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
|
|||||||
path->reada = -1;
|
path->reada = -1;
|
||||||
|
|
||||||
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
||||||
btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY);
|
key.type = BTRFS_ORPHAN_ITEM_KEY;
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -3186,7 +3186,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
|
|||||||
/* make sure the item matches what we want */
|
/* make sure the item matches what we want */
|
||||||
if (found_key.objectid != BTRFS_ORPHAN_OBJECTID)
|
if (found_key.objectid != BTRFS_ORPHAN_OBJECTID)
|
||||||
break;
|
break;
|
||||||
if (btrfs_key_type(&found_key) != BTRFS_ORPHAN_ITEM_KEY)
|
if (found_key.type != BTRFS_ORPHAN_ITEM_KEY)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* release the path since we're done with it */
|
/* release the path since we're done with it */
|
||||||
@ -4085,7 +4085,7 @@ search_again:
|
|||||||
fi = NULL;
|
fi = NULL;
|
||||||
leaf = path->nodes[0];
|
leaf = path->nodes[0];
|
||||||
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
||||||
found_type = btrfs_key_type(&found_key);
|
found_type = found_key.type;
|
||||||
|
|
||||||
if (found_key.objectid != ino)
|
if (found_key.objectid != ino)
|
||||||
break;
|
break;
|
||||||
@ -5331,7 +5331,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx)
|
|||||||
btrfs_get_delayed_items(inode, &ins_list, &del_list);
|
btrfs_get_delayed_items(inode, &ins_list, &del_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_set_key_type(&key, key_type);
|
key.type = key_type;
|
||||||
key.offset = ctx->pos;
|
key.offset = ctx->pos;
|
||||||
key.objectid = btrfs_ino(inode);
|
key.objectid = btrfs_ino(inode);
|
||||||
|
|
||||||
@ -5356,7 +5356,7 @@ static int btrfs_real_readdir(struct file *file, struct dir_context *ctx)
|
|||||||
|
|
||||||
if (found_key.objectid != key.objectid)
|
if (found_key.objectid != key.objectid)
|
||||||
break;
|
break;
|
||||||
if (btrfs_key_type(&found_key) != key_type)
|
if (found_key.type != key_type)
|
||||||
break;
|
break;
|
||||||
if (found_key.offset < ctx->pos)
|
if (found_key.offset < ctx->pos)
|
||||||
goto next;
|
goto next;
|
||||||
@ -5568,7 +5568,7 @@ static int btrfs_set_inode_index_count(struct inode *inode)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = btrfs_ino(inode);
|
key.objectid = btrfs_ino(inode);
|
||||||
btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
|
key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
@ -5600,7 +5600,7 @@ static int btrfs_set_inode_index_count(struct inode *inode)
|
|||||||
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
||||||
|
|
||||||
if (found_key.objectid != btrfs_ino(inode) ||
|
if (found_key.objectid != btrfs_ino(inode) ||
|
||||||
btrfs_key_type(&found_key) != BTRFS_DIR_INDEX_KEY) {
|
found_key.type != BTRFS_DIR_INDEX_KEY) {
|
||||||
BTRFS_I(inode)->index_cnt = 2;
|
BTRFS_I(inode)->index_cnt = 2;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -5718,7 +5718,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
|||||||
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(inode)->runtime_flags);
|
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &BTRFS_I(inode)->runtime_flags);
|
||||||
|
|
||||||
key[0].objectid = objectid;
|
key[0].objectid = objectid;
|
||||||
btrfs_set_key_type(&key[0], BTRFS_INODE_ITEM_KEY);
|
key[0].type = BTRFS_INODE_ITEM_KEY;
|
||||||
key[0].offset = 0;
|
key[0].offset = 0;
|
||||||
|
|
||||||
sizes[0] = sizeof(struct btrfs_inode_item);
|
sizes[0] = sizeof(struct btrfs_inode_item);
|
||||||
@ -5731,7 +5731,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
|||||||
* add more hard links than can fit in the ref item.
|
* add more hard links than can fit in the ref item.
|
||||||
*/
|
*/
|
||||||
key[1].objectid = objectid;
|
key[1].objectid = objectid;
|
||||||
btrfs_set_key_type(&key[1], BTRFS_INODE_REF_KEY);
|
key[1].type = BTRFS_INODE_REF_KEY;
|
||||||
key[1].offset = ref_objectid;
|
key[1].offset = ref_objectid;
|
||||||
|
|
||||||
sizes[1] = name_len + sizeof(*ref);
|
sizes[1] = name_len + sizeof(*ref);
|
||||||
@ -5740,7 +5740,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
|
|||||||
location = &BTRFS_I(inode)->location;
|
location = &BTRFS_I(inode)->location;
|
||||||
location->objectid = objectid;
|
location->objectid = objectid;
|
||||||
location->offset = 0;
|
location->offset = 0;
|
||||||
btrfs_set_key_type(location, BTRFS_INODE_ITEM_KEY);
|
location->type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
|
||||||
ret = btrfs_insert_inode_locked(inode);
|
ret = btrfs_insert_inode_locked(inode);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -5832,7 +5832,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
|
|||||||
memcpy(&key, &BTRFS_I(inode)->root->root_key, sizeof(key));
|
memcpy(&key, &BTRFS_I(inode)->root->root_key, sizeof(key));
|
||||||
} else {
|
} else {
|
||||||
key.objectid = ino;
|
key.objectid = ino;
|
||||||
btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY);
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6333,7 +6333,7 @@ again:
|
|||||||
struct btrfs_file_extent_item);
|
struct btrfs_file_extent_item);
|
||||||
/* are we inside the extent that was found? */
|
/* are we inside the extent that was found? */
|
||||||
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
|
||||||
found_type = btrfs_key_type(&found_key);
|
found_type = found_key.type;
|
||||||
if (found_key.objectid != objectid ||
|
if (found_key.objectid != objectid ||
|
||||||
found_type != BTRFS_EXTENT_DATA_KEY) {
|
found_type != BTRFS_EXTENT_DATA_KEY) {
|
||||||
/*
|
/*
|
||||||
@ -8832,7 +8832,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
|
|||||||
}
|
}
|
||||||
key.objectid = btrfs_ino(inode);
|
key.objectid = btrfs_ino(inode);
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
btrfs_set_key_type(&key, BTRFS_EXTENT_DATA_KEY);
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
datasize = btrfs_file_extent_calc_inline_size(name_len);
|
datasize = btrfs_file_extent_calc_inline_size(name_len);
|
||||||
err = btrfs_insert_empty_item(trans, root, path, &key,
|
err = btrfs_insert_empty_item(trans, root, path, &key,
|
||||||
datasize);
|
datasize);
|
||||||
|
@ -535,7 +535,7 @@ static noinline int create_subvol(struct inode *dir,
|
|||||||
|
|
||||||
key.objectid = objectid;
|
key.objectid = objectid;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key,
|
ret = btrfs_insert_root(trans, root->fs_info->tree_root, &key,
|
||||||
&root_item);
|
&root_item);
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -3252,11 +3252,11 @@ process_slot:
|
|||||||
slot = path->slots[0];
|
slot = path->slots[0];
|
||||||
|
|
||||||
btrfs_item_key_to_cpu(leaf, &key, slot);
|
btrfs_item_key_to_cpu(leaf, &key, slot);
|
||||||
if (btrfs_key_type(&key) > BTRFS_EXTENT_DATA_KEY ||
|
if (key.type > BTRFS_EXTENT_DATA_KEY ||
|
||||||
key.objectid != btrfs_ino(src))
|
key.objectid != btrfs_ino(src))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (btrfs_key_type(&key) == BTRFS_EXTENT_DATA_KEY) {
|
if (key.type == BTRFS_EXTENT_DATA_KEY) {
|
||||||
struct btrfs_file_extent_item *extent;
|
struct btrfs_file_extent_item *extent;
|
||||||
int type;
|
int type;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
@ -27,7 +27,7 @@ int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
||||||
btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY);
|
key.type = BTRFS_ORPHAN_ITEM_KEY;
|
||||||
key.offset = offset;
|
key.offset = offset;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
@ -48,7 +48,7 @@ int btrfs_del_orphan_item(struct btrfs_trans_handle *trans,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
key.objectid = BTRFS_ORPHAN_OBJECTID;
|
||||||
btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY);
|
key.type = BTRFS_ORPHAN_ITEM_KEY;
|
||||||
key.offset = offset;
|
key.offset = offset;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
|
@ -195,7 +195,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
|||||||
for (i = 0 ; i < nr ; i++) {
|
for (i = 0 ; i < nr ; i++) {
|
||||||
item = btrfs_item_nr(i);
|
item = btrfs_item_nr(i);
|
||||||
btrfs_item_key_to_cpu(l, &key, i);
|
btrfs_item_key_to_cpu(l, &key, i);
|
||||||
type = btrfs_key_type(&key);
|
type = key.type;
|
||||||
printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d "
|
printk(KERN_INFO "\titem %d key (%llu %u %llu) itemoff %d "
|
||||||
"itemsize %d\n",
|
"itemsize %d\n",
|
||||||
i, key.objectid, type, key.offset,
|
i, key.objectid, type, key.offset,
|
||||||
|
@ -2714,7 +2714,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
|
|||||||
if (found_key.objectid != scrub_dev->devid)
|
if (found_key.objectid != scrub_dev->devid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (btrfs_key_type(&found_key) != BTRFS_DEV_EXTENT_KEY)
|
if (found_key.type != BTRFS_DEV_EXTENT_KEY)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (found_key.offset >= end)
|
if (found_key.offset >= end)
|
||||||
|
@ -1498,7 +1498,7 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID;
|
key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID;
|
||||||
btrfs_set_key_type(&key, BTRFS_ORPHAN_ITEM_KEY);
|
key.type = BTRFS_ORPHAN_ITEM_KEY;
|
||||||
key.offset = objectid;
|
key.offset = objectid;
|
||||||
|
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
|
ret = btrfs_insert_empty_item(trans, root, path, &key, 0);
|
||||||
@ -3364,7 +3364,7 @@ static noinline int copy_items(struct btrfs_trans_handle *trans,
|
|||||||
* or deletes of this inode don't have to relog the inode
|
* or deletes of this inode don't have to relog the inode
|
||||||
* again
|
* again
|
||||||
*/
|
*/
|
||||||
if (btrfs_key_type(ins_keys + i) == BTRFS_EXTENT_DATA_KEY &&
|
if (ins_keys[i].type == BTRFS_EXTENT_DATA_KEY &&
|
||||||
!skip_csum) {
|
!skip_csum) {
|
||||||
int found_type;
|
int found_type;
|
||||||
extent = btrfs_item_ptr(src, start_slot + i,
|
extent = btrfs_item_ptr(src, start_slot + i,
|
||||||
@ -4369,7 +4369,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
|
|||||||
again:
|
again:
|
||||||
key.objectid = BTRFS_TREE_LOG_OBJECTID;
|
key.objectid = BTRFS_TREE_LOG_OBJECTID;
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, log_root_tree, &key, path, 0, 0);
|
||||||
|
@ -1054,7 +1054,7 @@ int btrfs_account_dev_extents_size(struct btrfs_device *device, u64 start,
|
|||||||
if (key.objectid > device->devid)
|
if (key.objectid > device->devid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (btrfs_key_type(&key) != BTRFS_DEV_EXTENT_KEY)
|
if (key.type != BTRFS_DEV_EXTENT_KEY)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
dev_extent = btrfs_item_ptr(l, slot, struct btrfs_dev_extent);
|
dev_extent = btrfs_item_ptr(l, slot, struct btrfs_dev_extent);
|
||||||
@ -1206,7 +1206,7 @@ again:
|
|||||||
if (key.objectid > device->devid)
|
if (key.objectid > device->devid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (btrfs_key_type(&key) != BTRFS_DEV_EXTENT_KEY)
|
if (key.type != BTRFS_DEV_EXTENT_KEY)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
if (key.offset > search_start) {
|
if (key.offset > search_start) {
|
||||||
|
@ -237,7 +237,7 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
|||||||
* first xattr that we find and walk forward
|
* first xattr that we find and walk forward
|
||||||
*/
|
*/
|
||||||
key.objectid = btrfs_ino(inode);
|
key.objectid = btrfs_ino(inode);
|
||||||
btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
|
key.type = BTRFS_XATTR_ITEM_KEY;
|
||||||
key.offset = 0;
|
key.offset = 0;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
@ -273,7 +273,7 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
|
|||||||
/* check to make sure this item is what we want */
|
/* check to make sure this item is what we want */
|
||||||
if (found_key.objectid != key.objectid)
|
if (found_key.objectid != key.objectid)
|
||||||
break;
|
break;
|
||||||
if (btrfs_key_type(&found_key) != BTRFS_XATTR_ITEM_KEY)
|
if (found_key.type != BTRFS_XATTR_ITEM_KEY)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item);
|
di = btrfs_item_ptr(leaf, slot, struct btrfs_dir_item);
|
||||||
|
Loading…
Reference in New Issue
Block a user