diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-07-22 11:18:07 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | 6af118ce51b52ceda357c671550c79628b9c4a65 (patch) | |
tree | b03fb64eb4567d1d1320a43f5d2142bc65193c18 /fs/btrfs/extent_io.h | |
parent | 4a09675279674041862d2210635b0cc1f60be28e (diff) |
Btrfs: Index extent buffers in an rbtree
Before, extent buffers were a temporary object, meant to map a number of pages
at once and collect operations on them.
But, a few extra fields have crept in, and they are also the best place to
store a per-tree block lock field as well. This commit puts the extent
buffers into an rbtree, and ensures a single extent buffer for each
tree block.
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, 4 insertions, 7 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 23affd27af5e..dd367617d780 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -54,13 +54,12 @@ struct extent_io_ops { | |||
54 | 54 | ||
55 | struct extent_io_tree { | 55 | struct extent_io_tree { |
56 | struct rb_root state; | 56 | struct rb_root state; |
57 | struct rb_root buffer; | ||
57 | struct address_space *mapping; | 58 | struct address_space *mapping; |
58 | u64 dirty_bytes; | 59 | u64 dirty_bytes; |
59 | spinlock_t lock; | 60 | spinlock_t lock; |
61 | spinlock_t buffer_lock; | ||
60 | struct extent_io_ops *ops; | 62 | struct extent_io_ops *ops; |
61 | spinlock_t lru_lock; | ||
62 | struct list_head buffer_lru; | ||
63 | int lru_size; | ||
64 | struct extent_state *last; | 63 | struct extent_state *last; |
65 | }; | 64 | }; |
66 | 65 | ||
@@ -87,10 +86,10 @@ struct extent_buffer { | |||
87 | unsigned long map_start; | 86 | unsigned long map_start; |
88 | unsigned long map_len; | 87 | unsigned long map_len; |
89 | struct page *first_page; | 88 | struct page *first_page; |
90 | struct list_head lru; | ||
91 | atomic_t refs; | 89 | atomic_t refs; |
92 | int flags; | 90 | int flags; |
93 | struct list_head leak_list; | 91 | struct list_head leak_list; |
92 | struct rb_node rb_node; | ||
94 | }; | 93 | }; |
95 | 94 | ||
96 | struct extent_map_tree; | 95 | struct extent_map_tree; |
@@ -112,10 +111,10 @@ typedef struct extent_map *(get_extent_t)(struct inode *inode, | |||
112 | 111 | ||
113 | void extent_io_tree_init(struct extent_io_tree *tree, | 112 | void extent_io_tree_init(struct extent_io_tree *tree, |
114 | struct address_space *mapping, gfp_t mask); | 113 | struct address_space *mapping, gfp_t mask); |
115 | void extent_io_tree_empty_lru(struct extent_io_tree *tree); | ||
116 | int try_release_extent_mapping(struct extent_map_tree *map, | 114 | int try_release_extent_mapping(struct extent_map_tree *map, |
117 | struct extent_io_tree *tree, struct page *page, | 115 | struct extent_io_tree *tree, struct page *page, |
118 | gfp_t mask); | 116 | gfp_t mask); |
117 | int try_release_extent_buffer(struct extent_io_tree *tree, struct page *page); | ||
119 | int try_release_extent_state(struct extent_map_tree *map, | 118 | int try_release_extent_state(struct extent_map_tree *map, |
120 | struct extent_io_tree *tree, struct page *page, | 119 | struct extent_io_tree *tree, struct page *page, |
121 | gfp_t mask); | 120 | gfp_t mask); |
@@ -241,8 +240,6 @@ int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset, | |||
241 | unsigned long *map_start, | 240 | unsigned long *map_start, |
242 | unsigned long *map_len, int km); | 241 | unsigned long *map_len, int km); |
243 | void unmap_extent_buffer(struct extent_buffer *eb, char *token, int km); | 242 | void unmap_extent_buffer(struct extent_buffer *eb, char *token, int km); |
244 | int invalidate_extent_lru(struct extent_io_tree *tree, u64 start, | ||
245 | unsigned long len); | ||
246 | int release_extent_buffer_tail_pages(struct extent_buffer *eb); | 243 | int release_extent_buffer_tail_pages(struct extent_buffer *eb); |
247 | int extent_range_uptodate(struct extent_io_tree *tree, | 244 | int extent_range_uptodate(struct extent_io_tree *tree, |
248 | u64 start, u64 end); | 245 | u64 start, u64 end); |