diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:20:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 13:20:44 -0400 |
commit | c226fd659fa7b6a7b038df5ae6856a68514bacde (patch) | |
tree | a695689d4d8cdd927400747b94250521eb863686 /fs/btrfs/ctree.h | |
parent | c09bca786ff941ed17c5f381c4eca5b106808c51 (diff) | |
parent | d57e62b89796f751c9422801cbcd407a9f8dcdc4 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable
* git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable:
Btrfs: try to free metadata pages when we free btree blocks
Btrfs: add extra flushing for renames and truncates
Btrfs: make sure btrfs_update_delayed_ref doesn't increase ref_mod
Btrfs: optimize fsyncs on old files
Btrfs: tree logging unlink/rename fixes
Btrfs: Make sure i_nlink doesn't hit zero too soon during log replay
Btrfs: limit balancing work while flushing delayed refs
Btrfs: readahead checksums during btrfs_finish_ordered_io
Btrfs: leave btree locks spinning more often
Btrfs: Only let very young transactions grow during commit
Btrfs: Check for a blocking lock before taking the spin
Btrfs: reduce stack in cow_file_range
Btrfs: reduce stalls during transaction commit
Btrfs: process the delayed reference queue in clusters
Btrfs: try to cleanup delayed refs while freeing extents
Btrfs: reduce stack usage in some crucial tree balancing functions
Btrfs: do extent allocation and reference count updates in the background
Btrfs: don't preallocate metadata blocks during btrfs_search_slot
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 69 |
1 files changed, 55 insertions, 14 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 7dd1b6d0bf32..9417713542a2 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -45,6 +45,13 @@ struct btrfs_ordered_sum; | |||
45 | 45 | ||
46 | #define BTRFS_MAX_LEVEL 8 | 46 | #define BTRFS_MAX_LEVEL 8 |
47 | 47 | ||
48 | /* | ||
49 | * files bigger than this get some pre-flushing when they are added | ||
50 | * to the ordered operations list. That way we limit the total | ||
51 | * work done by the commit | ||
52 | */ | ||
53 | #define BTRFS_ORDERED_OPERATIONS_FLUSH_LIMIT (8 * 1024 * 1024) | ||
54 | |||
48 | /* holds pointers to all of the tree roots */ | 55 | /* holds pointers to all of the tree roots */ |
49 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL | 56 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL |
50 | 57 | ||
@@ -401,15 +408,16 @@ struct btrfs_path { | |||
401 | int locks[BTRFS_MAX_LEVEL]; | 408 | int locks[BTRFS_MAX_LEVEL]; |
402 | int reada; | 409 | int reada; |
403 | /* keep some upper locks as we walk down */ | 410 | /* keep some upper locks as we walk down */ |
404 | int keep_locks; | ||
405 | int skip_locking; | ||
406 | int lowest_level; | 411 | int lowest_level; |
407 | 412 | ||
408 | /* | 413 | /* |
409 | * set by btrfs_split_item, tells search_slot to keep all locks | 414 | * set by btrfs_split_item, tells search_slot to keep all locks |
410 | * and to force calls to keep space in the nodes | 415 | * and to force calls to keep space in the nodes |
411 | */ | 416 | */ |
412 | int search_for_split; | 417 | unsigned int search_for_split:1; |
418 | unsigned int keep_locks:1; | ||
419 | unsigned int skip_locking:1; | ||
420 | unsigned int leave_spinning:1; | ||
413 | }; | 421 | }; |
414 | 422 | ||
415 | /* | 423 | /* |
@@ -688,15 +696,18 @@ struct btrfs_fs_info { | |||
688 | struct rb_root block_group_cache_tree; | 696 | struct rb_root block_group_cache_tree; |
689 | 697 | ||
690 | struct extent_io_tree pinned_extents; | 698 | struct extent_io_tree pinned_extents; |
691 | struct extent_io_tree pending_del; | ||
692 | struct extent_io_tree extent_ins; | ||
693 | 699 | ||
694 | /* logical->physical extent mapping */ | 700 | /* logical->physical extent mapping */ |
695 | struct btrfs_mapping_tree mapping_tree; | 701 | struct btrfs_mapping_tree mapping_tree; |
696 | 702 | ||
697 | u64 generation; | 703 | u64 generation; |
698 | u64 last_trans_committed; | 704 | u64 last_trans_committed; |
699 | u64 last_trans_new_blockgroup; | 705 | |
706 | /* | ||
707 | * this is updated to the current trans every time a full commit | ||
708 | * is required instead of the faster short fsync log commits | ||
709 | */ | ||
710 | u64 last_trans_log_full_commit; | ||
700 | u64 open_ioctl_trans; | 711 | u64 open_ioctl_trans; |
701 | unsigned long mount_opt; | 712 | unsigned long mount_opt; |
702 | u64 max_extent; | 713 | u64 max_extent; |
@@ -717,12 +728,21 @@ struct btrfs_fs_info { | |||
717 | struct mutex tree_log_mutex; | 728 | struct mutex tree_log_mutex; |
718 | struct mutex transaction_kthread_mutex; | 729 | struct mutex transaction_kthread_mutex; |
719 | struct mutex cleaner_mutex; | 730 | struct mutex cleaner_mutex; |
720 | struct mutex extent_ins_mutex; | ||
721 | struct mutex pinned_mutex; | 731 | struct mutex pinned_mutex; |
722 | struct mutex chunk_mutex; | 732 | struct mutex chunk_mutex; |
723 | struct mutex drop_mutex; | 733 | struct mutex drop_mutex; |
724 | struct mutex volume_mutex; | 734 | struct mutex volume_mutex; |
725 | struct mutex tree_reloc_mutex; | 735 | struct mutex tree_reloc_mutex; |
736 | |||
737 | /* | ||
738 | * this protects the ordered operations list only while we are | ||
739 | * processing all of the entries on it. This way we make | ||
740 | * sure the commit code doesn't find the list temporarily empty | ||
741 | * because another function happens to be doing non-waiting preflush | ||
742 | * before jumping into the main commit. | ||
743 | */ | ||
744 | struct mutex ordered_operations_mutex; | ||
745 | |||
726 | struct list_head trans_list; | 746 | struct list_head trans_list; |
727 | struct list_head hashers; | 747 | struct list_head hashers; |
728 | struct list_head dead_roots; | 748 | struct list_head dead_roots; |
@@ -737,10 +757,29 @@ struct btrfs_fs_info { | |||
737 | * ordered extents | 757 | * ordered extents |
738 | */ | 758 | */ |
739 | spinlock_t ordered_extent_lock; | 759 | spinlock_t ordered_extent_lock; |
760 | |||
761 | /* | ||
762 | * all of the data=ordered extents pending writeback | ||
763 | * these can span multiple transactions and basically include | ||
764 | * every dirty data page that isn't from nodatacow | ||
765 | */ | ||
740 | struct list_head ordered_extents; | 766 | struct list_head ordered_extents; |
767 | |||
768 | /* | ||
769 | * all of the inodes that have delalloc bytes. It is possible for | ||
770 | * this list to be empty even when there is still dirty data=ordered | ||
771 | * extents waiting to finish IO. | ||
772 | */ | ||
741 | struct list_head delalloc_inodes; | 773 | struct list_head delalloc_inodes; |
742 | 774 | ||
743 | /* | 775 | /* |
776 | * special rename and truncate targets that must be on disk before | ||
777 | * we're allowed to commit. This is basically the ext3 style | ||
778 | * data=ordered list. | ||
779 | */ | ||
780 | struct list_head ordered_operations; | ||
781 | |||
782 | /* | ||
744 | * there is a pool of worker threads for checksumming during writes | 783 | * there is a pool of worker threads for checksumming during writes |
745 | * and a pool for checksumming after reads. This is because readers | 784 | * and a pool for checksumming after reads. This is because readers |
746 | * can run with FS locks held, and the writers may be waiting for | 785 | * can run with FS locks held, and the writers may be waiting for |
@@ -781,6 +820,11 @@ struct btrfs_fs_info { | |||
781 | atomic_t throttle_gen; | 820 | atomic_t throttle_gen; |
782 | 821 | ||
783 | u64 total_pinned; | 822 | u64 total_pinned; |
823 | |||
824 | /* protected by the delalloc lock, used to keep from writing | ||
825 | * metadata until there is a nice batch | ||
826 | */ | ||
827 | u64 dirty_metadata_bytes; | ||
784 | struct list_head dirty_cowonly_roots; | 828 | struct list_head dirty_cowonly_roots; |
785 | 829 | ||
786 | struct btrfs_fs_devices *fs_devices; | 830 | struct btrfs_fs_devices *fs_devices; |
@@ -1704,18 +1748,15 @@ static inline struct dentry *fdentry(struct file *file) | |||
1704 | } | 1748 | } |
1705 | 1749 | ||
1706 | /* extent-tree.c */ | 1750 | /* extent-tree.c */ |
1751 | int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | ||
1752 | struct btrfs_root *root, unsigned long count); | ||
1707 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); | 1753 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); |
1708 | int btrfs_lookup_extent_ref(struct btrfs_trans_handle *trans, | ||
1709 | struct btrfs_root *root, u64 bytenr, | ||
1710 | u64 num_bytes, u32 *refs); | ||
1711 | int btrfs_update_pinned_extents(struct btrfs_root *root, | 1754 | int btrfs_update_pinned_extents(struct btrfs_root *root, |
1712 | u64 bytenr, u64 num, int pin); | 1755 | u64 bytenr, u64 num, int pin); |
1713 | int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, | 1756 | int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, |
1714 | struct btrfs_root *root, struct extent_buffer *leaf); | 1757 | struct btrfs_root *root, struct extent_buffer *leaf); |
1715 | int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans, | 1758 | int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans, |
1716 | struct btrfs_root *root, u64 objectid, u64 bytenr); | 1759 | struct btrfs_root *root, u64 objectid, u64 bytenr); |
1717 | int btrfs_extent_post_op(struct btrfs_trans_handle *trans, | ||
1718 | struct btrfs_root *root); | ||
1719 | int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy); | 1760 | int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy); |
1720 | struct btrfs_block_group_cache *btrfs_lookup_block_group( | 1761 | struct btrfs_block_group_cache *btrfs_lookup_block_group( |
1721 | struct btrfs_fs_info *info, | 1762 | struct btrfs_fs_info *info, |
@@ -1777,7 +1818,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | |||
1777 | u64 root_objectid, u64 ref_generation, | 1818 | u64 root_objectid, u64 ref_generation, |
1778 | u64 owner_objectid); | 1819 | u64 owner_objectid); |
1779 | int btrfs_update_extent_ref(struct btrfs_trans_handle *trans, | 1820 | int btrfs_update_extent_ref(struct btrfs_trans_handle *trans, |
1780 | struct btrfs_root *root, u64 bytenr, | 1821 | struct btrfs_root *root, u64 bytenr, u64 num_bytes, |
1781 | u64 orig_parent, u64 parent, | 1822 | u64 orig_parent, u64 parent, |
1782 | u64 root_objectid, u64 ref_generation, | 1823 | u64 root_objectid, u64 ref_generation, |
1783 | u64 owner_objectid); | 1824 | u64 owner_objectid); |
@@ -1838,7 +1879,7 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key, | |||
1838 | int btrfs_cow_block(struct btrfs_trans_handle *trans, | 1879 | int btrfs_cow_block(struct btrfs_trans_handle *trans, |
1839 | struct btrfs_root *root, struct extent_buffer *buf, | 1880 | struct btrfs_root *root, struct extent_buffer *buf, |
1840 | struct extent_buffer *parent, int parent_slot, | 1881 | struct extent_buffer *parent, int parent_slot, |
1841 | struct extent_buffer **cow_ret, u64 prealloc_dest); | 1882 | struct extent_buffer **cow_ret); |
1842 | int btrfs_copy_root(struct btrfs_trans_handle *trans, | 1883 | int btrfs_copy_root(struct btrfs_trans_handle *trans, |
1843 | struct btrfs_root *root, | 1884 | struct btrfs_root *root, |
1844 | struct extent_buffer *buf, | 1885 | struct extent_buffer *buf, |