summaryrefslogtreecommitdiff
path: root/extent-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'extent-cache.c')
-rw-r--r--extent-cache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/extent-cache.c b/extent-cache.c
index 7656ab25..d80aead6 100644
--- a/extent-cache.c
+++ b/extent-cache.c
@@ -230,6 +230,15 @@ struct cache_extent *first_cache_extent(struct cache_tree *tree)
return rb_entry(node, struct cache_extent, rb_node);
}
+struct cache_extent *last_cache_extent(struct cache_tree *tree)
+{
+ struct rb_node *node = rb_last(&tree->root);
+
+ if (!node)
+ return NULL;
+ return rb_entry(node, struct cache_extent, rb_node);
+}
+
struct cache_extent *prev_cache_extent(struct cache_extent *pe)
{
struct rb_node *node = rb_prev(&pe->rb_node);