aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-09-29 15:18:18 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-29 15:18:18 -0400
commitd352ac68148b69937d39ca5d48bcc4478e118dbf (patch)
tree7951dd7311999d9e77766acdc7f8e93de97874d8 /fs/btrfs/extent_map.c
parent9a5e1ea1e1e539e244a54afffc330fc368376ab9 (diff)
Btrfs: add and improve comments
This improves the comments at the top of many functions. It didn't dive into the guts of functions because I was trying to avoid merging problems with the new allocator and back reference work. extent-tree.c and volumes.c were both skipped, and there is definitely more work todo in cleaning and commenting the code. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 78ced11d18c7..74b2a29880d3 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -114,6 +114,10 @@ static struct rb_node *tree_insert(struct rb_root *root, u64 offset,
114 return NULL; 114 return NULL;
115} 115}
116 116
117/*
118 * search through the tree for an extent_map with a given offset. If
119 * it can't be found, try to find some neighboring extents
120 */
117static struct rb_node *__tree_search(struct rb_root *root, u64 offset, 121static struct rb_node *__tree_search(struct rb_root *root, u64 offset,
118 struct rb_node **prev_ret, 122 struct rb_node **prev_ret,
119 struct rb_node **next_ret) 123 struct rb_node **next_ret)
@@ -160,6 +164,10 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset,
160 return NULL; 164 return NULL;
161} 165}
162 166
167/*
168 * look for an offset in the tree, and if it can't be found, return
169 * the first offset we can find smaller than 'offset'.
170 */
163static inline struct rb_node *tree_search(struct rb_root *root, u64 offset) 171static inline struct rb_node *tree_search(struct rb_root *root, u64 offset)
164{ 172{
165 struct rb_node *prev; 173 struct rb_node *prev;
@@ -170,6 +178,7 @@ static inline struct rb_node *tree_search(struct rb_root *root, u64 offset)
170 return ret; 178 return ret;
171} 179}
172 180
181/* check to see if two extent_map structs are adjacent and safe to merge */
173static int mergable_maps(struct extent_map *prev, struct extent_map *next) 182static int mergable_maps(struct extent_map *prev, struct extent_map *next)
174{ 183{
175 if (test_bit(EXTENT_FLAG_PINNED, &prev->flags)) 184 if (test_bit(EXTENT_FLAG_PINNED, &prev->flags))
@@ -250,6 +259,7 @@ out:
250} 259}
251EXPORT_SYMBOL(add_extent_mapping); 260EXPORT_SYMBOL(add_extent_mapping);
252 261
262/* simple helper to do math around the end of an extent, handling wrap */
253static u64 range_end(u64 start, u64 len) 263static u64 range_end(u64 start, u64 len)
254{ 264{
255 if (start + len < start) 265 if (start + len < start)