/* lookup and return any extent before 'file_offset'. NULL is returned if none is found  */
struct btrfs_ordered_extent* btrfs_lookup_first_ordered_extent(struct inode *inode, u64 file_offset)
/* lookup and return any extent before 'file_offset'. NULL is returned if none is found  */
struct btrfs_ordered_extent* btrfs_lookup_first_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);
	atomic_inc(&entry->refs);
out:
	mutex_unlock(&tree->mutex);
	return entry;
}