diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-02-18 12:12:38 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:00 -0400 |
commit | d7fc640e6fed46932f7c74e14f9b58b8637c66cf (patch) | |
tree | 525eda21f9e0d6d18bd55fd23d3a31814b224aa8 /fs/btrfs/extent_io.h | |
parent | 9afbb0b752ef30a429c45b9de6706e28ad1a36e1 (diff) |
Btrfs: Allocator improvements
Reduce CPU time searching for free blocks by optimizing find_first_extent_bit
Fix find_free_extent to make better use of the last_alloc hint. Before it
was often finding blocks just before the hint.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r-- | fs/btrfs/extent_io.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 151fdada4dc4..fcc4bb078c24 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -81,6 +81,15 @@ struct extent_buffer { | |||
81 | 81 | ||
82 | struct extent_map_tree; | 82 | struct extent_map_tree; |
83 | 83 | ||
84 | static inline struct extent_state *extent_state_next(struct extent_state *state) | ||
85 | { | ||
86 | struct rb_node *node; | ||
87 | node = rb_next(&state->rb_node); | ||
88 | if (!node) | ||
89 | return NULL; | ||
90 | return rb_entry(node, struct extent_state, rb_node); | ||
91 | } | ||
92 | |||
84 | typedef struct extent_map *(get_extent_t)(struct inode *inode, | 93 | typedef struct extent_map *(get_extent_t)(struct inode *inode, |
85 | struct page *page, | 94 | struct page *page, |
86 | size_t page_offset, | 95 | size_t page_offset, |
@@ -122,6 +131,8 @@ int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, | |||
122 | gfp_t mask); | 131 | gfp_t mask); |
123 | int find_first_extent_bit(struct extent_io_tree *tree, u64 start, | 132 | int find_first_extent_bit(struct extent_io_tree *tree, u64 start, |
124 | u64 *start_ret, u64 *end_ret, int bits); | 133 | u64 *start_ret, u64 *end_ret, int bits); |
134 | struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree, | ||
135 | u64 start, int bits); | ||
125 | int extent_invalidatepage(struct extent_io_tree *tree, | 136 | int extent_invalidatepage(struct extent_io_tree *tree, |
126 | struct page *page, unsigned long offset); | 137 | struct page *page, unsigned long offset); |
127 | int extent_write_full_page(struct extent_io_tree *tree, struct page *page, | 138 | int extent_write_full_page(struct extent_io_tree *tree, struct page *page, |