aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-03-09 16:01:49 -0500
committerChris Mason <chris.mason@oracle.com>2012-03-26 16:51:08 -0400
commit3083ee2e18b701122a3b841db83448543a87a583 (patch)
tree0265021499da54e5b4667a041f8b82c6d1a8667e /fs/btrfs/extent_io.h
parent115391d2315239164e400a8259b26392afccf3bd (diff)
Btrfs: introduce free_extent_buffer_stale
Because btrfs cow's we can end up with extent buffers that are no longer necessary just sitting around in memory. So instead of evicting these pages, we could end up evicting things we actually care about. Thus we have free_extent_buffer_stale for use when we are freeing tree blocks. This will make it so that the ref for the eb being in the radix tree is dropped as soon as possible and then is freed when the refcount hits 0 instead of waiting to be released by releasepage. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 83e432da2e26..60628341f156 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -35,6 +35,8 @@
35#define EXTENT_BUFFER_DIRTY 2 35#define EXTENT_BUFFER_DIRTY 2
36#define EXTENT_BUFFER_CORRUPT 3 36#define EXTENT_BUFFER_CORRUPT 3
37#define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */ 37#define EXTENT_BUFFER_READAHEAD 4 /* this got triggered by readahead */
38#define EXTENT_BUFFER_TREE_REF 5
39#define EXTENT_BUFFER_STALE 6
38 40
39/* these are flags for extent_clear_unlock_delalloc */ 41/* these are flags for extent_clear_unlock_delalloc */
40#define EXTENT_CLEAR_UNLOCK_PAGE 0x1 42#define EXTENT_CLEAR_UNLOCK_PAGE 0x1
@@ -128,6 +130,7 @@ struct extent_buffer {
128 unsigned long map_len; 130 unsigned long map_len;
129 unsigned long bflags; 131 unsigned long bflags;
130 struct extent_io_tree *tree; 132 struct extent_io_tree *tree;
133 spinlock_t refs_lock;
131 atomic_t refs; 134 atomic_t refs;
132 atomic_t pages_reading; 135 atomic_t pages_reading;
133 struct list_head leak_list; 136 struct list_head leak_list;
@@ -184,7 +187,7 @@ void extent_io_tree_init(struct extent_io_tree *tree,
184int try_release_extent_mapping(struct extent_map_tree *map, 187int try_release_extent_mapping(struct extent_map_tree *map,
185 struct extent_io_tree *tree, struct page *page, 188 struct extent_io_tree *tree, struct page *page,
186 gfp_t mask); 189 gfp_t mask);
187int try_release_extent_buffer(struct extent_io_tree *tree, struct page *page); 190int try_release_extent_buffer(struct page *page, gfp_t mask);
188int try_release_extent_state(struct extent_map_tree *map, 191int try_release_extent_state(struct extent_map_tree *map,
189 struct extent_io_tree *tree, struct page *page, 192 struct extent_io_tree *tree, struct page *page,
190 gfp_t mask); 193 gfp_t mask);
@@ -261,6 +264,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
261struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree, 264struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree,
262 u64 start, unsigned long len); 265 u64 start, unsigned long len);
263void free_extent_buffer(struct extent_buffer *eb); 266void free_extent_buffer(struct extent_buffer *eb);
267void free_extent_buffer_stale(struct extent_buffer *eb);
264#define WAIT_NONE 0 268#define WAIT_NONE 0
265#define WAIT_COMPLETE 1 269#define WAIT_COMPLETE 1
266#define WAIT_PAGE_LOCK 2 270#define WAIT_PAGE_LOCK 2