aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-01-29 09:59:12 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:59 -0400
commit70dec8079d78691e476cc6c7cede40656078ad30 (patch)
tree19ab80f247fc026c3f5a5713381e98372737227b /fs/btrfs/extent_io.h
parentaadfeb6e39ad6bde080cb3ab23f4da57ccb25f4a (diff)
Btrfs: extent_io and extent_state optimizations
The end_bio routines are changed to take a pointer to the extent state struct, and the state tree is walked in order to set/clear appropriate bits as IO completes. This greatly reduces the number of rbtree searches done by the end_bio handlers, and reduces lock contention. The extent_io releasepage function is changed to avoid expensive searches for locked state. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 06be1fe84b29..f1e8bf251f32 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -23,19 +23,23 @@
23#define EXTENT_PAGE_PRIVATE 1 23#define EXTENT_PAGE_PRIVATE 1
24#define EXTENT_PAGE_PRIVATE_FIRST_PAGE 3 24#define EXTENT_PAGE_PRIVATE_FIRST_PAGE 3
25 25
26struct extent_state;
27
26struct extent_io_ops { 28struct extent_io_ops {
27 int (*fill_delalloc)(struct inode *inode, u64 start, u64 end); 29 int (*fill_delalloc)(struct inode *inode, u64 start, u64 end);
28 int (*writepage_io_hook)(struct page *page, u64 start, u64 end); 30 int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
29 int (*readpage_io_hook)(struct page *page, u64 start, u64 end); 31 int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
30 int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end); 32 int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end,
31 void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end); 33 struct extent_state *state);
34 void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
35 struct extent_state *state);
32}; 36};
33 37
34struct extent_io_tree { 38struct extent_io_tree {
35 struct rb_root state; 39 struct rb_root state;
36 struct address_space *mapping; 40 struct address_space *mapping;
37 u64 dirty_bytes; 41 u64 dirty_bytes;
38 rwlock_t lock; 42 spinlock_t lock;
39 struct extent_io_ops *ops; 43 struct extent_io_ops *ops;
40 spinlock_t lru_lock; 44 spinlock_t lru_lock;
41 struct list_head buffer_lru; 45 struct list_head buffer_lru;
@@ -45,8 +49,8 @@ struct extent_io_tree {
45struct extent_state { 49struct extent_state {
46 u64 start; 50 u64 start;
47 u64 end; /* inclusive */ 51 u64 end; /* inclusive */
48 int in_tree;
49 struct rb_node rb_node; 52 struct rb_node rb_node;
53 struct extent_io_tree *tree;
50 wait_queue_head_t wq; 54 wait_queue_head_t wq;
51 atomic_t refs; 55 atomic_t refs;
52 unsigned long state; 56 unsigned long state;
@@ -82,7 +86,8 @@ void extent_io_tree_init(struct extent_io_tree *tree,
82 struct address_space *mapping, gfp_t mask); 86 struct address_space *mapping, gfp_t mask);
83void extent_io_tree_empty_lru(struct extent_io_tree *tree); 87void extent_io_tree_empty_lru(struct extent_io_tree *tree);
84int try_release_extent_mapping(struct extent_map_tree *map, 88int try_release_extent_mapping(struct extent_map_tree *map,
85 struct extent_io_tree *tree, struct page *page); 89 struct extent_io_tree *tree, struct page *page,
90 gfp_t mask);
86int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); 91int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
87int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask); 92int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
88int extent_read_full_page(struct extent_io_tree *tree, struct page *page, 93int extent_read_full_page(struct extent_io_tree *tree, struct page *page,