summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-01-29 15:59:12 +0100
committerChris Mason <chris.mason@oracle.com>2008-09-25 17:03:59 +0200
commit70dec8079d78691e476cc6c7cede40656078ad30 (patch)
tree19ab80f247fc026c3f5a5713381e98372737227b /fs/btrfs/extent_io.h
parentBtrfs: Add some extra debugging around file data checksum failures (diff)
downloadlinux-70dec8079d78691e476cc6c7cede40656078ad30.tar.xz
linux-70dec8079d78691e476cc6c7cede40656078ad30.zip
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 @@
#define EXTENT_PAGE_PRIVATE 1
#define EXTENT_PAGE_PRIVATE_FIRST_PAGE 3
+struct extent_state;
+
struct extent_io_ops {
int (*fill_delalloc)(struct inode *inode, u64 start, u64 end);
int (*writepage_io_hook)(struct page *page, u64 start, u64 end);
int (*readpage_io_hook)(struct page *page, u64 start, u64 end);
- int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end);
- void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end);
+ int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end,
+ struct extent_state *state);
+ void (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
+ struct extent_state *state);
};
struct extent_io_tree {
struct rb_root state;
struct address_space *mapping;
u64 dirty_bytes;
- rwlock_t lock;
+ spinlock_t lock;
struct extent_io_ops *ops;
spinlock_t lru_lock;
struct list_head buffer_lru;
@@ -45,8 +49,8 @@ struct extent_io_tree {
struct extent_state {
u64 start;
u64 end; /* inclusive */
- int in_tree;
struct rb_node rb_node;
+ struct extent_io_tree *tree;
wait_queue_head_t wq;
atomic_t refs;
unsigned long state;
@@ -82,7 +86,8 @@ void extent_io_tree_init(struct extent_io_tree *tree,
struct address_space *mapping, gfp_t mask);
void extent_io_tree_empty_lru(struct extent_io_tree *tree);
int try_release_extent_mapping(struct extent_map_tree *map,
- struct extent_io_tree *tree, struct page *page);
+ struct extent_io_tree *tree, struct page *page,
+ gfp_t mask);
int lock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
int unlock_extent(struct extent_io_tree *tree, u64 start, u64 end, gfp_t mask);
int extent_read_full_page(struct extent_io_tree *tree, struct page *page,