diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:18:14 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:56 -0400 |
commit | 4dc119046d0d8501afa4346472917fb05586ad9c (patch) | |
tree | 712c98f8f66aa1e83020574a19d015df88c5024e /fs/btrfs/extent_map.h | |
parent | e19caa5f0e34b571ed0c2617554af5c43cb124d1 (diff) |
Btrfs: Add an extent buffer LRU to reduce radix tree hits
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.h')
-rw-r--r-- | fs/btrfs/extent_map.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/btrfs/extent_map.h b/fs/btrfs/extent_map.h index 8409b5cbeda7..52a8b9394fc6 100644 --- a/fs/btrfs/extent_map.h +++ b/fs/btrfs/extent_map.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define EXTENT_DELALLOC (1 << 5) | 16 | #define EXTENT_DELALLOC (1 << 5) |
17 | #define EXTENT_DEFRAG (1 << 6) | 17 | #define EXTENT_DEFRAG (1 << 6) |
18 | #define EXTENT_DEFRAG_DONE (1 << 7) | 18 | #define EXTENT_DEFRAG_DONE (1 << 7) |
19 | #define EXTENT_BUFFER_FILLED (1 << 8) | ||
19 | #define EXTENT_IOBITS (EXTENT_LOCKED | EXTENT_WRITEBACK) | 20 | #define EXTENT_IOBITS (EXTENT_LOCKED | EXTENT_WRITEBACK) |
20 | 21 | ||
21 | 22 | ||
@@ -33,6 +34,9 @@ struct extent_map_tree { | |||
33 | struct address_space *mapping; | 34 | struct address_space *mapping; |
34 | rwlock_t lock; | 35 | rwlock_t lock; |
35 | struct extent_map_ops *ops; | 36 | struct extent_map_ops *ops; |
37 | spinlock_t lru_lock; | ||
38 | struct list_head buffer_lru; | ||
39 | int lru_size; | ||
36 | }; | 40 | }; |
37 | 41 | ||
38 | /* note, this must start with the same fields as fs/extent_map.c:tree_entry */ | 42 | /* note, this must start with the same fields as fs/extent_map.c:tree_entry */ |
@@ -64,20 +68,17 @@ struct extent_state { | |||
64 | struct list_head list; | 68 | struct list_head list; |
65 | }; | 69 | }; |
66 | 70 | ||
67 | #define EXTENT_INLINE_PAGES 32 | ||
68 | struct extent_buffer { | 71 | struct extent_buffer { |
69 | u64 start; | 72 | u64 start; |
70 | unsigned long len; | 73 | unsigned long len; |
71 | atomic_t refs; | ||
72 | int flags; | ||
73 | struct list_head list; | ||
74 | struct list_head leak_list; | ||
75 | unsigned long alloc_addr; | ||
76 | char *map_token; | 74 | char *map_token; |
77 | char *kaddr; | 75 | char *kaddr; |
78 | unsigned long map_start; | 76 | unsigned long map_start; |
79 | unsigned long map_len; | 77 | unsigned long map_len; |
80 | struct page *pages[EXTENT_INLINE_PAGES]; | 78 | struct page *last_page; |
79 | struct list_head lru; | ||
80 | atomic_t refs; | ||
81 | int flags; | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | typedef struct extent_map *(get_extent_t)(struct inode *inode, | 84 | typedef struct extent_map *(get_extent_t)(struct inode *inode, |
@@ -88,6 +89,7 @@ typedef struct extent_map *(get_extent_t)(struct inode *inode, | |||
88 | 89 | ||
89 | void extent_map_tree_init(struct extent_map_tree *tree, | 90 | void extent_map_tree_init(struct extent_map_tree *tree, |
90 | struct address_space *mapping, gfp_t mask); | 91 | struct address_space *mapping, gfp_t mask); |
92 | void extent_map_tree_cleanup(struct extent_map_tree *tree); | ||
91 | struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, | 93 | struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree, |
92 | u64 start, u64 end); | 94 | u64 start, u64 end); |
93 | int add_extent_mapping(struct extent_map_tree *tree, | 95 | int add_extent_mapping(struct extent_map_tree *tree, |