mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-18 04:15:32 +00:00
btrfs-progs: reorder key initializations
Use the objectid, type, offset natural order as it's more readable and we're used to read keys like that. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5a956bb3b1
commit
7f396f5ced
10
check/main.c
10
check/main.c
@ -2753,8 +2753,8 @@ static int repair_inline_ram_bytes(struct btrfs_trans_handle *trans,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = rec->ino;
|
key.objectid = rec->ino;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
|
ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
@ -2986,8 +2986,8 @@ static int repair_inode_gen_original(struct btrfs_trans_handle *trans,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = rec->ino;
|
key.objectid = rec->ino;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
|
ret = btrfs_search_slot(trans, root, &key, path, 0, 1);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
@ -3875,12 +3875,12 @@ static int check_fs_roots(struct cache_tree *root_cache)
|
|||||||
cache_tree_init(&wc.shared);
|
cache_tree_init(&wc.shared);
|
||||||
|
|
||||||
again:
|
again:
|
||||||
key.offset = 0;
|
|
||||||
if (skip_root)
|
if (skip_root)
|
||||||
key.objectid = skip_root + 1;
|
key.objectid = skip_root + 1;
|
||||||
else
|
else
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
err = 1;
|
err = 1;
|
||||||
@ -6885,8 +6885,8 @@ static int record_extent(struct btrfs_trans_handle *trans,
|
|||||||
item_size += sizeof(*bi);
|
item_size += sizeof(*bi);
|
||||||
|
|
||||||
ins_key.objectid = rec->start;
|
ins_key.objectid = rec->start;
|
||||||
ins_key.offset = rec->max_size;
|
|
||||||
ins_key.type = BTRFS_EXTENT_ITEM_KEY;
|
ins_key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
ins_key.offset = rec->max_size;
|
||||||
|
|
||||||
ret = btrfs_insert_empty_item(trans, extent_root, path,
|
ret = btrfs_insert_empty_item(trans, extent_root, path,
|
||||||
&ins_key, item_size);
|
&ins_key, item_size);
|
||||||
@ -8853,9 +8853,9 @@ static int parse_tree_roots(struct list_head *normal_trees,
|
|||||||
int slot;
|
int slot;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.offset = 0;
|
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, gfs_info->tree_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, gfs_info->tree_root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -314,8 +314,8 @@ int count_csum_range(u64 start, u64 len, u64 *found)
|
|||||||
u16 csum_size = gfs_info->csum_size;
|
u16 csum_size = gfs_info->csum_size;
|
||||||
|
|
||||||
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
||||||
key.offset = start;
|
|
||||||
key.type = BTRFS_EXTENT_CSUM_KEY;
|
key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
|
key.offset = start;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, csum_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, csum_root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -417,8 +417,8 @@ static int get_highest_inode(struct btrfs_trans_handle *trans,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = BTRFS_LAST_FREE_OBJECTID;
|
key.objectid = BTRFS_LAST_FREE_OBJECTID;
|
||||||
key.offset = -1;
|
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
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 == 1) {
|
if (ret == 1) {
|
||||||
btrfs_item_key_to_cpu(path->nodes[0], &found_key,
|
btrfs_item_key_to_cpu(path->nodes[0], &found_key,
|
||||||
@ -745,8 +745,8 @@ static int find_file_type_dir_index(struct btrfs_root *root, u64 ino, u64 dirid,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = dirid;
|
key.objectid = dirid;
|
||||||
key.offset = index;
|
|
||||||
key.type = BTRFS_DIR_INDEX_KEY;
|
key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
|
key.offset = index;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
@ -798,8 +798,8 @@ static int find_file_type_dir_item(struct btrfs_root *root, u64 ino, u64 dirid,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = dirid;
|
key.objectid = dirid;
|
||||||
key.offset = btrfs_name_hash(name, name_len);
|
|
||||||
key.type = BTRFS_DIR_INDEX_KEY;
|
key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
|
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);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
@ -1248,8 +1248,8 @@ static int fill_csum_tree_from_one_fs_root(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.offset = 0;
|
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, cur_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, cur_root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
@ -1347,8 +1347,8 @@ static int fill_csum_tree_from_fs(struct btrfs_trans_handle *trans)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.objectid = BTRFS_FS_TREE_OBJECTID;
|
key.objectid = BTRFS_FS_TREE_OBJECTID;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -838,8 +838,8 @@ static int find_dir_index(struct btrfs_root *root, u64 dirid, u64 location_id,
|
|||||||
|
|
||||||
/* search from the last index */
|
/* search from the last index */
|
||||||
key.objectid = dirid;
|
key.objectid = dirid;
|
||||||
key.offset = (u64)-1;
|
|
||||||
key.type = BTRFS_DIR_INDEX_KEY;
|
key.type = BTRFS_DIR_INDEX_KEY;
|
||||||
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -3864,8 +3864,8 @@ static int is_tree_reloc_root(struct extent_buffer *eb)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.objectid = BTRFS_TREE_RELOC_OBJECTID;
|
key.objectid = BTRFS_TREE_RELOC_OBJECTID;
|
||||||
key.offset = owner;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = owner;
|
||||||
|
|
||||||
tree_reloc_root = btrfs_read_fs_root_no_cache(gfs_info, &key);
|
tree_reloc_root = btrfs_read_fs_root_no_cache(gfs_info, &key);
|
||||||
if (IS_ERR(tree_reloc_root))
|
if (IS_ERR(tree_reloc_root))
|
||||||
@ -5483,8 +5483,8 @@ int check_fs_roots_lowmem(void)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
key.objectid = BTRFS_FS_TREE_OBJECTID;
|
key.objectid = BTRFS_FS_TREE_OBJECTID;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, tree_root, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -5597,8 +5597,8 @@ int check_chunks_and_extents_lowmem(void)
|
|||||||
err |= ret;
|
err |= ret;
|
||||||
|
|
||||||
key.objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
key.objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, gfs_info->tree_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, gfs_info->tree_root, &key, &path, 0, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -960,9 +960,9 @@ loop:
|
|||||||
* items. The 2nd pass picks up relation items and glues them to their
|
* items. The 2nd pass picks up relation items and glues them to their
|
||||||
* respective count structures.
|
* respective count structures.
|
||||||
*/
|
*/
|
||||||
key.offset = 0;
|
|
||||||
key.objectid = search_relations ? 0 : BTRFS_QGROUP_RELATION_KEY;
|
key.objectid = search_relations ? 0 : BTRFS_QGROUP_RELATION_KEY;
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -227,9 +227,9 @@ static int populate_used_from_extent_root(struct btrfs_root *root,
|
|||||||
int slot;
|
int slot;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.offset = 0;
|
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -161,10 +161,10 @@ static int load_chunk_info(int fd, struct array *chunkinfos)
|
|||||||
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
||||||
|
|
||||||
sk->min_objectid = 0;
|
sk->min_objectid = 0;
|
||||||
sk->max_objectid = (u64)-1;
|
|
||||||
sk->max_type = 0;
|
|
||||||
sk->min_type = (u8)-1;
|
sk->min_type = (u8)-1;
|
||||||
sk->min_offset = 0;
|
sk->min_offset = 0;
|
||||||
|
sk->max_objectid = (u64)-1;
|
||||||
|
sk->max_type = 0;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->min_transid = 0;
|
sk->min_transid = 0;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
|
@ -580,9 +580,9 @@ again:
|
|||||||
goto close_root;
|
goto close_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
key.offset = 0;
|
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, tree_root_scan, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, tree_root_scan, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
errno = -ret;
|
errno = -ret;
|
||||||
|
@ -570,10 +570,10 @@ static int print_min_dev_size(int fd, u64 devid)
|
|||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_DEV_TREE_OBJECTID;
|
sk->tree_id = BTRFS_DEV_TREE_OBJECTID;
|
||||||
sk->min_objectid = devid;
|
sk->min_objectid = devid;
|
||||||
sk->max_objectid = devid;
|
|
||||||
sk->max_type = BTRFS_DEV_EXTENT_KEY;
|
|
||||||
sk->min_type = BTRFS_DEV_EXTENT_KEY;
|
sk->min_type = BTRFS_DEV_EXTENT_KEY;
|
||||||
sk->min_offset = 0;
|
sk->min_offset = 0;
|
||||||
|
sk->max_objectid = devid;
|
||||||
|
sk->max_type = BTRFS_DEV_EXTENT_KEY;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->min_transid = 0;
|
sk->min_transid = 0;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
@ -980,10 +980,10 @@ static u64 fill_usage(int fd, u64 lstart)
|
|||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_EXTENT_TREE_OBJECTID;
|
sk->tree_id = BTRFS_EXTENT_TREE_OBJECTID;
|
||||||
sk->min_objectid = lstart;
|
sk->min_objectid = lstart;
|
||||||
sk->max_objectid = lstart;
|
|
||||||
sk->min_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
sk->min_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
||||||
sk->max_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
|
||||||
sk->min_offset = 0;
|
sk->min_offset = 0;
|
||||||
|
sk->max_objectid = lstart;
|
||||||
|
sk->max_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
sk->nr_items = 1;
|
sk->nr_items = 1;
|
||||||
@ -1089,8 +1089,8 @@ static int cmd_inspect_list_chunks(const struct cmd_struct *cmd,
|
|||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
||||||
sk->min_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
sk->min_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
||||||
sk->max_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
|
||||||
sk->min_type = BTRFS_CHUNK_ITEM_KEY;
|
sk->min_type = BTRFS_CHUNK_ITEM_KEY;
|
||||||
|
sk->max_objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
||||||
sk->max_type = BTRFS_CHUNK_ITEM_KEY;
|
sk->max_type = BTRFS_CHUNK_ITEM_KEY;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
|
@ -1354,9 +1354,9 @@ next:
|
|||||||
* record the mins in sk so we can make sure the
|
* record the mins in sk so we can make sure the
|
||||||
* next search doesn't repeat this root
|
* next search doesn't repeat this root
|
||||||
*/
|
*/
|
||||||
|
sk->min_objectid = key.objectid;
|
||||||
sk->min_type = key.type;
|
sk->min_type = key.type;
|
||||||
sk->min_offset = key.offset;
|
sk->min_offset = key.offset;
|
||||||
sk->min_objectid = key.objectid;
|
|
||||||
}
|
}
|
||||||
sk->nr_items = 4096;
|
sk->nr_items = 4096;
|
||||||
/*
|
/*
|
||||||
@ -1410,10 +1410,11 @@ int btrfs_qgroup_query(int fd, u64 qgroupid, struct btrfs_qgroup_stats *stats)
|
|||||||
memset(&args, 0, sizeof(args));
|
memset(&args, 0, sizeof(args));
|
||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_QUOTA_TREE_OBJECTID;
|
sk->tree_id = BTRFS_QUOTA_TREE_OBJECTID;
|
||||||
|
sk->min_objectid = 0;
|
||||||
sk->min_type = BTRFS_QGROUP_INFO_KEY;
|
sk->min_type = BTRFS_QGROUP_INFO_KEY;
|
||||||
sk->max_type = BTRFS_QGROUP_LIMIT_KEY;
|
|
||||||
sk->max_objectid = 0;
|
|
||||||
sk->min_offset = qgroupid;
|
sk->min_offset = qgroupid;
|
||||||
|
sk->max_objectid = 0;
|
||||||
|
sk->max_type = BTRFS_QGROUP_LIMIT_KEY;
|
||||||
sk->max_offset = qgroupid;
|
sk->max_offset = qgroupid;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
sk->nr_items = 4096;
|
sk->nr_items = 4096;
|
||||||
|
@ -592,8 +592,8 @@ static int check_chunk_by_metadata(struct recover_control *rc,
|
|||||||
stripe = &chunk->stripes[i];
|
stripe = &chunk->stripes[i];
|
||||||
|
|
||||||
key.objectid = stripe->devid;
|
key.objectid = stripe->devid;
|
||||||
key.offset = stripe->offset;
|
|
||||||
key.type = BTRFS_DEV_EXTENT_KEY;
|
key.type = BTRFS_DEV_EXTENT_KEY;
|
||||||
|
key.offset = stripe->offset;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, dev_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, dev_root, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -1016,8 +1016,8 @@ static int block_group_remove_all_extent_items(struct btrfs_trans_handle *trans,
|
|||||||
root = btrfs_extent_root(fs_info, start);
|
root = btrfs_extent_root(fs_info, start);
|
||||||
|
|
||||||
key.objectid = start;
|
key.objectid = start;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
again:
|
again:
|
||||||
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)
|
||||||
|
@ -1167,9 +1167,9 @@ static int do_list_roots(struct btrfs_root *root)
|
|||||||
|
|
||||||
root = root->fs_info->tree_root;
|
root = root->fs_info->tree_root;
|
||||||
|
|
||||||
key.offset = 0;
|
|
||||||
key.objectid = 0;
|
key.objectid = 0;
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
error("failed search next root item: %d", ret);
|
error("failed search next root item: %d", ret);
|
||||||
|
@ -972,9 +972,9 @@ static u64 find_root_gen(int fd)
|
|||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
sk->min_objectid = ino_args.treeid;
|
sk->min_objectid = ino_args.treeid;
|
||||||
|
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->max_objectid = ino_args.treeid;
|
sk->max_objectid = ino_args.treeid;
|
||||||
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
sk->nr_items = 4096;
|
sk->nr_items = 4096;
|
||||||
|
@ -221,8 +221,8 @@ static int __btrfs_record_file_extent(struct btrfs_trans_handle *trans,
|
|||||||
}
|
}
|
||||||
btrfs_release_path(path);
|
btrfs_release_path(path);
|
||||||
ins_key.objectid = objectid;
|
ins_key.objectid = objectid;
|
||||||
ins_key.offset = file_pos;
|
|
||||||
ins_key.type = BTRFS_EXTENT_DATA_KEY;
|
ins_key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
ins_key.offset = file_pos;
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &ins_key, sizeof(*fi));
|
ret = btrfs_insert_empty_item(trans, root, path, &ins_key, sizeof(*fi));
|
||||||
if (ret)
|
if (ret)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -730,10 +730,10 @@ int btrfs_tree_search2_ioctl_supported(int fd)
|
|||||||
*/
|
*/
|
||||||
sk->tree_id = BTRFS_ROOT_TREE_OBJECTID;
|
sk->tree_id = BTRFS_ROOT_TREE_OBJECTID;
|
||||||
sk->min_objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
sk->min_objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
||||||
sk->max_objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
|
||||||
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
|
||||||
sk->min_offset = 0;
|
sk->min_offset = 0;
|
||||||
|
sk->max_objectid = BTRFS_EXTENT_TREE_OBJECTID;
|
||||||
|
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->min_transid = 0;
|
sk->min_transid = 0;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
|
@ -80,9 +80,9 @@ static int btrfs_read_root_item_raw(int mnt_fd, u64 root_id, size_t buf_len,
|
|||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
sk->min_objectid = root_id;
|
sk->min_objectid = root_id;
|
||||||
|
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->max_objectid = root_id;
|
sk->max_objectid = root_id;
|
||||||
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
sk->max_type = BTRFS_ROOT_ITEM_KEY;
|
||||||
sk->min_type = BTRFS_ROOT_ITEM_KEY;
|
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
sk->nr_items = 4096;
|
sk->nr_items = 4096;
|
||||||
@ -210,8 +210,8 @@ static int btrfs_subvolid_resolve_sub(int fd, char *path, size_t *path_len,
|
|||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_ROOT_TREE_OBJECTID;
|
sk->tree_id = BTRFS_ROOT_TREE_OBJECTID;
|
||||||
sk->min_objectid = subvol_id;
|
sk->min_objectid = subvol_id;
|
||||||
sk->max_objectid = subvol_id;
|
|
||||||
sk->min_type = BTRFS_ROOT_BACKREF_KEY;
|
sk->min_type = BTRFS_ROOT_BACKREF_KEY;
|
||||||
|
sk->max_objectid = subvol_id;
|
||||||
sk->max_type = BTRFS_ROOT_BACKREF_KEY;
|
sk->max_type = BTRFS_ROOT_BACKREF_KEY;
|
||||||
sk->max_offset = (u64)-1;
|
sk->max_offset = (u64)-1;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
|
@ -154,8 +154,8 @@ static int search_chunk_tree_for_fs_info(int fd,
|
|||||||
sk = btrfs_tree_search_sk(&args);
|
sk = btrfs_tree_search_sk(&args);
|
||||||
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
sk->tree_id = BTRFS_CHUNK_TREE_OBJECTID;
|
||||||
sk->min_objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
sk->min_objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
||||||
sk->max_objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
|
||||||
sk->min_type = BTRFS_DEV_ITEM_KEY;
|
sk->min_type = BTRFS_DEV_ITEM_KEY;
|
||||||
|
sk->max_objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
||||||
sk->max_type = BTRFS_DEV_ITEM_KEY;
|
sk->max_type = BTRFS_DEV_ITEM_KEY;
|
||||||
sk->min_transid = 0;
|
sk->min_transid = 0;
|
||||||
sk->max_transid = (u64)-1;
|
sk->max_transid = (u64)-1;
|
||||||
|
@ -1274,8 +1274,8 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
|
|||||||
snprintf(subvol_name, sizeof(subvol_name), "%s_saved",
|
snprintf(subvol_name, sizeof(subvol_name), "%s_saved",
|
||||||
cctx.convert_ops->name);
|
cctx.convert_ops->name);
|
||||||
key.objectid = CONV_IMAGE_SUBVOL_OBJECTID;
|
key.objectid = CONV_IMAGE_SUBVOL_OBJECTID;
|
||||||
key.offset = (u64)-1;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = (u64)-1;
|
||||||
image_root = btrfs_read_fs_root(root->fs_info, &key);
|
image_root = btrfs_read_fs_root(root->fs_info, &key);
|
||||||
if (!image_root) {
|
if (!image_root) {
|
||||||
error("unable to create image subvolume");
|
error("unable to create image subvolume");
|
||||||
@ -1486,8 +1486,8 @@ static int check_convert_image(struct btrfs_root *image_root, u64 ino,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = ino;
|
key.objectid = ino;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, image_root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, image_root, &key, &path, 0, 0);
|
||||||
/*
|
/*
|
||||||
|
@ -188,8 +188,8 @@ int convert_insert_dirent(struct btrfs_trans_handle *trans,
|
|||||||
struct btrfs_inode_item dummy_iitem = { 0 };
|
struct btrfs_inode_item dummy_iitem = { 0 };
|
||||||
struct btrfs_key location = {
|
struct btrfs_key location = {
|
||||||
.objectid = objectid,
|
.objectid = objectid,
|
||||||
.offset = 0,
|
|
||||||
.type = BTRFS_INODE_ITEM_KEY,
|
.type = BTRFS_INODE_ITEM_KEY,
|
||||||
|
.offset = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
ret = btrfs_insert_dir_item(trans, root, name, name_len,
|
ret = btrfs_insert_dir_item(trans, root, name, name_len,
|
||||||
|
@ -670,17 +670,17 @@ static inline void btrfs_dir_item_key_to_cpu(const struct extent_buffer *eb,
|
|||||||
static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
|
static inline void btrfs_disk_key_to_cpu(struct btrfs_key *cpu,
|
||||||
const struct btrfs_disk_key *disk)
|
const struct btrfs_disk_key *disk)
|
||||||
{
|
{
|
||||||
cpu->offset = le64_to_cpu(disk->offset);
|
|
||||||
cpu->type = disk->type;
|
|
||||||
cpu->objectid = le64_to_cpu(disk->objectid);
|
cpu->objectid = le64_to_cpu(disk->objectid);
|
||||||
|
cpu->type = disk->type;
|
||||||
|
cpu->offset = le64_to_cpu(disk->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
|
static inline void btrfs_cpu_key_to_disk(struct btrfs_disk_key *disk,
|
||||||
const struct btrfs_key *cpu)
|
const struct btrfs_key *cpu)
|
||||||
{
|
{
|
||||||
disk->offset = cpu_to_le64(cpu->offset);
|
|
||||||
disk->type = cpu->type;
|
|
||||||
disk->objectid = cpu_to_le64(cpu->objectid);
|
disk->objectid = cpu_to_le64(cpu->objectid);
|
||||||
|
disk->type = cpu->type;
|
||||||
|
disk->offset = cpu_to_le64(cpu->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void btrfs_node_key_to_cpu(const struct extent_buffer *eb,
|
static inline void btrfs_node_key_to_cpu(const struct extent_buffer *eb,
|
||||||
|
@ -770,11 +770,11 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
|
|||||||
init_pref_state(&prefstate);
|
init_pref_state(&prefstate);
|
||||||
|
|
||||||
key.objectid = bytenr;
|
key.objectid = bytenr;
|
||||||
key.offset = (u64)-1;
|
|
||||||
if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
|
if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
|
||||||
key.type = BTRFS_METADATA_ITEM_KEY;
|
key.type = BTRFS_METADATA_ITEM_KEY;
|
||||||
else
|
else
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -1172,11 +1172,11 @@ int extent_from_logical(struct btrfs_fs_info *fs_info, u64 logical,
|
|||||||
struct btrfs_extent_item *ei;
|
struct btrfs_extent_item *ei;
|
||||||
struct btrfs_key key;
|
struct btrfs_key key;
|
||||||
|
|
||||||
|
key.objectid = logical;
|
||||||
if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
|
if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
|
||||||
key.type = BTRFS_METADATA_ITEM_KEY;
|
key.type = BTRFS_METADATA_ITEM_KEY;
|
||||||
else
|
else
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
key.objectid = logical;
|
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
|
||||||
|
@ -1250,8 +1250,8 @@ int btrfs_find_item(struct btrfs_root *fs_root, struct btrfs_path *found_path,
|
|||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
struct btrfs_path *path;
|
struct btrfs_path *path;
|
||||||
|
|
||||||
key.type = key_type;
|
|
||||||
key.objectid = iobjectid;
|
key.objectid = iobjectid;
|
||||||
|
key.type = key_type;
|
||||||
key.offset = ioff;
|
key.offset = ioff;
|
||||||
|
|
||||||
if (found_path == NULL) {
|
if (found_path == NULL) {
|
||||||
|
@ -229,7 +229,6 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
key.objectid = dir;
|
key.objectid = dir;
|
||||||
key.type = 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(trans, root, &key, path, ins_len, cow);
|
ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
|
||||||
|
@ -123,8 +123,8 @@ static int cache_block_group(struct btrfs_root *root,
|
|||||||
path->reada = READA_FORWARD;
|
path->reada = READA_FORWARD;
|
||||||
last = max_t(u64, block_group->start, BTRFS_SUPER_INFO_OFFSET);
|
last = max_t(u64, block_group->start, BTRFS_SUPER_INFO_OFFSET);
|
||||||
key.objectid = last;
|
key.objectid = last;
|
||||||
key.offset = 0;
|
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1325,11 +1325,11 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = bytenr;
|
key.objectid = bytenr;
|
||||||
key.offset = offset;
|
|
||||||
if (metadata)
|
if (metadata)
|
||||||
key.type = BTRFS_METADATA_ITEM_KEY;
|
key.type = BTRFS_METADATA_ITEM_KEY;
|
||||||
else
|
else
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
key.offset = offset;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
ret = btrfs_search_slot(trans, extent_root, &key, path, 0, 0);
|
ret = btrfs_search_slot(trans, extent_root, &key, path, 0, 0);
|
||||||
@ -1409,11 +1409,11 @@ int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
key.objectid = bytenr;
|
key.objectid = bytenr;
|
||||||
if (skinny_metadata) {
|
if (skinny_metadata) {
|
||||||
key.offset = btrfs_header_level(eb);
|
|
||||||
key.type = BTRFS_METADATA_ITEM_KEY;
|
key.type = BTRFS_METADATA_ITEM_KEY;
|
||||||
|
key.offset = btrfs_header_level(eb);
|
||||||
} else {
|
} else {
|
||||||
key.offset = fs_info->nodesize;
|
|
||||||
key.type = BTRFS_EXTENT_ITEM_KEY;
|
key.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
key.offset = fs_info->nodesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
again:
|
again:
|
||||||
@ -2420,12 +2420,11 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
ins.objectid = node->bytenr;
|
ins.objectid = node->bytenr;
|
||||||
if (skinny_metadata) {
|
if (skinny_metadata) {
|
||||||
ins.offset = ref->level;
|
|
||||||
ins.type = BTRFS_METADATA_ITEM_KEY;
|
ins.type = BTRFS_METADATA_ITEM_KEY;
|
||||||
|
ins.offset = ref->level;
|
||||||
} else {
|
} else {
|
||||||
ins.offset = node->num_bytes;
|
|
||||||
ins.type = BTRFS_EXTENT_ITEM_KEY;
|
ins.type = BTRFS_EXTENT_ITEM_KEY;
|
||||||
|
ins.offset = node->num_bytes;
|
||||||
size += sizeof(struct btrfs_tree_block_info);
|
size += sizeof(struct btrfs_tree_block_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3217,8 +3216,8 @@ static int remove_block_group_item(struct btrfs_trans_handle *trans,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
key.objectid = block_group->start;
|
key.objectid = block_group->start;
|
||||||
key.offset = block_group->length;
|
|
||||||
key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
key.type = BTRFS_BLOCK_GROUP_ITEM_KEY;
|
||||||
|
key.offset = block_group->length;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we're doing convert and the bg is beyond our last converted bg,
|
* If we're doing convert and the bg is beyond our last converted bg,
|
||||||
@ -3348,8 +3347,8 @@ static int free_system_chunk_item(struct btrfs_super_block *super,
|
|||||||
sizeof(*disk_key);
|
sizeof(*disk_key);
|
||||||
|
|
||||||
if (key->objectid == cpu_key.objectid &&
|
if (key->objectid == cpu_key.objectid &&
|
||||||
key->offset == cpu_key.offset &&
|
key->type == cpu_key.type &&
|
||||||
key->type == cpu_key.type) {
|
key->offset == cpu_key.offset) {
|
||||||
memmove(ptr + cur, ptr + cur + chunk_len,
|
memmove(ptr + cur, ptr + cur + chunk_len,
|
||||||
array_size - cur - chunk_len);
|
array_size - cur - chunk_len);
|
||||||
array_size -= chunk_len;
|
array_size -= chunk_len;
|
||||||
@ -3376,8 +3375,8 @@ static int free_chunk_item(struct btrfs_trans_handle *trans,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
||||||
key.offset = bytenr;
|
|
||||||
key.type = BTRFS_CHUNK_ITEM_KEY;
|
key.type = BTRFS_CHUNK_ITEM_KEY;
|
||||||
|
key.offset = bytenr;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
|
@ -57,8 +57,8 @@ 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.type = BTRFS_EXTENT_DATA_KEY;
|
file_key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
file_key.offset = pos;
|
||||||
|
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
ret = btrfs_insert_empty_item(trans, root, path, &file_key,
|
||||||
sizeof(*item));
|
sizeof(*item));
|
||||||
@ -102,8 +102,8 @@ int btrfs_insert_inline_extent(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = objectid;
|
key.objectid = objectid;
|
||||||
key.offset = offset;
|
|
||||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
key.offset = offset;
|
||||||
|
|
||||||
datasize = btrfs_file_extent_calc_inline_size(size);
|
datasize = btrfs_file_extent_calc_inline_size(size);
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &key, datasize);
|
ret = btrfs_insert_empty_item(trans, root, path, &key, datasize);
|
||||||
@ -146,8 +146,8 @@ btrfs_lookup_csum(struct btrfs_trans_handle *trans,
|
|||||||
int csums_in_item;
|
int csums_in_item;
|
||||||
|
|
||||||
file_key.objectid = csum_objectid;
|
file_key.objectid = csum_objectid;
|
||||||
file_key.offset = bytenr;
|
|
||||||
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
|
file_key.offset = bytenr;
|
||||||
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;
|
||||||
@ -207,8 +207,8 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, u64 logical,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
file_key.objectid = csum_objectid;
|
file_key.objectid = csum_objectid;
|
||||||
file_key.offset = logical;
|
|
||||||
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
file_key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
|
file_key.offset = logical;
|
||||||
|
|
||||||
item = btrfs_lookup_csum(trans, root, path, logical, csum_objectid,
|
item = btrfs_lookup_csum(trans, root, path, logical, csum_objectid,
|
||||||
csum_type, 1);
|
csum_type, 1);
|
||||||
@ -406,8 +406,8 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, struct btrfs_root *root,
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
|
||||||
key.offset = end_byte - 1;
|
|
||||||
key.type = BTRFS_EXTENT_CSUM_KEY;
|
key.type = BTRFS_EXTENT_CSUM_KEY;
|
||||||
|
key.offset = end_byte - 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) {
|
||||||
|
@ -211,8 +211,8 @@ int btrfs_read_file(struct btrfs_root *root, u64 ino, u64 start, int len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
key.objectid = ino;
|
key.objectid = ino;
|
||||||
key.offset = start;
|
|
||||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||||
|
key.offset = start;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -317,8 +317,8 @@ next:
|
|||||||
if (no_holes) {
|
if (no_holes) {
|
||||||
btrfs_release_path(&path);
|
btrfs_release_path(&path);
|
||||||
key.objectid = ino;
|
key.objectid = ino;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_lookup_inode(NULL, root, &path, &key, 0);
|
ret = btrfs_lookup_inode(NULL, root, &path, &key, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -306,8 +306,8 @@ static int __load_free_space_cache(struct btrfs_root *root,
|
|||||||
INIT_LIST_HEAD(&bitmaps);
|
INIT_LIST_HEAD(&bitmaps);
|
||||||
|
|
||||||
key.objectid = BTRFS_FREE_SPACE_OBJECTID;
|
key.objectid = BTRFS_FREE_SPACE_OBJECTID;
|
||||||
key.offset = offset;
|
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
|
key.offset = offset;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -69,8 +69,8 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
|
|||||||
int ins_len = name_len + sizeof(*ref);
|
int ins_len = name_len + sizeof(*ref);
|
||||||
|
|
||||||
key.objectid = inode_objectid;
|
key.objectid = inode_objectid;
|
||||||
key.offset = ref_objectid;
|
|
||||||
key.type = BTRFS_INODE_REF_KEY;
|
key.type = BTRFS_INODE_REF_KEY;
|
||||||
|
key.offset = ref_objectid;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -398,8 +398,8 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
|
|||||||
int del_len = name_len + sizeof(*ref);
|
int del_len = name_len + sizeof(*ref);
|
||||||
|
|
||||||
key.objectid = ino;
|
key.objectid = ino;
|
||||||
key.offset = parent_ino;
|
|
||||||
key.type = BTRFS_INODE_REF_KEY;
|
key.type = BTRFS_INODE_REF_KEY;
|
||||||
|
key.offset = parent_ino;
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path)
|
if (!path)
|
||||||
|
@ -633,8 +633,8 @@ struct btrfs_root *btrfs_mksubvol(struct btrfs_root *root,
|
|||||||
}
|
}
|
||||||
|
|
||||||
key.objectid = dirid;
|
key.objectid = dirid;
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
|
|
||||||
ret = btrfs_lookup_inode(trans, root, &path, &key, 1);
|
ret = btrfs_lookup_inode(trans, root, &path, &key, 1);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -647,8 +647,8 @@ struct btrfs_root *btrfs_mksubvol(struct btrfs_root *root,
|
|||||||
struct btrfs_inode_item);
|
struct btrfs_inode_item);
|
||||||
|
|
||||||
key.objectid = root_objectid;
|
key.objectid = root_objectid;
|
||||||
key.offset = (u64)-1;
|
|
||||||
key.type = BTRFS_ROOT_ITEM_KEY;
|
key.type = BTRFS_ROOT_ITEM_KEY;
|
||||||
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
memcpy(buf, base, len);
|
memcpy(buf, base, len);
|
||||||
if (convert) {
|
if (convert) {
|
||||||
@ -737,8 +737,8 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
|
|||||||
search_start = max((unsigned long long)search_start,
|
search_start = max((unsigned long long)search_start,
|
||||||
BTRFS_FIRST_FREE_OBJECTID);
|
BTRFS_FIRST_FREE_OBJECTID);
|
||||||
search_key.objectid = search_start;
|
search_key.objectid = search_start;
|
||||||
search_key.offset = 0;
|
|
||||||
search_key.type = 0;
|
search_key.type = 0;
|
||||||
|
search_key.offset = 0;
|
||||||
|
|
||||||
start_found = 0;
|
start_found = 0;
|
||||||
ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0);
|
ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0);
|
||||||
|
@ -63,10 +63,10 @@ static int btrfs_uuid_tree_lookup_any(int fd, const u8 *uuid, u8 type,
|
|||||||
memset(&search_arg, 0, sizeof(search_arg));
|
memset(&search_arg, 0, sizeof(search_arg));
|
||||||
search_arg.key.tree_id = BTRFS_UUID_TREE_OBJECTID;
|
search_arg.key.tree_id = BTRFS_UUID_TREE_OBJECTID;
|
||||||
search_arg.key.min_objectid = key.objectid;
|
search_arg.key.min_objectid = key.objectid;
|
||||||
search_arg.key.max_objectid = key.objectid;
|
|
||||||
search_arg.key.min_type = type;
|
search_arg.key.min_type = type;
|
||||||
search_arg.key.max_type = type;
|
|
||||||
search_arg.key.min_offset = key.offset;
|
search_arg.key.min_offset = key.offset;
|
||||||
|
search_arg.key.max_objectid = key.objectid;
|
||||||
|
search_arg.key.max_type = type;
|
||||||
search_arg.key.max_offset = key.offset;
|
search_arg.key.max_offset = key.offset;
|
||||||
search_arg.key.max_transid = (u64)-1;
|
search_arg.key.max_transid = (u64)-1;
|
||||||
search_arg.key.nr_items = 1;
|
search_arg.key.nr_items = 1;
|
||||||
|
@ -871,8 +871,8 @@ again:
|
|||||||
path->reada = READA_FORWARD;
|
path->reada = READA_FORWARD;
|
||||||
|
|
||||||
key.objectid = device->devid;
|
key.objectid = device->devid;
|
||||||
key.offset = search_start;
|
|
||||||
key.type = BTRFS_DEV_EXTENT_KEY;
|
key.type = BTRFS_DEV_EXTENT_KEY;
|
||||||
|
key.offset = search_start;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1006,8 +1006,8 @@ int btrfs_insert_dev_extent(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = device->devid;
|
key.objectid = device->devid;
|
||||||
key.offset = start;
|
|
||||||
key.type = BTRFS_DEV_EXTENT_KEY;
|
key.type = BTRFS_DEV_EXTENT_KEY;
|
||||||
|
key.offset = start;
|
||||||
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
ret = btrfs_insert_empty_item(trans, root, path, &key,
|
||||||
sizeof(*extent));
|
sizeof(*extent));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1062,8 +1062,8 @@ static int find_next_chunk(struct btrfs_fs_info *fs_info, u64 *offset)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
key.objectid = BTRFS_FIRST_CHUNK_TREE_OBJECTID;
|
||||||
key.offset = (u64)-1;
|
|
||||||
key.type = BTRFS_CHUNK_ITEM_KEY;
|
key.type = BTRFS_CHUNK_ITEM_KEY;
|
||||||
|
key.offset = (u64)-1;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@ -1302,8 +1302,8 @@ static int btrfs_device_avail_bytes(struct btrfs_trans_handle *trans,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
key.objectid = device->devid;
|
key.objectid = device->devid;
|
||||||
key.offset = search_start;
|
|
||||||
key.type = BTRFS_DEV_EXTENT_KEY;
|
key.type = BTRFS_DEV_EXTENT_KEY;
|
||||||
|
key.offset = search_start;
|
||||||
|
|
||||||
path->reada = READA_FORWARD;
|
path->reada = READA_FORWARD;
|
||||||
ret = btrfs_search_slot(trans, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(trans, root, &key, path, 0, 0);
|
||||||
@ -2663,8 +2663,8 @@ int btrfs_read_chunk_tree(struct btrfs_fs_info *fs_info)
|
|||||||
* item - BTRFS_FIRST_CHUNK_TREE_OBJECTID).
|
* item - BTRFS_FIRST_CHUNK_TREE_OBJECTID).
|
||||||
*/
|
*/
|
||||||
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
key.objectid = BTRFS_DEV_ITEMS_OBJECTID;
|
||||||
key.offset = 0;
|
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -76,8 +76,8 @@ static int add_directory_items(struct btrfs_trans_handle *trans,
|
|||||||
name_len = strlen(name);
|
name_len = strlen(name);
|
||||||
|
|
||||||
location.objectid = objectid;
|
location.objectid = objectid;
|
||||||
location.offset = 0;
|
|
||||||
location.type = BTRFS_INODE_ITEM_KEY;
|
location.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
location.offset = 0;
|
||||||
|
|
||||||
if (S_ISDIR(st->st_mode))
|
if (S_ISDIR(st->st_mode))
|
||||||
filetype = BTRFS_FT_DIR;
|
filetype = BTRFS_FT_DIR;
|
||||||
@ -455,8 +455,8 @@ static int copy_rootdir_inode(struct btrfs_trans_handle *trans,
|
|||||||
}
|
}
|
||||||
|
|
||||||
key.objectid = btrfs_root_dirid(&root->root_item);
|
key.objectid = btrfs_root_dirid(&root->root_item);
|
||||||
key.offset = 0;
|
|
||||||
key.type = BTRFS_INODE_ITEM_KEY;
|
key.type = BTRFS_INODE_ITEM_KEY;
|
||||||
|
key.offset = 0;
|
||||||
ret = btrfs_lookup_inode(trans, root, &path, &key, 1);
|
ret = btrfs_lookup_inode(trans, root, &path, &key, 1);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
|
Loading…
Reference in New Issue
Block a user