Lines Matching refs:file_offset

25 	if (entry->file_offset + entry->num_bytes < entry->file_offset)  in entry_end()
27 return entry->file_offset + entry->num_bytes; in entry_end()
33 static struct rb_node *tree_insert(struct rb_root *root, u64 file_offset, in tree_insert() argument
44 if (file_offset < entry->file_offset) in tree_insert()
46 else if (file_offset >= entry_end(entry)) in tree_insert()
61 static struct rb_node *__tree_search(struct rb_root *root, u64 file_offset, in __tree_search() argument
75 if (file_offset < entry->file_offset) in __tree_search()
77 else if (file_offset >= entry_end(entry)) in __tree_search()
85 while (prev && file_offset >= entry_end(prev_entry)) { in __tree_search()
91 if (file_offset < entry_end(prev_entry)) in __tree_search()
99 while (prev && file_offset < entry_end(prev_entry)) { in __tree_search()
111 static int range_overlaps(struct btrfs_ordered_extent *entry, u64 file_offset, in range_overlaps() argument
114 if (file_offset + len <= entry->file_offset || in range_overlaps()
115 entry->file_offset + entry->num_bytes <= file_offset) in range_overlaps()
125 u64 file_offset) in tree_search() argument
135 if (in_range(file_offset, entry->file_offset, entry->num_bytes)) in tree_search()
138 ret = __tree_search(root, file_offset, &prev); in tree_search()
152 static int __btrfs_add_ordered_extent(struct btrfs_inode *inode, u64 file_offset, in __btrfs_add_ordered_extent() argument
166 ret = btrfs_qgroup_free_data(inode, NULL, file_offset, num_bytes); in __btrfs_add_ordered_extent()
175 ret = btrfs_qgroup_release_data(inode, file_offset, num_bytes); in __btrfs_add_ordered_extent()
183 entry->file_offset = file_offset; in __btrfs_add_ordered_extent()
218 node = tree_insert(&tree->tree, file_offset, in __btrfs_add_ordered_extent()
223 file_offset); in __btrfs_add_ordered_extent()
250 int btrfs_add_ordered_extent(struct btrfs_inode *inode, u64 file_offset, in btrfs_add_ordered_extent() argument
257 return __btrfs_add_ordered_extent(inode, file_offset, disk_bytenr, in btrfs_add_ordered_extent()
262 int btrfs_add_ordered_extent_dio(struct btrfs_inode *inode, u64 file_offset, in btrfs_add_ordered_extent_dio() argument
269 return __btrfs_add_ordered_extent(inode, file_offset, disk_bytenr, in btrfs_add_ordered_extent_dio()
274 int btrfs_add_ordered_extent_compress(struct btrfs_inode *inode, u64 file_offset, in btrfs_add_ordered_extent_compress() argument
279 return __btrfs_add_ordered_extent(inode, file_offset, disk_bytenr, in btrfs_add_ordered_extent_compress()
317 struct page *page, u64 file_offset, in btrfs_mark_ordered_io_finished() argument
327 u64 cur = file_offset; in btrfs_mark_ordered_io_finished()
335 ASSERT(page->mapping && page_offset(page) <= file_offset && in btrfs_mark_ordered_io_finished()
336 file_offset + num_bytes <= page_offset(page) + PAGE_SIZE); in btrfs_mark_ordered_io_finished()
339 while (cur < file_offset + num_bytes) { in btrfs_mark_ordered_io_finished()
350 entry_end = entry->file_offset + entry->num_bytes; in btrfs_mark_ordered_io_finished()
365 cur = entry->file_offset; in btrfs_mark_ordered_io_finished()
373 if (cur < entry->file_offset) { in btrfs_mark_ordered_io_finished()
374 cur = entry->file_offset; in btrfs_mark_ordered_io_finished()
385 end = min(entry->file_offset + entry->num_bytes, in btrfs_mark_ordered_io_finished()
386 file_offset + num_bytes) - 1; in btrfs_mark_ordered_io_finished()
411 entry->file_offset, in btrfs_mark_ordered_io_finished()
459 u64 file_offset, u64 io_size) in btrfs_dec_test_ordered_pending() argument
473 node = tree_search(tree, file_offset); in btrfs_dec_test_ordered_pending()
479 if (!in_range(file_offset, entry->file_offset, entry->num_bytes)) in btrfs_dec_test_ordered_pending()
725 u64 start = entry->file_offset; in btrfs_start_ordered_extent()
784 if (ordered->file_offset > orig_end) { in btrfs_wait_ordered_range()
788 if (ordered->file_offset + ordered->num_bytes <= start) { in btrfs_wait_ordered_range()
793 end = ordered->file_offset; in btrfs_wait_ordered_range()
814 u64 file_offset) in btrfs_lookup_ordered_extent() argument
823 node = tree_search(tree, file_offset); in btrfs_lookup_ordered_extent()
828 if (!in_range(file_offset, entry->file_offset, entry->num_bytes)) in btrfs_lookup_ordered_extent()
841 struct btrfs_inode *inode, u64 file_offset, u64 len) in btrfs_lookup_ordered_range() argument
849 node = tree_search(tree, file_offset); in btrfs_lookup_ordered_range()
851 node = tree_search(tree, file_offset + len); in btrfs_lookup_ordered_range()
858 if (range_overlaps(entry, file_offset, len)) in btrfs_lookup_ordered_range()
861 if (entry->file_offset >= file_offset + len) { in btrfs_lookup_ordered_range()
910 btrfs_lookup_first_ordered_extent(struct btrfs_inode *inode, u64 file_offset) in btrfs_lookup_first_ordered_extent() argument
918 node = tree_search(tree, file_offset); in btrfs_lookup_first_ordered_extent()
939 struct btrfs_inode *inode, u64 file_offset, u64 len) in btrfs_lookup_first_ordered_range() argument
959 if (file_offset < entry->file_offset) { in btrfs_lookup_first_ordered_range()
961 } else if (file_offset >= entry_end(entry)) { in btrfs_lookup_first_ordered_range()
978 if (entry->file_offset < file_offset) { in btrfs_lookup_first_ordered_range()
987 if (range_overlaps(entry, file_offset, len)) in btrfs_lookup_first_ordered_range()
992 if (range_overlaps(entry, file_offset, len)) in btrfs_lookup_first_ordered_range()
1053 u64 file_offset = ordered->file_offset + pos; in clone_ordered_extent() local
1080 file_offset, disk_bytenr, num_bytes, in clone_ordered_extent()
1083 ret = btrfs_add_ordered_extent_dio(BTRFS_I(inode), file_offset, in clone_ordered_extent()
1086 ret = btrfs_add_ordered_extent(BTRFS_I(inode), file_offset, in clone_ordered_extent()
1110 ordered->file_offset += pre; 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()