Lines Matching refs:leaf
1855 struct extent_buffer *leaf = NULL; in btrfs_free_dev_extent() local
1872 leaf = path->nodes[0]; in btrfs_free_dev_extent()
1873 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_free_dev_extent()
1874 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_free_dev_extent()
1877 btrfs_dev_extent_length(leaf, extent) < start); in btrfs_free_dev_extent()
1882 leaf = path->nodes[0]; in btrfs_free_dev_extent()
1883 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_free_dev_extent()
1890 *dev_extent_len = btrfs_dev_extent_length(leaf, extent); in btrfs_free_dev_extent()
1913 struct extent_buffer *leaf; in btrfs_alloc_dev_extent() local
1930 leaf = path->nodes[0]; in btrfs_alloc_dev_extent()
1931 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_alloc_dev_extent()
1933 btrfs_set_dev_extent_chunk_tree(leaf, extent, in btrfs_alloc_dev_extent()
1935 btrfs_set_dev_extent_chunk_objectid(leaf, extent, in btrfs_alloc_dev_extent()
1937 btrfs_set_dev_extent_chunk_offset(leaf, extent, chunk_offset); in btrfs_alloc_dev_extent()
1939 btrfs_set_dev_extent_length(leaf, extent, num_bytes); in btrfs_alloc_dev_extent()
1940 btrfs_mark_buffer_dirty(leaf); in btrfs_alloc_dev_extent()
2018 struct extent_buffer *leaf; in btrfs_add_dev_item() local
2035 leaf = path->nodes[0]; in btrfs_add_dev_item()
2036 dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item); in btrfs_add_dev_item()
2038 btrfs_set_device_id(leaf, dev_item, device->devid); in btrfs_add_dev_item()
2039 btrfs_set_device_generation(leaf, dev_item, 0); in btrfs_add_dev_item()
2040 btrfs_set_device_type(leaf, dev_item, device->type); in btrfs_add_dev_item()
2041 btrfs_set_device_io_align(leaf, dev_item, device->io_align); in btrfs_add_dev_item()
2042 btrfs_set_device_io_width(leaf, dev_item, device->io_width); in btrfs_add_dev_item()
2043 btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); in btrfs_add_dev_item()
2044 btrfs_set_device_total_bytes(leaf, dev_item, in btrfs_add_dev_item()
2046 btrfs_set_device_bytes_used(leaf, dev_item, in btrfs_add_dev_item()
2048 btrfs_set_device_group(leaf, dev_item, 0); in btrfs_add_dev_item()
2049 btrfs_set_device_seek_speed(leaf, dev_item, 0); in btrfs_add_dev_item()
2050 btrfs_set_device_bandwidth(leaf, dev_item, 0); in btrfs_add_dev_item()
2051 btrfs_set_device_start_offset(leaf, dev_item, 0); in btrfs_add_dev_item()
2054 write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); in btrfs_add_dev_item()
2056 write_extent_buffer(leaf, trans->fs_info->fs_devices->metadata_uuid, in btrfs_add_dev_item()
2058 btrfs_mark_buffer_dirty(leaf); in btrfs_add_dev_item()
2612 struct extent_buffer *leaf; in btrfs_finish_sprout() local
2634 leaf = path->nodes[0]; in btrfs_finish_sprout()
2636 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_finish_sprout()
2642 leaf = path->nodes[0]; in btrfs_finish_sprout()
2643 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_finish_sprout()
2648 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_finish_sprout()
2653 dev_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_finish_sprout()
2655 devid = btrfs_device_id(leaf, dev_item); in btrfs_finish_sprout()
2656 read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item), in btrfs_finish_sprout()
2658 read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item), in btrfs_finish_sprout()
2665 btrfs_set_device_generation(leaf, dev_item, in btrfs_finish_sprout()
2667 btrfs_mark_buffer_dirty(leaf); in btrfs_finish_sprout()
2915 struct extent_buffer *leaf; in btrfs_update_device() local
2935 leaf = path->nodes[0]; in btrfs_update_device()
2936 dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item); in btrfs_update_device()
2938 btrfs_set_device_id(leaf, dev_item, device->devid); in btrfs_update_device()
2939 btrfs_set_device_type(leaf, dev_item, device->type); in btrfs_update_device()
2940 btrfs_set_device_io_align(leaf, dev_item, device->io_align); in btrfs_update_device()
2941 btrfs_set_device_io_width(leaf, dev_item, device->io_width); in btrfs_update_device()
2942 btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); in btrfs_update_device()
2943 btrfs_set_device_total_bytes(leaf, dev_item, in btrfs_update_device()
2945 btrfs_set_device_bytes_used(leaf, dev_item, in btrfs_update_device()
2947 btrfs_mark_buffer_dirty(leaf); in btrfs_update_device()
3246 struct extent_buffer *leaf; in btrfs_relocate_sys_chunks() local
3292 leaf = path->nodes[0]; in btrfs_relocate_sys_chunks()
3293 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_relocate_sys_chunks()
3295 chunk = btrfs_item_ptr(leaf, path->slots[0], in btrfs_relocate_sys_chunks()
3297 chunk_type = btrfs_chunk_type(leaf, chunk); in btrfs_relocate_sys_chunks()
3375 struct extent_buffer *leaf; in insert_balance_item() local
3398 leaf = path->nodes[0]; in insert_balance_item()
3399 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item); in insert_balance_item()
3401 memzero_extent_buffer(leaf, (unsigned long)item, sizeof(*item)); in insert_balance_item()
3404 btrfs_set_balance_data(leaf, item, &disk_bargs); in insert_balance_item()
3406 btrfs_set_balance_meta(leaf, item, &disk_bargs); in insert_balance_item()
3408 btrfs_set_balance_sys(leaf, item, &disk_bargs); in insert_balance_item()
3410 btrfs_set_balance_flags(leaf, item, bctl->flags); in insert_balance_item()
3412 btrfs_mark_buffer_dirty(leaf); in insert_balance_item()
3597 static int chunk_devid_filter(struct extent_buffer *leaf, in chunk_devid_filter() argument
3602 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_devid_filter()
3607 if (btrfs_stripe_devid(leaf, stripe) == bargs->devid) in chunk_devid_filter()
3627 static int chunk_drange_filter(struct extent_buffer *leaf, in chunk_drange_filter() argument
3632 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_drange_filter()
3642 type = btrfs_chunk_type(leaf, chunk); in chunk_drange_filter()
3647 if (btrfs_stripe_devid(leaf, stripe) != bargs->devid) in chunk_drange_filter()
3650 stripe_offset = btrfs_stripe_offset(leaf, stripe); in chunk_drange_filter()
3651 stripe_length = btrfs_chunk_length(leaf, chunk); in chunk_drange_filter()
3663 static int chunk_vrange_filter(struct extent_buffer *leaf, in chunk_vrange_filter() argument
3669 chunk_offset + btrfs_chunk_length(leaf, chunk) > bargs->vstart) in chunk_vrange_filter()
3676 static int chunk_stripes_range_filter(struct extent_buffer *leaf, in chunk_stripes_range_filter() argument
3680 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_stripes_range_filter()
3704 static int should_balance_chunk(struct extent_buffer *leaf, in should_balance_chunk() argument
3707 struct btrfs_fs_info *fs_info = leaf->fs_info; in should_balance_chunk()
3710 u64 chunk_type = btrfs_chunk_type(leaf, chunk); in should_balance_chunk()
3742 chunk_devid_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3748 chunk_drange_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3754 chunk_vrange_filter(leaf, chunk, chunk_offset, bargs)) { in should_balance_chunk()
3760 chunk_stripes_range_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3802 struct extent_buffer *leaf; in __btrfs_balance() local
3869 leaf = path->nodes[0]; in __btrfs_balance()
3871 btrfs_item_key_to_cpu(leaf, &found_key, slot); in __btrfs_balance()
3878 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in __btrfs_balance()
3879 chunk_type = btrfs_chunk_type(leaf, chunk); in __btrfs_balance()
3887 ret = should_balance_chunk(leaf, chunk, found_key.offset); in __btrfs_balance()
4442 struct extent_buffer *leaf; in btrfs_recover_balance() local
4468 leaf = path->nodes[0]; in btrfs_recover_balance()
4469 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item); in btrfs_recover_balance()
4471 bctl->flags = btrfs_balance_flags(leaf, item); in btrfs_recover_balance()
4474 btrfs_balance_data(leaf, item, &disk_bargs); in btrfs_recover_balance()
4476 btrfs_balance_meta(leaf, item, &disk_bargs); in btrfs_recover_balance()
4478 btrfs_balance_sys(leaf, item, &disk_bargs); in btrfs_recover_balance()
6907 static int read_one_chunk(struct btrfs_key *key, struct extent_buffer *leaf, in read_one_chunk() argument
6910 struct btrfs_fs_info *fs_info = leaf->fs_info; in read_one_chunk()
6923 length = btrfs_chunk_length(leaf, chunk); in read_one_chunk()
6924 num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in read_one_chunk()
6930 if (leaf->start == BTRFS_SUPER_INFO_OFFSET) { in read_one_chunk()
6931 ret = btrfs_check_chunk_valid(leaf, chunk, logical); in read_one_chunk()
6966 map->io_width = btrfs_chunk_io_width(leaf, chunk); in read_one_chunk()
6967 map->io_align = btrfs_chunk_io_align(leaf, chunk); in read_one_chunk()
6968 map->stripe_len = btrfs_chunk_stripe_len(leaf, chunk); in read_one_chunk()
6969 map->type = btrfs_chunk_type(leaf, chunk); in read_one_chunk()
6970 map->sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk); in read_one_chunk()
6976 btrfs_stripe_offset_nr(leaf, chunk, i); in read_one_chunk()
6977 devid = btrfs_stripe_devid_nr(leaf, chunk, i); in read_one_chunk()
6978 read_extent_buffer(leaf, uuid, (unsigned long) in read_one_chunk()
7020 static void fill_device_from_item(struct extent_buffer *leaf, in fill_device_from_item() argument
7026 device->devid = btrfs_device_id(leaf, dev_item); in fill_device_from_item()
7027 device->disk_total_bytes = btrfs_device_total_bytes(leaf, dev_item); in fill_device_from_item()
7030 device->bytes_used = btrfs_device_bytes_used(leaf, dev_item); in fill_device_from_item()
7032 device->type = btrfs_device_type(leaf, dev_item); in fill_device_from_item()
7033 device->io_align = btrfs_device_io_align(leaf, dev_item); in fill_device_from_item()
7034 device->io_width = btrfs_device_io_width(leaf, dev_item); in fill_device_from_item()
7035 device->sector_size = btrfs_device_sector_size(leaf, dev_item); in fill_device_from_item()
7040 read_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); in fill_device_from_item()
7098 static int read_one_dev(struct extent_buffer *leaf, in read_one_dev() argument
7101 struct btrfs_fs_info *fs_info = leaf->fs_info; in read_one_dev()
7109 devid = btrfs_device_id(leaf, dev_item); in read_one_dev()
7110 read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item), in read_one_dev()
7112 read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item), in read_one_dev()
7180 btrfs_device_generation(leaf, dev_item)) in read_one_dev()
7184 fill_device_from_item(leaf, dev_item, device); in read_one_dev()
7385 struct extent_buffer *leaf; in btrfs_read_chunk_tree() local
7423 leaf = path->nodes[0]; in btrfs_read_chunk_tree()
7425 if (slot >= btrfs_header_nritems(leaf)) { in btrfs_read_chunk_tree()
7433 btrfs_item_key_to_cpu(leaf, &found_key, slot); in btrfs_read_chunk_tree()
7436 dev_item = btrfs_item_ptr(leaf, slot, in btrfs_read_chunk_tree()
7438 ret = read_one_dev(leaf, dev_item); in btrfs_read_chunk_tree()
7444 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in btrfs_read_chunk_tree()
7446 ret = read_one_chunk(&found_key, leaf, chunk); in btrfs_read_chunk_tree()
8008 struct extent_buffer *leaf = path->nodes[0]; in btrfs_verify_dev_extents() local
8016 btrfs_item_key_to_cpu(leaf, &key, slot); in btrfs_verify_dev_extents()
8022 dext = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); in btrfs_verify_dev_extents()
8023 chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dext); in btrfs_verify_dev_extents()
8024 physical_len = btrfs_dev_extent_length(leaf, dext); in btrfs_verify_dev_extents()