aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.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/ctree.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/ctree.h')
-rw-r--r--fs/btrfs/ctree.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index f3783dbd9b60..ceebc052ddcb 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -25,6 +25,7 @@
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/backing-dev.h> 27#include <linux/backing-dev.h>
28#include <linux/wait.h>
28#include <asm/kmap_types.h> 29#include <asm/kmap_types.h>
29#include "bit-radix.h" 30#include "bit-radix.h"
30#include "extent_io.h" 31#include "extent_io.h"
@@ -37,6 +38,7 @@ extern struct kmem_cache *btrfs_trans_handle_cachep;
37extern struct kmem_cache *btrfs_transaction_cachep; 38extern struct kmem_cache *btrfs_transaction_cachep;
38extern struct kmem_cache *btrfs_bit_radix_cachep; 39extern struct kmem_cache *btrfs_bit_radix_cachep;
39extern struct kmem_cache *btrfs_path_cachep; 40extern struct kmem_cache *btrfs_path_cachep;
41struct btrfs_ordered_sum;
40 42
41#define BTRFS_MAGIC "_B5RfS_M" 43#define BTRFS_MAGIC "_B5RfS_M"
42 44
@@ -510,6 +512,7 @@ struct btrfs_fs_info {
510 u64 max_inline; 512 u64 max_inline;
511 u64 alloc_start; 513 u64 alloc_start;
512 struct btrfs_transaction *running_transaction; 514 struct btrfs_transaction *running_transaction;
515 wait_queue_head_t transaction_throttle;
513 struct btrfs_super_block super_copy; 516 struct btrfs_super_block super_copy;
514 struct btrfs_super_block super_for_commit; 517 struct btrfs_super_block super_for_commit;
515 struct block_device *__bdev; 518 struct block_device *__bdev;
@@ -541,6 +544,7 @@ struct btrfs_fs_info {
541 */ 544 */
542 struct btrfs_workers workers; 545 struct btrfs_workers workers;
543 struct btrfs_workers endio_workers; 546 struct btrfs_workers endio_workers;
547 struct btrfs_workers endio_write_workers;
544 struct btrfs_workers submit_workers; 548 struct btrfs_workers submit_workers;
545 struct task_struct *transaction_kthread; 549 struct task_struct *transaction_kthread;
546 struct task_struct *cleaner_kthread; 550 struct task_struct *cleaner_kthread;
@@ -1384,6 +1388,17 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
1384 u64 owner, u64 owner_offset, 1388 u64 owner, u64 owner_offset,
1385 u64 empty_size, u64 hint_byte, 1389 u64 empty_size, u64 hint_byte,
1386 u64 search_end, struct btrfs_key *ins, u64 data); 1390 u64 search_end, struct btrfs_key *ins, u64 data);
1391int btrfs_alloc_reserved_extent(struct btrfs_trans_handle *trans,
1392 struct btrfs_root *root,
1393 u64 root_objectid, u64 ref_generation,
1394 u64 owner, u64 owner_offset,
1395 struct btrfs_key *ins);
1396int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
1397 struct btrfs_root *root,
1398 u64 num_bytes, u64 min_alloc_size,
1399 u64 empty_size, u64 hint_byte,
1400 u64 search_end, struct btrfs_key *ins,
1401 u64 data);
1387int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 1402int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
1388 struct extent_buffer *buf); 1403 struct extent_buffer *buf);
1389int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root 1404int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
@@ -1556,9 +1571,9 @@ int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
1556 u64 bytenr, int mod); 1571 u64 bytenr, int mod);
1557int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, 1572int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
1558 struct btrfs_root *root, struct inode *inode, 1573 struct btrfs_root *root, struct inode *inode,
1559 struct bio *bio, char *sums); 1574 struct btrfs_ordered_sum *sums);
1560int btrfs_csum_one_bio(struct btrfs_root *root, 1575int btrfs_csum_one_bio(struct btrfs_root *root,
1561 struct bio *bio, char **sums_ret); 1576 struct bio *bio, struct btrfs_ordered_sum **sums_ret);
1562struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans, 1577struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans,
1563 struct btrfs_root *root, 1578 struct btrfs_root *root,
1564 struct btrfs_path *path, 1579 struct btrfs_path *path,