aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-03-13 09:38:00 -0400
committerChris Mason <chris.mason@oracle.com>2012-03-26 17:04:23 -0400
commit0b32f4bbb423f02acee6d43cd442f5f0775db7e0 (patch)
tree1963e5420071e70274bf77c05373dabd43bac675 /fs/btrfs/extent_io.h
parent5df4235ea15bd39f441ef334d8329b3d46b2cc57 (diff)
Btrfs: ensure an entire eb is written at once
This patch simplifies how we track our extent buffers. Previously we could exit writepages with only having written half of an extent buffer, which meant we had to track the state of the pages and the state of the extent buffers differently. Now we only read in entire extent buffers and write out entire extent buffers, this allows us to simply set bits in our bflags to indicate the state of the eb and we no longer have to do things like track uptodate with our iotree. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h24
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index 60628341f156..489d7945154f 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -37,6 +37,8 @@
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 38#define EXTENT_BUFFER_TREE_REF 5
39#define EXTENT_BUFFER_STALE 6 39#define EXTENT_BUFFER_STALE 6
40#define EXTENT_BUFFER_WRITEBACK 7
41#define EXTENT_BUFFER_IOERR 8
40 42
41/* these are flags for extent_clear_unlock_delalloc */ 43/* these are flags for extent_clear_unlock_delalloc */
42#define EXTENT_CLEAR_UNLOCK_PAGE 0x1 44#define EXTENT_CLEAR_UNLOCK_PAGE 0x1
@@ -99,6 +101,7 @@ struct extent_io_tree {
99 struct radix_tree_root buffer; 101 struct radix_tree_root buffer;
100 struct address_space *mapping; 102 struct address_space *mapping;
101 u64 dirty_bytes; 103 u64 dirty_bytes;
104 int track_uptodate;
102 spinlock_t lock; 105 spinlock_t lock;
103 spinlock_t buffer_lock; 106 spinlock_t buffer_lock;
104 struct extent_io_ops *ops; 107 struct extent_io_ops *ops;
@@ -132,7 +135,7 @@ struct extent_buffer {
132 struct extent_io_tree *tree; 135 struct extent_io_tree *tree;
133 spinlock_t refs_lock; 136 spinlock_t refs_lock;
134 atomic_t refs; 137 atomic_t refs;
135 atomic_t pages_reading; 138 atomic_t io_pages;
136 struct list_head leak_list; 139 struct list_head leak_list;
137 struct rcu_head rcu_head; 140 struct rcu_head rcu_head;
138 pid_t lock_owner; 141 pid_t lock_owner;
@@ -249,6 +252,8 @@ int extent_writepages(struct extent_io_tree *tree,
249 struct address_space *mapping, 252 struct address_space *mapping,
250 get_extent_t *get_extent, 253 get_extent_t *get_extent,
251 struct writeback_control *wbc); 254 struct writeback_control *wbc);
255int btree_write_cache_pages(struct address_space *mapping,
256 struct writeback_control *wbc);
252int extent_readpages(struct extent_io_tree *tree, 257int extent_readpages(struct extent_io_tree *tree,
253 struct address_space *mapping, 258 struct address_space *mapping,
254 struct list_head *pages, unsigned nr_pages, 259 struct list_head *pages, unsigned nr_pages,
@@ -297,18 +302,11 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
297void memset_extent_buffer(struct extent_buffer *eb, char c, 302void memset_extent_buffer(struct extent_buffer *eb, char c,
298 unsigned long start, unsigned long len); 303 unsigned long start, unsigned long len);
299int wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits); 304int wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits);
300int clear_extent_buffer_dirty(struct extent_io_tree *tree, 305int clear_extent_buffer_dirty(struct extent_buffer *eb);
301 struct extent_buffer *eb); 306int set_extent_buffer_dirty(struct extent_buffer *eb);
302int set_extent_buffer_dirty(struct extent_io_tree *tree, 307int set_extent_buffer_uptodate(struct extent_buffer *eb);
303 struct extent_buffer *eb); 308int clear_extent_buffer_uptodate(struct extent_buffer *eb);
304int set_extent_buffer_uptodate(struct extent_io_tree *tree, 309int extent_buffer_uptodate(struct extent_buffer *eb);
305 struct extent_buffer *eb);
306int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
307 struct extent_buffer *eb,
308 struct extent_state **cached_state);
309int extent_buffer_uptodate(struct extent_io_tree *tree,
310 struct extent_buffer *eb,
311 struct extent_state *cached_state);
312int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset, 310int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
313 unsigned long min_len, char **map, 311 unsigned long min_len, char **map,
314 unsigned long *map_start, 312 unsigned long *map_start,