• Home
  • Raw
  • Download

Lines Matching refs:leaf

198 	struct extent_buffer *leaf;  in btrfs_drop_extents()  local
248 leaf = path->nodes[0]; in btrfs_drop_extents()
249 btrfs_item_key_to_cpu(leaf, &key, path->slots[0] - 1); in btrfs_drop_extents()
256 leaf = path->nodes[0]; in btrfs_drop_extents()
257 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in btrfs_drop_extents()
266 leaf = path->nodes[0]; in btrfs_drop_extents()
270 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_drop_extents()
283 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_drop_extents()
285 extent_type = btrfs_file_extent_type(leaf, fi); in btrfs_drop_extents()
289 disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); in btrfs_drop_extents()
290 num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); in btrfs_drop_extents()
291 extent_offset = btrfs_file_extent_offset(leaf, fi); in btrfs_drop_extents()
293 btrfs_file_extent_num_bytes(leaf, fi); in btrfs_drop_extents()
296 btrfs_file_extent_ram_bytes(leaf, fi); in btrfs_drop_extents()
351 leaf = path->nodes[0]; in btrfs_drop_extents()
352 fi = btrfs_item_ptr(leaf, path->slots[0] - 1, in btrfs_drop_extents()
354 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_drop_extents()
357 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_drop_extents()
361 btrfs_set_file_extent_offset(leaf, fi, extent_offset); in btrfs_drop_extents()
362 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_drop_extents()
364 btrfs_mark_buffer_dirty(leaf); in btrfs_drop_extents()
404 btrfs_set_file_extent_offset(leaf, fi, extent_offset); in btrfs_drop_extents()
405 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_drop_extents()
407 btrfs_mark_buffer_dirty(leaf); in btrfs_drop_extents()
425 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_drop_extents()
427 btrfs_mark_buffer_dirty(leaf); in btrfs_drop_extents()
476 if (path->slots[0] + 1 < btrfs_header_nritems(leaf)) { in btrfs_drop_extents()
511 leaf = path->nodes[0]; in btrfs_drop_extents()
519 btrfs_leaf_free_space(leaf) >= in btrfs_drop_extents()
525 if (!del_nr && path->slots[0] < btrfs_header_nritems(leaf)) { in btrfs_drop_extents()
528 btrfs_item_key_to_cpu(leaf, &slot_key, path->slots[0]); in btrfs_drop_extents()
546 static int extent_mergeable(struct extent_buffer *leaf, int slot, in extent_mergeable() argument
554 if (slot < 0 || slot >= btrfs_header_nritems(leaf)) in extent_mergeable()
557 btrfs_item_key_to_cpu(leaf, &key, slot); in extent_mergeable()
561 fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in extent_mergeable()
562 if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG || in extent_mergeable()
563 btrfs_file_extent_disk_bytenr(leaf, fi) != bytenr || in extent_mergeable()
564 btrfs_file_extent_offset(leaf, fi) != key.offset - orig_offset || in extent_mergeable()
565 btrfs_file_extent_compression(leaf, fi) || in extent_mergeable()
566 btrfs_file_extent_encryption(leaf, fi) || in extent_mergeable()
567 btrfs_file_extent_other_encoding(leaf, fi)) in extent_mergeable()
570 extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi); in extent_mergeable()
591 struct extent_buffer *leaf; in btrfs_mark_extent_written() local
626 leaf = path->nodes[0]; in btrfs_mark_extent_written()
627 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in btrfs_mark_extent_written()
634 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
636 if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_PREALLOC) { in btrfs_mark_extent_written()
641 extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi); in btrfs_mark_extent_written()
648 bytenr = btrfs_file_extent_disk_bytenr(leaf, fi); in btrfs_mark_extent_written()
649 num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); in btrfs_mark_extent_written()
650 orig_offset = key.offset - btrfs_file_extent_offset(leaf, fi); in btrfs_mark_extent_written()
656 if (extent_mergeable(leaf, path->slots[0] - 1, in btrfs_mark_extent_written()
661 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
663 btrfs_set_file_extent_generation(leaf, fi, in btrfs_mark_extent_written()
665 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
667 btrfs_set_file_extent_offset(leaf, fi, in btrfs_mark_extent_written()
669 fi = btrfs_item_ptr(leaf, path->slots[0] - 1, in btrfs_mark_extent_written()
671 btrfs_set_file_extent_generation(leaf, fi, in btrfs_mark_extent_written()
673 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
675 btrfs_mark_buffer_dirty(leaf); in btrfs_mark_extent_written()
683 if (extent_mergeable(leaf, path->slots[0] + 1, in btrfs_mark_extent_written()
686 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
688 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
690 btrfs_set_file_extent_generation(leaf, fi, in btrfs_mark_extent_written()
696 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
698 btrfs_set_file_extent_generation(leaf, fi, in btrfs_mark_extent_written()
700 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
702 btrfs_set_file_extent_offset(leaf, fi, in btrfs_mark_extent_written()
704 btrfs_mark_buffer_dirty(leaf); in btrfs_mark_extent_written()
724 leaf = path->nodes[0]; in btrfs_mark_extent_written()
725 fi = btrfs_item_ptr(leaf, path->slots[0] - 1, in btrfs_mark_extent_written()
727 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in btrfs_mark_extent_written()
728 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
731 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
734 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in btrfs_mark_extent_written()
735 btrfs_set_file_extent_offset(leaf, fi, split - orig_offset); in btrfs_mark_extent_written()
736 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
738 btrfs_mark_buffer_dirty(leaf); in btrfs_mark_extent_written()
770 if (extent_mergeable(leaf, path->slots[0] + 1, in btrfs_mark_extent_written()
788 if (extent_mergeable(leaf, path->slots[0] - 1, in btrfs_mark_extent_written()
805 fi = btrfs_item_ptr(leaf, path->slots[0], in btrfs_mark_extent_written()
807 btrfs_set_file_extent_type(leaf, fi, in btrfs_mark_extent_written()
809 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in btrfs_mark_extent_written()
810 btrfs_mark_buffer_dirty(leaf); in btrfs_mark_extent_written()
812 fi = btrfs_item_ptr(leaf, del_slot - 1, in btrfs_mark_extent_written()
814 btrfs_set_file_extent_type(leaf, fi, in btrfs_mark_extent_written()
816 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in btrfs_mark_extent_written()
817 btrfs_set_file_extent_num_bytes(leaf, fi, in btrfs_mark_extent_written()
819 btrfs_mark_buffer_dirty(leaf); in btrfs_mark_extent_written()
2034 static int hole_mergeable(struct btrfs_inode *inode, struct extent_buffer *leaf, in hole_mergeable() argument
2040 if (slot < 0 || slot >= btrfs_header_nritems(leaf)) in hole_mergeable()
2043 btrfs_item_key_to_cpu(leaf, &key, slot); in hole_mergeable()
2048 fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in hole_mergeable()
2050 if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG) in hole_mergeable()
2053 if (btrfs_file_extent_disk_bytenr(leaf, fi)) in hole_mergeable()
2058 if (key.offset + btrfs_file_extent_num_bytes(leaf, fi) == start) in hole_mergeable()
2069 struct extent_buffer *leaf; in fill_holes() local
2093 leaf = path->nodes[0]; in fill_holes()
2094 if (hole_mergeable(inode, leaf, path->slots[0] - 1, offset, end)) { in fill_holes()
2098 fi = btrfs_item_ptr(leaf, path->slots[0], in fill_holes()
2100 num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + in fill_holes()
2102 btrfs_set_file_extent_num_bytes(leaf, fi, num_bytes); in fill_holes()
2103 btrfs_set_file_extent_ram_bytes(leaf, fi, num_bytes); in fill_holes()
2104 btrfs_set_file_extent_offset(leaf, fi, 0); in fill_holes()
2105 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in fill_holes()
2106 btrfs_mark_buffer_dirty(leaf); in fill_holes()
2110 if (hole_mergeable(inode, leaf, path->slots[0], offset, end)) { in fill_holes()
2115 fi = btrfs_item_ptr(leaf, path->slots[0], in fill_holes()
2117 num_bytes = btrfs_file_extent_num_bytes(leaf, fi) + end - in fill_holes()
2119 btrfs_set_file_extent_num_bytes(leaf, fi, num_bytes); in fill_holes()
2120 btrfs_set_file_extent_ram_bytes(leaf, fi, num_bytes); in fill_holes()
2121 btrfs_set_file_extent_offset(leaf, fi, 0); in fill_holes()
2122 btrfs_set_file_extent_generation(leaf, fi, trans->transid); in fill_holes()
2123 btrfs_mark_buffer_dirty(leaf); in fill_holes()
2242 struct extent_buffer *leaf; in btrfs_insert_replace_extent() local
2264 leaf = path->nodes[0]; in btrfs_insert_replace_extent()
2266 write_extent_buffer(leaf, extent_info->extent_buf, in btrfs_insert_replace_extent()
2267 btrfs_item_ptr_offset(leaf, slot), in btrfs_insert_replace_extent()
2269 extent = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item); in btrfs_insert_replace_extent()
2270 ASSERT(btrfs_file_extent_type(leaf, extent) != BTRFS_FILE_EXTENT_INLINE); in btrfs_insert_replace_extent()
2271 btrfs_set_file_extent_offset(leaf, extent, extent_info->data_offset); in btrfs_insert_replace_extent()
2272 btrfs_set_file_extent_num_bytes(leaf, extent, replace_len); in btrfs_insert_replace_extent()
2274 btrfs_set_file_extent_generation(leaf, extent, trans->transid); in btrfs_insert_replace_extent()
2275 btrfs_mark_buffer_dirty(leaf); in btrfs_insert_replace_extent()
3537 struct extent_buffer *leaf = path->nodes[0]; in find_desired_extent() local
3542 if (path->slots[0] >= btrfs_header_nritems(leaf)) { in find_desired_extent()
3549 leaf = path->nodes[0]; in find_desired_extent()
3552 btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); in find_desired_extent()
3593 extent = btrfs_item_ptr(leaf, path->slots[0], in find_desired_extent()
3595 type = btrfs_file_extent_type(leaf, extent); in find_desired_extent()
3604 btrfs_file_extent_disk_bytenr(leaf, extent) == 0)) { in find_desired_extent()