/* find an ordered extent corresponding to file_offset. return NULL if nothing is found, otherwise take a reference on the extent and return it  */
struct btrfs_ordered_extent* btrfs_lookup_ordered_extent(struct inode *inode, u64 file_offset)
/* find an ordered extent corresponding to file_offset. return NULL if nothing is found, otherwise take a reference on the extent and return it  */
struct btrfs_ordered_extent* btrfs_lookup_ordered_extent(struct inode *inode, u64 file_offset)
{
	struct btrfs_ordered_inode_tree *tree;
	struct rb_node *node;
	struct btrfs_ordered_extent *entry = NULL;
	tree = &BTRFS_I(inode)->ordered_tree;
	mutex_lock(&tree->mutex);
	node = tree_search(tree, file_offset);
	if (!node)
		goto out;
	entry = rb_entry(node, struct btrfs_ordered_extent, rb_node);
	if (!offset_in_entry(entry, file_offset))
		entry = NULL;
	if (entry)
		atomic_inc(&entry->refs);
out:
	mutex_unlock(&tree->mutex);
	return entry;
}