diff options
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 86 |
1 files changed, 55 insertions, 31 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index eee060f88113..5e1d4e30e9d8 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -43,11 +43,7 @@ struct btrfs_ordered_sum; | |||
43 | 43 | ||
44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) | 44 | #define BTRFS_ACL_NOT_CACHED ((void *)-1) |
45 | 45 | ||
46 | #ifdef CONFIG_LOCKDEP | 46 | #define BTRFS_MAX_LEVEL 8 |
47 | # define BTRFS_MAX_LEVEL 7 | ||
48 | #else | ||
49 | # define BTRFS_MAX_LEVEL 8 | ||
50 | #endif | ||
51 | 47 | ||
52 | /* holds pointers to all of the tree roots */ | 48 | /* holds pointers to all of the tree roots */ |
53 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL | 49 | #define BTRFS_ROOT_TREE_OBJECTID 1ULL |
@@ -454,17 +450,11 @@ struct btrfs_timespec { | |||
454 | __le32 nsec; | 450 | __le32 nsec; |
455 | } __attribute__ ((__packed__)); | 451 | } __attribute__ ((__packed__)); |
456 | 452 | ||
457 | typedef enum { | 453 | enum btrfs_compression_type { |
458 | BTRFS_COMPRESS_NONE = 0, | 454 | BTRFS_COMPRESS_NONE = 0, |
459 | BTRFS_COMPRESS_ZLIB = 1, | 455 | BTRFS_COMPRESS_ZLIB = 1, |
460 | BTRFS_COMPRESS_LAST = 2, | 456 | BTRFS_COMPRESS_LAST = 2, |
461 | } btrfs_compression_type; | 457 | }; |
462 | |||
463 | /* we don't understand any encryption methods right now */ | ||
464 | typedef enum { | ||
465 | BTRFS_ENCRYPTION_NONE = 0, | ||
466 | BTRFS_ENCRYPTION_LAST = 1, | ||
467 | } btrfs_encryption_type; | ||
468 | 458 | ||
469 | struct btrfs_inode_item { | 459 | struct btrfs_inode_item { |
470 | /* nfs style generation number */ | 460 | /* nfs style generation number */ |
@@ -606,13 +596,27 @@ struct btrfs_block_group_item { | |||
606 | 596 | ||
607 | struct btrfs_space_info { | 597 | struct btrfs_space_info { |
608 | u64 flags; | 598 | u64 flags; |
609 | u64 total_bytes; | 599 | |
610 | u64 bytes_used; | 600 | u64 total_bytes; /* total bytes in the space */ |
611 | u64 bytes_pinned; | 601 | u64 bytes_used; /* total bytes used on disk */ |
612 | u64 bytes_reserved; | 602 | u64 bytes_pinned; /* total bytes pinned, will be freed when the |
613 | u64 bytes_readonly; | 603 | transaction finishes */ |
614 | int full; | 604 | u64 bytes_reserved; /* total bytes the allocator has reserved for |
615 | int force_alloc; | 605 | current allocations */ |
606 | u64 bytes_readonly; /* total bytes that are read only */ | ||
607 | |||
608 | /* delalloc accounting */ | ||
609 | u64 bytes_delalloc; /* number of bytes reserved for allocation, | ||
610 | this space is not necessarily reserved yet | ||
611 | by the allocator */ | ||
612 | u64 bytes_may_use; /* number of bytes that may be used for | ||
613 | delalloc */ | ||
614 | |||
615 | int full; /* indicates that we cannot allocate any more | ||
616 | chunks for this space */ | ||
617 | int force_alloc; /* set if we need to force a chunk alloc for | ||
618 | this space */ | ||
619 | |||
616 | struct list_head list; | 620 | struct list_head list; |
617 | 621 | ||
618 | /* for block groups in our same type */ | 622 | /* for block groups in our same type */ |
@@ -701,9 +705,7 @@ struct btrfs_fs_info { | |||
701 | struct btrfs_transaction *running_transaction; | 705 | struct btrfs_transaction *running_transaction; |
702 | wait_queue_head_t transaction_throttle; | 706 | wait_queue_head_t transaction_throttle; |
703 | wait_queue_head_t transaction_wait; | 707 | wait_queue_head_t transaction_wait; |
704 | |||
705 | wait_queue_head_t async_submit_wait; | 708 | wait_queue_head_t async_submit_wait; |
706 | wait_queue_head_t tree_log_wait; | ||
707 | 709 | ||
708 | struct btrfs_super_block super_copy; | 710 | struct btrfs_super_block super_copy; |
709 | struct btrfs_super_block super_for_commit; | 711 | struct btrfs_super_block super_for_commit; |
@@ -711,7 +713,6 @@ struct btrfs_fs_info { | |||
711 | struct super_block *sb; | 713 | struct super_block *sb; |
712 | struct inode *btree_inode; | 714 | struct inode *btree_inode; |
713 | struct backing_dev_info bdi; | 715 | struct backing_dev_info bdi; |
714 | spinlock_t hash_lock; | ||
715 | struct mutex trans_mutex; | 716 | struct mutex trans_mutex; |
716 | struct mutex tree_log_mutex; | 717 | struct mutex tree_log_mutex; |
717 | struct mutex transaction_kthread_mutex; | 718 | struct mutex transaction_kthread_mutex; |
@@ -730,10 +731,6 @@ struct btrfs_fs_info { | |||
730 | atomic_t async_submit_draining; | 731 | atomic_t async_submit_draining; |
731 | atomic_t nr_async_bios; | 732 | atomic_t nr_async_bios; |
732 | atomic_t async_delalloc_pages; | 733 | atomic_t async_delalloc_pages; |
733 | atomic_t tree_log_writers; | ||
734 | atomic_t tree_log_commit; | ||
735 | unsigned long tree_log_batch; | ||
736 | u64 tree_log_transid; | ||
737 | 734 | ||
738 | /* | 735 | /* |
739 | * this is used by the balancing code to wait for all the pending | 736 | * this is used by the balancing code to wait for all the pending |
@@ -787,7 +784,14 @@ struct btrfs_fs_info { | |||
787 | struct list_head dirty_cowonly_roots; | 784 | struct list_head dirty_cowonly_roots; |
788 | 785 | ||
789 | struct btrfs_fs_devices *fs_devices; | 786 | struct btrfs_fs_devices *fs_devices; |
787 | |||
788 | /* | ||
789 | * the space_info list is almost entirely read only. It only changes | ||
790 | * when we add a new raid type to the FS, and that happens | ||
791 | * very rarely. RCU is used to protect it. | ||
792 | */ | ||
790 | struct list_head space_info; | 793 | struct list_head space_info; |
794 | |||
791 | spinlock_t delalloc_lock; | 795 | spinlock_t delalloc_lock; |
792 | spinlock_t new_trans_lock; | 796 | spinlock_t new_trans_lock; |
793 | u64 delalloc_bytes; | 797 | u64 delalloc_bytes; |
@@ -833,7 +837,14 @@ struct btrfs_root { | |||
833 | struct kobject root_kobj; | 837 | struct kobject root_kobj; |
834 | struct completion kobj_unregister; | 838 | struct completion kobj_unregister; |
835 | struct mutex objectid_mutex; | 839 | struct mutex objectid_mutex; |
840 | |||
836 | struct mutex log_mutex; | 841 | struct mutex log_mutex; |
842 | wait_queue_head_t log_writer_wait; | ||
843 | wait_queue_head_t log_commit_wait[2]; | ||
844 | atomic_t log_writers; | ||
845 | atomic_t log_commit[2]; | ||
846 | unsigned long log_transid; | ||
847 | unsigned long log_batch; | ||
837 | 848 | ||
838 | u64 objectid; | 849 | u64 objectid; |
839 | u64 last_trans; | 850 | u64 last_trans; |
@@ -1721,7 +1732,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, | |||
1721 | u64 empty_size); | 1732 | u64 empty_size); |
1722 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, | 1733 | struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans, |
1723 | struct btrfs_root *root, | 1734 | struct btrfs_root *root, |
1724 | u64 bytenr, u32 blocksize); | 1735 | u64 bytenr, u32 blocksize, |
1736 | int level); | ||
1725 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, | 1737 | int btrfs_alloc_extent(struct btrfs_trans_handle *trans, |
1726 | struct btrfs_root *root, | 1738 | struct btrfs_root *root, |
1727 | u64 num_bytes, u64 parent, u64 min_bytes, | 1739 | u64 num_bytes, u64 parent, u64 min_bytes, |
@@ -1791,6 +1803,18 @@ int btrfs_add_dead_reloc_root(struct btrfs_root *root); | |||
1791 | int btrfs_cleanup_reloc_trees(struct btrfs_root *root); | 1803 | int btrfs_cleanup_reloc_trees(struct btrfs_root *root); |
1792 | int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); | 1804 | int btrfs_reloc_clone_csums(struct inode *inode, u64 file_pos, u64 len); |
1793 | u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags); | 1805 | u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags); |
1806 | void btrfs_set_inode_space_info(struct btrfs_root *root, struct inode *ionde); | ||
1807 | void btrfs_clear_space_info_full(struct btrfs_fs_info *info); | ||
1808 | |||
1809 | int btrfs_check_metadata_free_space(struct btrfs_root *root); | ||
1810 | int btrfs_check_data_free_space(struct btrfs_root *root, struct inode *inode, | ||
1811 | u64 bytes); | ||
1812 | void btrfs_free_reserved_data_space(struct btrfs_root *root, | ||
1813 | struct inode *inode, u64 bytes); | ||
1814 | void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode, | ||
1815 | u64 bytes); | ||
1816 | void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode, | ||
1817 | u64 bytes); | ||
1794 | /* ctree.c */ | 1818 | /* ctree.c */ |
1795 | int btrfs_previous_item(struct btrfs_root *root, | 1819 | int btrfs_previous_item(struct btrfs_root *root, |
1796 | struct btrfs_path *path, u64 min_objectid, | 1820 | struct btrfs_path *path, u64 min_objectid, |
@@ -1840,7 +1864,9 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, | |||
1840 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); | 1864 | void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p); |
1841 | struct btrfs_path *btrfs_alloc_path(void); | 1865 | struct btrfs_path *btrfs_alloc_path(void); |
1842 | void btrfs_free_path(struct btrfs_path *p); | 1866 | void btrfs_free_path(struct btrfs_path *p); |
1843 | void btrfs_init_path(struct btrfs_path *p); | 1867 | void btrfs_set_path_blocking(struct btrfs_path *p); |
1868 | void btrfs_unlock_up_safe(struct btrfs_path *p, int level); | ||
1869 | |||
1844 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 1870 | int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
1845 | struct btrfs_path *path, int slot, int nr); | 1871 | struct btrfs_path *path, int slot, int nr); |
1846 | int btrfs_del_leaf(struct btrfs_trans_handle *trans, | 1872 | int btrfs_del_leaf(struct btrfs_trans_handle *trans, |
@@ -2034,8 +2060,6 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | |||
2034 | unsigned long btrfs_force_ra(struct address_space *mapping, | 2060 | unsigned long btrfs_force_ra(struct address_space *mapping, |
2035 | struct file_ra_state *ra, struct file *file, | 2061 | struct file_ra_state *ra, struct file *file, |
2036 | pgoff_t offset, pgoff_t last_index); | 2062 | pgoff_t offset, pgoff_t last_index); |
2037 | int btrfs_check_free_space(struct btrfs_root *root, u64 num_required, | ||
2038 | int for_del); | ||
2039 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); | 2063 | int btrfs_page_mkwrite(struct vm_area_struct *vma, struct page *page); |
2040 | int btrfs_readpage(struct file *file, struct page *page); | 2064 | int btrfs_readpage(struct file *file, struct page *page); |
2041 | void btrfs_delete_inode(struct inode *inode); | 2065 | void btrfs_delete_inode(struct inode *inode); |