Lines Matching refs:leaf
1549 struct extent_buffer *leaf = NULL; in btrfs_free_dev_extent() local
1566 leaf = path->nodes[0]; in btrfs_free_dev_extent()
1567 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_free_dev_extent()
1568 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_free_dev_extent()
1571 btrfs_dev_extent_length(leaf, extent) < start); in btrfs_free_dev_extent()
1576 leaf = path->nodes[0]; in btrfs_free_dev_extent()
1577 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_free_dev_extent()
1584 *dev_extent_len = btrfs_dev_extent_length(leaf, extent); in btrfs_free_dev_extent()
1607 struct extent_buffer *leaf; in btrfs_alloc_dev_extent() local
1624 leaf = path->nodes[0]; in btrfs_alloc_dev_extent()
1625 extent = btrfs_item_ptr(leaf, path->slots[0], in btrfs_alloc_dev_extent()
1627 btrfs_set_dev_extent_chunk_tree(leaf, extent, in btrfs_alloc_dev_extent()
1629 btrfs_set_dev_extent_chunk_objectid(leaf, extent, in btrfs_alloc_dev_extent()
1631 btrfs_set_dev_extent_chunk_offset(leaf, extent, chunk_offset); in btrfs_alloc_dev_extent()
1633 btrfs_set_dev_extent_length(leaf, extent, num_bytes); in btrfs_alloc_dev_extent()
1634 btrfs_mark_buffer_dirty(leaf); in btrfs_alloc_dev_extent()
1707 struct extent_buffer *leaf; in btrfs_add_dev_item() local
1724 leaf = path->nodes[0]; in btrfs_add_dev_item()
1725 dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item); in btrfs_add_dev_item()
1727 btrfs_set_device_id(leaf, dev_item, device->devid); in btrfs_add_dev_item()
1728 btrfs_set_device_generation(leaf, dev_item, 0); in btrfs_add_dev_item()
1729 btrfs_set_device_type(leaf, dev_item, device->type); in btrfs_add_dev_item()
1730 btrfs_set_device_io_align(leaf, dev_item, device->io_align); in btrfs_add_dev_item()
1731 btrfs_set_device_io_width(leaf, dev_item, device->io_width); in btrfs_add_dev_item()
1732 btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); in btrfs_add_dev_item()
1733 btrfs_set_device_total_bytes(leaf, dev_item, in btrfs_add_dev_item()
1735 btrfs_set_device_bytes_used(leaf, dev_item, in btrfs_add_dev_item()
1737 btrfs_set_device_group(leaf, dev_item, 0); in btrfs_add_dev_item()
1738 btrfs_set_device_seek_speed(leaf, dev_item, 0); in btrfs_add_dev_item()
1739 btrfs_set_device_bandwidth(leaf, dev_item, 0); in btrfs_add_dev_item()
1740 btrfs_set_device_start_offset(leaf, dev_item, 0); in btrfs_add_dev_item()
1743 write_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); in btrfs_add_dev_item()
1745 write_extent_buffer(leaf, trans->fs_info->fsid, ptr, BTRFS_FSID_SIZE); in btrfs_add_dev_item()
1746 btrfs_mark_buffer_dirty(leaf); in btrfs_add_dev_item()
2283 struct extent_buffer *leaf; in btrfs_finish_sprout() local
2305 leaf = path->nodes[0]; in btrfs_finish_sprout()
2307 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_finish_sprout()
2313 leaf = path->nodes[0]; in btrfs_finish_sprout()
2314 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_finish_sprout()
2319 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_finish_sprout()
2324 dev_item = btrfs_item_ptr(leaf, path->slots[0], in btrfs_finish_sprout()
2326 devid = btrfs_device_id(leaf, dev_item); in btrfs_finish_sprout()
2327 read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item), in btrfs_finish_sprout()
2329 read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item), in btrfs_finish_sprout()
2336 btrfs_set_device_generation(leaf, dev_item, in btrfs_finish_sprout()
2338 btrfs_mark_buffer_dirty(leaf); in btrfs_finish_sprout()
2584 struct extent_buffer *leaf; in btrfs_update_device() local
2604 leaf = path->nodes[0]; in btrfs_update_device()
2605 dev_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dev_item); in btrfs_update_device()
2607 btrfs_set_device_id(leaf, dev_item, device->devid); in btrfs_update_device()
2608 btrfs_set_device_type(leaf, dev_item, device->type); in btrfs_update_device()
2609 btrfs_set_device_io_align(leaf, dev_item, device->io_align); in btrfs_update_device()
2610 btrfs_set_device_io_width(leaf, dev_item, device->io_width); in btrfs_update_device()
2611 btrfs_set_device_sector_size(leaf, dev_item, device->sector_size); in btrfs_update_device()
2612 btrfs_set_device_total_bytes(leaf, dev_item, in btrfs_update_device()
2614 btrfs_set_device_bytes_used(leaf, dev_item, in btrfs_update_device()
2616 btrfs_mark_buffer_dirty(leaf); in btrfs_update_device()
2926 struct extent_buffer *leaf; in btrfs_relocate_sys_chunks() local
2962 leaf = path->nodes[0]; in btrfs_relocate_sys_chunks()
2963 btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); in btrfs_relocate_sys_chunks()
2965 chunk = btrfs_item_ptr(leaf, path->slots[0], in btrfs_relocate_sys_chunks()
2967 chunk_type = btrfs_chunk_type(leaf, chunk); in btrfs_relocate_sys_chunks()
3048 struct extent_buffer *leaf; in insert_balance_item() local
3071 leaf = path->nodes[0]; in insert_balance_item()
3072 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item); in insert_balance_item()
3074 memzero_extent_buffer(leaf, (unsigned long)item, sizeof(*item)); in insert_balance_item()
3077 btrfs_set_balance_data(leaf, item, &disk_bargs); in insert_balance_item()
3079 btrfs_set_balance_meta(leaf, item, &disk_bargs); in insert_balance_item()
3081 btrfs_set_balance_sys(leaf, item, &disk_bargs); in insert_balance_item()
3083 btrfs_set_balance_flags(leaf, item, bctl->flags); in insert_balance_item()
3085 btrfs_mark_buffer_dirty(leaf); in insert_balance_item()
3270 static int chunk_devid_filter(struct extent_buffer *leaf, in chunk_devid_filter() argument
3275 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_devid_filter()
3280 if (btrfs_stripe_devid(leaf, stripe) == bargs->devid) in chunk_devid_filter()
3288 static int chunk_drange_filter(struct extent_buffer *leaf, in chunk_drange_filter() argument
3293 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_drange_filter()
3302 if (btrfs_chunk_type(leaf, chunk) & (BTRFS_BLOCK_GROUP_DUP | in chunk_drange_filter()
3305 } else if (btrfs_chunk_type(leaf, chunk) & BTRFS_BLOCK_GROUP_RAID5) { in chunk_drange_filter()
3307 } else if (btrfs_chunk_type(leaf, chunk) & BTRFS_BLOCK_GROUP_RAID6) { in chunk_drange_filter()
3315 if (btrfs_stripe_devid(leaf, stripe) != bargs->devid) in chunk_drange_filter()
3318 stripe_offset = btrfs_stripe_offset(leaf, stripe); in chunk_drange_filter()
3319 stripe_length = btrfs_chunk_length(leaf, chunk); in chunk_drange_filter()
3331 static int chunk_vrange_filter(struct extent_buffer *leaf, in chunk_vrange_filter() argument
3337 chunk_offset + btrfs_chunk_length(leaf, chunk) > bargs->vstart) in chunk_vrange_filter()
3344 static int chunk_stripes_range_filter(struct extent_buffer *leaf, in chunk_stripes_range_filter() argument
3348 int num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in chunk_stripes_range_filter()
3373 struct extent_buffer *leaf, in should_balance_chunk() argument
3378 u64 chunk_type = btrfs_chunk_type(leaf, chunk); in should_balance_chunk()
3410 chunk_devid_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3416 chunk_drange_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3422 chunk_vrange_filter(leaf, chunk, chunk_offset, bargs)) { in should_balance_chunk()
3428 chunk_stripes_range_filter(leaf, chunk, bargs)) { in should_balance_chunk()
3476 struct extent_buffer *leaf; in __btrfs_balance() local
3590 leaf = path->nodes[0]; in __btrfs_balance()
3592 btrfs_item_key_to_cpu(leaf, &found_key, slot); in __btrfs_balance()
3599 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in __btrfs_balance()
3600 chunk_type = btrfs_chunk_type(leaf, chunk); in __btrfs_balance()
3608 ret = should_balance_chunk(fs_info, leaf, chunk, in __btrfs_balance()
3971 struct extent_buffer *leaf; in btrfs_recover_balance() local
3997 leaf = path->nodes[0]; in btrfs_recover_balance()
3998 item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_balance_item); in btrfs_recover_balance()
4000 bctl->flags = btrfs_balance_flags(leaf, item); in btrfs_recover_balance()
4003 btrfs_balance_data(leaf, item, &disk_bargs); in btrfs_recover_balance()
4005 btrfs_balance_meta(leaf, item, &disk_bargs); in btrfs_recover_balance()
4007 btrfs_balance_sys(leaf, item, &disk_bargs); in btrfs_recover_balance()
6383 struct extent_buffer *leaf, in read_one_chunk() argument
6398 length = btrfs_chunk_length(leaf, chunk); in read_one_chunk()
6399 num_stripes = btrfs_chunk_num_stripes(leaf, chunk); in read_one_chunk()
6405 if (leaf->start == BTRFS_SUPER_INFO_OFFSET) { in read_one_chunk()
6406 ret = btrfs_check_chunk_valid(fs_info, leaf, chunk, logical); in read_one_chunk()
6441 map->io_width = btrfs_chunk_io_width(leaf, chunk); in read_one_chunk()
6442 map->io_align = btrfs_chunk_io_align(leaf, chunk); in read_one_chunk()
6443 map->stripe_len = btrfs_chunk_stripe_len(leaf, chunk); in read_one_chunk()
6444 map->type = btrfs_chunk_type(leaf, chunk); in read_one_chunk()
6445 map->sub_stripes = btrfs_chunk_sub_stripes(leaf, chunk); in read_one_chunk()
6449 btrfs_stripe_offset_nr(leaf, chunk, i); in read_one_chunk()
6450 devid = btrfs_stripe_devid_nr(leaf, chunk, i); in read_one_chunk()
6451 read_extent_buffer(leaf, uuid, (unsigned long) in read_one_chunk()
6493 static void fill_device_from_item(struct extent_buffer *leaf, in fill_device_from_item() argument
6499 device->devid = btrfs_device_id(leaf, dev_item); in fill_device_from_item()
6500 device->disk_total_bytes = btrfs_device_total_bytes(leaf, dev_item); in fill_device_from_item()
6503 device->bytes_used = btrfs_device_bytes_used(leaf, dev_item); in fill_device_from_item()
6505 device->type = btrfs_device_type(leaf, dev_item); in fill_device_from_item()
6506 device->io_align = btrfs_device_io_align(leaf, dev_item); in fill_device_from_item()
6507 device->io_width = btrfs_device_io_width(leaf, dev_item); in fill_device_from_item()
6508 device->sector_size = btrfs_device_sector_size(leaf, dev_item); in fill_device_from_item()
6513 read_extent_buffer(leaf, device->uuid, ptr, BTRFS_UUID_SIZE); in fill_device_from_item()
6572 struct extent_buffer *leaf, in read_one_dev() argument
6582 devid = btrfs_device_id(leaf, dev_item); in read_one_dev()
6583 read_extent_buffer(leaf, dev_uuid, btrfs_device_uuid(dev_item), in read_one_dev()
6585 read_extent_buffer(leaf, fs_uuid, btrfs_device_fsid(dev_item), in read_one_dev()
6653 btrfs_device_generation(leaf, dev_item)) in read_one_dev()
6657 fill_device_from_item(leaf, dev_item, device); in read_one_dev()
6858 struct extent_buffer *leaf; in btrfs_read_chunk_tree() local
6897 leaf = path->nodes[0]; in btrfs_read_chunk_tree()
6899 if (slot >= btrfs_header_nritems(leaf)) { in btrfs_read_chunk_tree()
6907 btrfs_item_key_to_cpu(leaf, &found_key, slot); in btrfs_read_chunk_tree()
6910 dev_item = btrfs_item_ptr(leaf, slot, in btrfs_read_chunk_tree()
6912 ret = read_one_dev(fs_info, leaf, dev_item); in btrfs_read_chunk_tree()
6918 chunk = btrfs_item_ptr(leaf, slot, struct btrfs_chunk); in btrfs_read_chunk_tree()
6919 ret = read_one_chunk(fs_info, &found_key, leaf, chunk); in btrfs_read_chunk_tree()
7508 struct extent_buffer *leaf = path->nodes[0]; in btrfs_verify_dev_extents() local
7516 btrfs_item_key_to_cpu(leaf, &key, slot); in btrfs_verify_dev_extents()
7522 dext = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent); in btrfs_verify_dev_extents()
7523 chunk_offset = btrfs_dev_extent_chunk_offset(leaf, dext); in btrfs_verify_dev_extents()
7524 physical_len = btrfs_dev_extent_length(leaf, dext); in btrfs_verify_dev_extents()