aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-17 12:53:50 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:04 -0400
commite6dcd2dc9c489108648e2ed543315dd134d50a9a (patch)
treecddf6f588b65e28c5feb8bff89b22d8ff70f8a50 /fs/btrfs/extent_io.h
parent77a41afb7d0dd0f27b6f2f1a5bc701929c7034de (diff)
Btrfs: New data=ordered implementation
The old data=ordered code would force commit to wait until all the data extents from the transaction were fully on disk. This introduced large latencies into the commit and stalled new writers in the transaction for a long time. The new code changes the way data allocations and extents work: * When delayed allocation is filled, data extents are reserved, and the extent bit EXTENT_ORDERED is set on the entire range of the extent. A struct btrfs_ordered_extent is allocated an inserted into a per-inode rbtree to track the pending extents. * As each page is written EXTENT_ORDERED is cleared on the bytes corresponding to that page. * When all of the bytes corresponding to a single struct btrfs_ordered_extent are written, The previously reserved extent is inserted into the FS btree and into the extent allocation trees. The checksums for the file data are also updated. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index f1960dafaa19..2268a7995896 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -13,6 +13,8 @@
13#define EXTENT_DEFRAG (1 << 6) 13#define EXTENT_DEFRAG (1 << 6)
14#define EXTENT_DEFRAG_DONE (1 << 7) 14#define EXTENT_DEFRAG_DONE (1 << 7)
15#define EXTENT_BUFFER_FILLED (1 << 8) 15#define EXTENT_BUFFER_FILLED (1 << 8)
16#define EXTENT_ORDERED (1 << 9)
17#define EXTENT_ORDERED_METADATA (1 << 10)
16#define EXTENT_IOBITS (EXTENT_LOCKED | EXTENT_WRITEBACK) 18#define EXTENT_IOBITS (EXTENT_LOCKED | EXTENT_WRITEBACK)
17 19
18/* 20/*
@@ -42,7 +44,7 @@ struct extent_io_ops {
42 int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end, 44 int (*readpage_end_io_hook)(struct page *page, u64 start, u64 end,
43 struct extent_state *state); 45 struct extent_state *state);
44 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, 46 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
45 struct extent_state *state); 47 struct extent_state *state, int uptodate);
46 int (*set_bit_hook)(struct inode *inode, u64 start, u64 end, 48 int (*set_bit_hook)(struct inode *inode, u64 start, u64 end,
47 unsigned long old, unsigned long bits); 49 unsigned long old, unsigned long bits);
48 int (*clear_bit_hook)(struct inode *inode, u64 start, u64 end, 50 int (*clear_bit_hook)(struct inode *inode, u64 start, u64 end,
@@ -131,6 +133,8 @@ int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end,
131 int bits, int filled); 133 int bits, int filled);
132int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 134int clear_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
133 int bits, gfp_t mask); 135 int bits, gfp_t mask);
136int clear_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
137 int bits, int wake, int delete, gfp_t mask);
134int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, 138int set_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
135 int bits, gfp_t mask); 139 int bits, gfp_t mask);
136int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end, 140int set_extent_uptodate(struct extent_io_tree *tree, u64 start, u64 end,
@@ -141,8 +145,14 @@ int set_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
141 gfp_t mask); 145 gfp_t mask);
142int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end, 146int clear_extent_dirty(struct extent_io_tree *tree, u64 start, u64 end,
143 gfp_t mask); 147 gfp_t mask);
148int clear_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end,
149 gfp_t mask);
150int clear_extent_ordered_metadata(struct extent_io_tree *tree, u64 start,
151 u64 end, gfp_t mask);
144int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end, 152int set_extent_delalloc(struct extent_io_tree *tree, u64 start, u64 end,
145 gfp_t mask); 153 gfp_t mask);
154int set_extent_ordered(struct extent_io_tree *tree, u64 start, u64 end,
155 gfp_t mask);
146int find_first_extent_bit(struct extent_io_tree *tree, u64 start, 156int find_first_extent_bit(struct extent_io_tree *tree, u64 start,
147 u64 *start_ret, u64 *end_ret, int bits); 157 u64 *start_ret, u64 *end_ret, int bits);
148struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree, 158struct extent_state *find_first_extent_bit_state(struct extent_io_tree *tree,
@@ -209,6 +219,8 @@ void memset_extent_buffer(struct extent_buffer *eb, char c,
209 unsigned long start, unsigned long len); 219 unsigned long start, unsigned long len);
210int wait_on_extent_buffer_writeback(struct extent_io_tree *tree, 220int wait_on_extent_buffer_writeback(struct extent_io_tree *tree,
211 struct extent_buffer *eb); 221 struct extent_buffer *eb);
222int wait_on_extent_writeback(struct extent_io_tree *tree, u64 start, u64 end);
223int wait_extent_bit(struct extent_io_tree *tree, u64 start, u64 end, int bits);
212int clear_extent_buffer_dirty(struct extent_io_tree *tree, 224int clear_extent_buffer_dirty(struct extent_io_tree *tree,
213 struct extent_buffer *eb); 225 struct extent_buffer *eb);
214int set_extent_buffer_dirty(struct extent_io_tree *tree, 226int set_extent_buffer_dirty(struct extent_io_tree *tree,