Lines Matching refs:ordered

614 	struct btrfs_ordered_extent *ordered;  in btrfs_run_ordered_extent_work()  local
616 ordered = container_of(work, struct btrfs_ordered_extent, flush_work); in btrfs_run_ordered_extent_work()
617 btrfs_start_ordered_extent(ordered, 1); in btrfs_run_ordered_extent_work()
618 complete(&ordered->completion); in btrfs_run_ordered_extent_work()
632 struct btrfs_ordered_extent *ordered, *next; in btrfs_wait_ordered_extents() local
640 ordered = list_first_entry(&splice, struct btrfs_ordered_extent, in btrfs_wait_ordered_extents()
643 if (range_end <= ordered->disk_bytenr || in btrfs_wait_ordered_extents()
644 ordered->disk_bytenr + ordered->disk_num_bytes <= range_start) { in btrfs_wait_ordered_extents()
645 list_move_tail(&ordered->root_extent_list, &skipped); in btrfs_wait_ordered_extents()
650 list_move_tail(&ordered->root_extent_list, in btrfs_wait_ordered_extents()
652 refcount_inc(&ordered->refs); in btrfs_wait_ordered_extents()
655 btrfs_init_work(&ordered->flush_work, in btrfs_wait_ordered_extents()
657 list_add_tail(&ordered->work_list, &works); in btrfs_wait_ordered_extents()
658 btrfs_queue_work(fs_info->flush_workers, &ordered->flush_work); in btrfs_wait_ordered_extents()
670 list_for_each_entry_safe(ordered, next, &works, work_list) { in btrfs_wait_ordered_extents()
671 list_del_init(&ordered->work_list); in btrfs_wait_ordered_extents()
672 wait_for_completion(&ordered->completion); in btrfs_wait_ordered_extents()
673 btrfs_put_ordered_extent(ordered); in btrfs_wait_ordered_extents()
753 struct btrfs_ordered_extent *ordered; in btrfs_wait_ordered_range() local
781 ordered = btrfs_lookup_first_ordered_extent(BTRFS_I(inode), end); in btrfs_wait_ordered_range()
782 if (!ordered) in btrfs_wait_ordered_range()
784 if (ordered->file_offset > orig_end) { in btrfs_wait_ordered_range()
785 btrfs_put_ordered_extent(ordered); in btrfs_wait_ordered_range()
788 if (ordered->file_offset + ordered->num_bytes <= start) { in btrfs_wait_ordered_range()
789 btrfs_put_ordered_extent(ordered); in btrfs_wait_ordered_range()
792 btrfs_start_ordered_extent(ordered, 1); in btrfs_wait_ordered_range()
793 end = ordered->file_offset; in btrfs_wait_ordered_range()
799 if (test_bit(BTRFS_ORDERED_IOERR, &ordered->flags)) in btrfs_wait_ordered_range()
801 btrfs_put_ordered_extent(ordered); in btrfs_wait_ordered_range()
891 struct btrfs_ordered_extent *ordered; in btrfs_get_ordered_extents_for_logging() local
893 ordered = rb_entry(n, struct btrfs_ordered_extent, rb_node); in btrfs_get_ordered_extents_for_logging()
895 if (test_bit(BTRFS_ORDERED_LOGGED, &ordered->flags)) in btrfs_get_ordered_extents_for_logging()
898 ASSERT(list_empty(&ordered->log_list)); in btrfs_get_ordered_extents_for_logging()
899 list_add_tail(&ordered->log_list, list); in btrfs_get_ordered_extents_for_logging()
900 refcount_inc(&ordered->refs); in btrfs_get_ordered_extents_for_logging()
1021 struct btrfs_ordered_extent *ordered; in btrfs_lock_and_flush_ordered_range() local
1030 ordered = btrfs_lookup_ordered_range(inode, start, in btrfs_lock_and_flush_ordered_range()
1032 if (!ordered) { in btrfs_lock_and_flush_ordered_range()
1043 btrfs_start_ordered_extent(ordered, 1); in btrfs_lock_and_flush_ordered_range()
1044 btrfs_put_ordered_extent(ordered); in btrfs_lock_and_flush_ordered_range()
1048 static int clone_ordered_extent(struct btrfs_ordered_extent *ordered, u64 pos, in clone_ordered_extent() argument
1051 struct inode *inode = ordered->inode; in clone_ordered_extent()
1053 u64 file_offset = ordered->file_offset + pos; in clone_ordered_extent()
1054 u64 disk_bytenr = ordered->disk_bytenr + pos; in clone_ordered_extent()
1058 unsigned long flags_masked = ordered->flags & ~(1 << BTRFS_ORDERED_DIRECT); in clone_ordered_extent()
1059 int compress_type = ordered->compress_type; in clone_ordered_extent()
1077 if (test_bit(BTRFS_ORDERED_COMPRESSED, &ordered->flags)) { in clone_ordered_extent()
1082 } else if (test_bit(BTRFS_ORDERED_DIRECT, &ordered->flags)) { in clone_ordered_extent()
1093 int btrfs_split_ordered_extent(struct btrfs_ordered_extent *ordered, u64 pre, in btrfs_split_ordered_extent() argument
1096 struct inode *inode = ordered->inode; in btrfs_split_ordered_extent()
1104 node = &ordered->rb_node; in btrfs_split_ordered_extent()
1110 ordered->file_offset += pre; in btrfs_split_ordered_extent()
1111 ordered->disk_bytenr += pre; in btrfs_split_ordered_extent()
1112 ordered->num_bytes -= (pre + post); in btrfs_split_ordered_extent()
1113 ordered->disk_num_bytes -= (pre + post); in btrfs_split_ordered_extent()
1114 ordered->bytes_left -= (pre + post); in btrfs_split_ordered_extent()
1117 node = tree_insert(&tree->tree, ordered->file_offset, &ordered->rb_node); in btrfs_split_ordered_extent()
1121 ordered->file_offset); in btrfs_split_ordered_extent()
1126 ret = clone_ordered_extent(ordered, 0, pre); in btrfs_split_ordered_extent()
1128 ret = clone_ordered_extent(ordered, pre + ordered->disk_num_bytes, in btrfs_split_ordered_extent()