diff options
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 78 |
1 files changed, 59 insertions, 19 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 837435ce84ca..80599b4e42bd 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -114,6 +114,10 @@ struct btrfs_ordered_sum; | |||
114 | */ | 114 | */ |
115 | #define BTRFS_DEV_ITEMS_OBJECTID 1ULL | 115 | #define BTRFS_DEV_ITEMS_OBJECTID 1ULL |
116 | 116 | ||
117 | #define BTRFS_BTREE_INODE_OBJECTID 1 | ||
118 | |||
119 | #define BTRFS_EMPTY_SUBVOL_DIR_OBJECTID 2 | ||
120 | |||
117 | /* | 121 | /* |
118 | * we can actually store much bigger names, but lets not confuse the rest | 122 | * we can actually store much bigger names, but lets not confuse the rest |
119 | * of linux | 123 | * of linux |
@@ -670,6 +674,7 @@ struct btrfs_space_info { | |||
670 | u64 bytes_reserved; /* total bytes the allocator has reserved for | 674 | u64 bytes_reserved; /* total bytes the allocator has reserved for |
671 | current allocations */ | 675 | current allocations */ |
672 | u64 bytes_readonly; /* total bytes that are read only */ | 676 | u64 bytes_readonly; /* total bytes that are read only */ |
677 | u64 bytes_super; /* total bytes reserved for the super blocks */ | ||
673 | 678 | ||
674 | /* delalloc accounting */ | 679 | /* delalloc accounting */ |
675 | u64 bytes_delalloc; /* number of bytes reserved for allocation, | 680 | u64 bytes_delalloc; /* number of bytes reserved for allocation, |
@@ -726,6 +731,15 @@ enum btrfs_caching_type { | |||
726 | BTRFS_CACHE_FINISHED = 2, | 731 | BTRFS_CACHE_FINISHED = 2, |
727 | }; | 732 | }; |
728 | 733 | ||
734 | struct btrfs_caching_control { | ||
735 | struct list_head list; | ||
736 | struct mutex mutex; | ||
737 | wait_queue_head_t wait; | ||
738 | struct btrfs_block_group_cache *block_group; | ||
739 | u64 progress; | ||
740 | atomic_t count; | ||
741 | }; | ||
742 | |||
729 | struct btrfs_block_group_cache { | 743 | struct btrfs_block_group_cache { |
730 | struct btrfs_key key; | 744 | struct btrfs_key key; |
731 | struct btrfs_block_group_item item; | 745 | struct btrfs_block_group_item item; |
@@ -733,6 +747,7 @@ struct btrfs_block_group_cache { | |||
733 | spinlock_t lock; | 747 | spinlock_t lock; |
734 | u64 pinned; | 748 | u64 pinned; |
735 | u64 reserved; | 749 | u64 reserved; |
750 | u64 bytes_super; | ||
736 | u64 flags; | 751 | u64 flags; |
737 | u64 sectorsize; | 752 | u64 sectorsize; |
738 | int extents_thresh; | 753 | int extents_thresh; |
@@ -742,8 +757,9 @@ struct btrfs_block_group_cache { | |||
742 | int dirty; | 757 | int dirty; |
743 | 758 | ||
744 | /* cache tracking stuff */ | 759 | /* cache tracking stuff */ |
745 | wait_queue_head_t caching_q; | ||
746 | int cached; | 760 | int cached; |
761 | struct btrfs_caching_control *caching_ctl; | ||
762 | u64 last_byte_to_unpin; | ||
747 | 763 | ||
748 | struct btrfs_space_info *space_info; | 764 | struct btrfs_space_info *space_info; |
749 | 765 | ||
@@ -782,13 +798,16 @@ struct btrfs_fs_info { | |||
782 | 798 | ||
783 | /* the log root tree is a directory of all the other log roots */ | 799 | /* the log root tree is a directory of all the other log roots */ |
784 | struct btrfs_root *log_root_tree; | 800 | struct btrfs_root *log_root_tree; |
801 | |||
802 | spinlock_t fs_roots_radix_lock; | ||
785 | struct radix_tree_root fs_roots_radix; | 803 | struct radix_tree_root fs_roots_radix; |
786 | 804 | ||
787 | /* block group cache stuff */ | 805 | /* block group cache stuff */ |
788 | spinlock_t block_group_cache_lock; | 806 | spinlock_t block_group_cache_lock; |
789 | struct rb_root block_group_cache_tree; | 807 | struct rb_root block_group_cache_tree; |
790 | 808 | ||
791 | struct extent_io_tree pinned_extents; | 809 | struct extent_io_tree freed_extents[2]; |
810 | struct extent_io_tree *pinned_extents; | ||
792 | 811 | ||
793 | /* logical->physical extent mapping */ | 812 | /* logical->physical extent mapping */ |
794 | struct btrfs_mapping_tree mapping_tree; | 813 | struct btrfs_mapping_tree mapping_tree; |
@@ -822,11 +841,7 @@ struct btrfs_fs_info { | |||
822 | struct mutex transaction_kthread_mutex; | 841 | struct mutex transaction_kthread_mutex; |
823 | struct mutex cleaner_mutex; | 842 | struct mutex cleaner_mutex; |
824 | struct mutex chunk_mutex; | 843 | struct mutex chunk_mutex; |
825 | struct mutex drop_mutex; | ||
826 | struct mutex volume_mutex; | 844 | struct mutex volume_mutex; |
827 | struct mutex tree_reloc_mutex; | ||
828 | struct rw_semaphore extent_commit_sem; | ||
829 | |||
830 | /* | 845 | /* |
831 | * this protects the ordered operations list only while we are | 846 | * this protects the ordered operations list only while we are |
832 | * processing all of the entries on it. This way we make | 847 | * processing all of the entries on it. This way we make |
@@ -835,10 +850,16 @@ struct btrfs_fs_info { | |||
835 | * before jumping into the main commit. | 850 | * before jumping into the main commit. |
836 | */ | 851 | */ |
837 | struct mutex ordered_operations_mutex; | 852 | struct mutex ordered_operations_mutex; |
853 | struct rw_semaphore extent_commit_sem; | ||
854 | |||
855 | struct rw_semaphore subvol_sem; | ||
856 | |||
857 | struct srcu_struct subvol_srcu; | ||
838 | 858 | ||
839 | struct list_head trans_list; | 859 | struct list_head trans_list; |
840 | struct list_head hashers; | 860 | struct list_head hashers; |
841 | struct list_head dead_roots; | 861 | struct list_head dead_roots; |
862 | struct list_head caching_block_groups; | ||
842 | 863 | ||
843 | atomic_t nr_async_submits; | 864 | atomic_t nr_async_submits; |
844 | atomic_t async_submit_draining; | 865 | atomic_t async_submit_draining; |
@@ -996,10 +1017,12 @@ struct btrfs_root { | |||
996 | u32 stripesize; | 1017 | u32 stripesize; |
997 | 1018 | ||
998 | u32 type; | 1019 | u32 type; |
999 | u64 highest_inode; | 1020 | |
1000 | u64 last_inode_alloc; | 1021 | u64 highest_objectid; |
1001 | int ref_cows; | 1022 | int ref_cows; |
1002 | int track_dirty; | 1023 | int track_dirty; |
1024 | int in_radix; | ||
1025 | |||
1003 | u64 defrag_trans_start; | 1026 | u64 defrag_trans_start; |
1004 | struct btrfs_key defrag_progress; | 1027 | struct btrfs_key defrag_progress; |
1005 | struct btrfs_key defrag_max; | 1028 | struct btrfs_key defrag_max; |
@@ -1920,8 +1943,8 @@ void btrfs_put_block_group(struct btrfs_block_group_cache *cache); | |||
1920 | int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | 1943 | int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, |
1921 | struct btrfs_root *root, unsigned long count); | 1944 | struct btrfs_root *root, unsigned long count); |
1922 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); | 1945 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); |
1923 | int btrfs_update_pinned_extents(struct btrfs_root *root, | 1946 | int btrfs_pin_extent(struct btrfs_root *root, |
1924 | u64 bytenr, u64 num, int pin); | 1947 | u64 bytenr, u64 num, int reserved); |
1925 | int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, | 1948 | int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans, |
1926 | struct btrfs_root *root, struct extent_buffer *leaf); | 1949 | struct btrfs_root *root, struct extent_buffer *leaf); |
1927 | int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans, | 1950 | int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans, |
@@ -1971,9 +1994,10 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, | |||
1971 | u64 root_objectid, u64 owner, u64 offset); | 1994 | u64 root_objectid, u64 owner, u64 offset); |
1972 | 1995 | ||
1973 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); | 1996 | int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len); |
1997 | int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans, | ||
1998 | struct btrfs_root *root); | ||
1974 | int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, | 1999 | int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans, |
1975 | struct btrfs_root *root, | 2000 | struct btrfs_root *root); |
1976 | struct extent_io_tree *unpin); | ||
1977 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, | 2001 | int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, |
1978 | struct btrfs_root *root, | 2002 | struct btrfs_root *root, |
1979 | u64 bytenr, u64 num_bytes, u64 parent, | 2003 | u64 bytenr, u64 num_bytes, u64 parent, |
@@ -1984,6 +2008,7 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, | |||
1984 | int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr); | 2008 | int btrfs_extent_readonly(struct btrfs_root *root, u64 bytenr); |
1985 | int btrfs_free_block_groups(struct btrfs_fs_info *info); | 2009 | int btrfs_free_block_groups(struct btrfs_fs_info *info); |
1986 | int btrfs_read_block_groups(struct btrfs_root *root); | 2010 | int btrfs_read_block_groups(struct btrfs_root *root); |
2011 | int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr); | ||
1987 | int btrfs_make_block_group(struct btrfs_trans_handle *trans, | 2012 | int btrfs_make_block_group(struct btrfs_trans_handle *trans, |
1988 | struct btrfs_root *root, u64 bytes_used, | 2013 | struct btrfs_root *root, u64 bytes_used, |
1989 | u64 type, u64 chunk_objectid, u64 chunk_offset, | 2014 | u64 type, u64 chunk_objectid, u64 chunk_offset, |
@@ -2006,7 +2031,6 @@ void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode, | |||
2006 | u64 bytes); | 2031 | u64 bytes); |
2007 | void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode, | 2032 | void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode, |
2008 | u64 bytes); | 2033 | u64 bytes); |
2009 | void btrfs_free_pinned_extents(struct btrfs_fs_info *info); | ||
2010 | /* ctree.c */ | 2034 | /* ctree.c */ |
2011 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, | 2035 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, |
2012 | int level, int *slot); | 2036 | int level, int *slot); |
@@ -2100,12 +2124,15 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans, | |||
2100 | struct extent_buffer *parent); | 2124 | struct extent_buffer *parent); |
2101 | /* root-item.c */ | 2125 | /* root-item.c */ |
2102 | int btrfs_find_root_ref(struct btrfs_root *tree_root, | 2126 | int btrfs_find_root_ref(struct btrfs_root *tree_root, |
2103 | struct btrfs_path *path, | 2127 | struct btrfs_path *path, |
2104 | u64 root_id, u64 ref_id); | 2128 | u64 root_id, u64 ref_id); |
2105 | int btrfs_add_root_ref(struct btrfs_trans_handle *trans, | 2129 | int btrfs_add_root_ref(struct btrfs_trans_handle *trans, |
2106 | struct btrfs_root *tree_root, | 2130 | struct btrfs_root *tree_root, |
2107 | u64 root_id, u8 type, u64 ref_id, | 2131 | u64 root_id, u64 ref_id, u64 dirid, u64 sequence, |
2108 | u64 dirid, u64 sequence, | 2132 | const char *name, int name_len); |
2133 | int btrfs_del_root_ref(struct btrfs_trans_handle *trans, | ||
2134 | struct btrfs_root *tree_root, | ||
2135 | u64 root_id, u64 ref_id, u64 dirid, u64 *sequence, | ||
2109 | const char *name, int name_len); | 2136 | const char *name, int name_len); |
2110 | int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 2137 | int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
2111 | struct btrfs_key *key); | 2138 | struct btrfs_key *key); |
@@ -2120,6 +2147,7 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct | |||
2120 | int btrfs_search_root(struct btrfs_root *root, u64 search_start, | 2147 | int btrfs_search_root(struct btrfs_root *root, u64 search_start, |
2121 | u64 *found_objectid); | 2148 | u64 *found_objectid); |
2122 | int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid); | 2149 | int btrfs_find_dead_roots(struct btrfs_root *root, u64 objectid); |
2150 | int btrfs_find_orphan_roots(struct btrfs_root *tree_root); | ||
2123 | int btrfs_set_root_node(struct btrfs_root_item *item, | 2151 | int btrfs_set_root_node(struct btrfs_root_item *item, |
2124 | struct extent_buffer *node); | 2152 | struct extent_buffer *node); |
2125 | /* dir-item.c */ | 2153 | /* dir-item.c */ |
@@ -2138,6 +2166,10 @@ btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans, | |||
2138 | struct btrfs_path *path, u64 dir, | 2166 | struct btrfs_path *path, u64 dir, |
2139 | u64 objectid, const char *name, int name_len, | 2167 | u64 objectid, const char *name, int name_len, |
2140 | int mod); | 2168 | int mod); |
2169 | struct btrfs_dir_item * | ||
2170 | btrfs_search_dir_index_item(struct btrfs_root *root, | ||
2171 | struct btrfs_path *path, u64 dirid, | ||
2172 | const char *name, int name_len); | ||
2141 | struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, | 2173 | struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, |
2142 | struct btrfs_path *path, | 2174 | struct btrfs_path *path, |
2143 | const char *name, int name_len); | 2175 | const char *name, int name_len); |
@@ -2160,6 +2192,7 @@ int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans, | |||
2160 | struct btrfs_root *root, u64 offset); | 2192 | struct btrfs_root *root, u64 offset); |
2161 | int btrfs_del_orphan_item(struct btrfs_trans_handle *trans, | 2193 | int btrfs_del_orphan_item(struct btrfs_trans_handle *trans, |
2162 | struct btrfs_root *root, u64 offset); | 2194 | struct btrfs_root *root, u64 offset); |
2195 | int btrfs_find_orphan_item(struct btrfs_root *root, u64 offset); | ||
2163 | 2196 | ||
2164 | /* inode-map.c */ | 2197 | /* inode-map.c */ |
2165 | int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, | 2198 | int btrfs_find_free_objectid(struct btrfs_trans_handle *trans, |
@@ -2232,6 +2265,10 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans, | |||
2232 | int btrfs_add_link(struct btrfs_trans_handle *trans, | 2265 | int btrfs_add_link(struct btrfs_trans_handle *trans, |
2233 | struct inode *parent_inode, struct inode *inode, | 2266 | struct inode *parent_inode, struct inode *inode, |
2234 | const char *name, int name_len, int add_backref, u64 index); | 2267 | const char *name, int name_len, int add_backref, u64 index); |
2268 | int btrfs_unlink_subvol(struct btrfs_trans_handle *trans, | ||
2269 | struct btrfs_root *root, | ||
2270 | struct inode *dir, u64 objectid, | ||
2271 | const char *name, int name_len); | ||
2235 | int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, | 2272 | int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, |
2236 | struct btrfs_root *root, | 2273 | struct btrfs_root *root, |
2237 | struct inode *inode, u64 new_size, | 2274 | struct inode *inode, u64 new_size, |
@@ -2242,7 +2279,7 @@ int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end); | |||
2242 | int btrfs_writepages(struct address_space *mapping, | 2279 | int btrfs_writepages(struct address_space *mapping, |
2243 | struct writeback_control *wbc); | 2280 | struct writeback_control *wbc); |
2244 | int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, | 2281 | int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, |
2245 | struct btrfs_root *new_root, struct dentry *dentry, | 2282 | struct btrfs_root *new_root, |
2246 | u64 new_dirid, u64 alloc_hint); | 2283 | u64 new_dirid, u64 alloc_hint); |
2247 | int btrfs_merge_bio_hook(struct page *page, unsigned long offset, | 2284 | int btrfs_merge_bio_hook(struct page *page, unsigned long offset, |
2248 | size_t size, struct bio *bio, unsigned long bio_flags); | 2285 | size_t size, struct bio *bio, unsigned long bio_flags); |
@@ -2258,6 +2295,7 @@ int btrfs_write_inode(struct inode *inode, int wait); | |||
2258 | void btrfs_dirty_inode(struct inode *inode); | 2295 | void btrfs_dirty_inode(struct inode *inode); |
2259 | struct inode *btrfs_alloc_inode(struct super_block *sb); | 2296 | struct inode *btrfs_alloc_inode(struct super_block *sb); |
2260 | void btrfs_destroy_inode(struct inode *inode); | 2297 | void btrfs_destroy_inode(struct inode *inode); |
2298 | void btrfs_drop_inode(struct inode *inode); | ||
2261 | int btrfs_init_cachep(void); | 2299 | int btrfs_init_cachep(void); |
2262 | void btrfs_destroy_cachep(void); | 2300 | void btrfs_destroy_cachep(void); |
2263 | long btrfs_ioctl_trans_end(struct file *file); | 2301 | long btrfs_ioctl_trans_end(struct file *file); |
@@ -2275,6 +2313,8 @@ int btrfs_orphan_add(struct btrfs_trans_handle *trans, struct inode *inode); | |||
2275 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); | 2313 | int btrfs_orphan_del(struct btrfs_trans_handle *trans, struct inode *inode); |
2276 | void btrfs_orphan_cleanup(struct btrfs_root *root); | 2314 | void btrfs_orphan_cleanup(struct btrfs_root *root); |
2277 | int btrfs_cont_expand(struct inode *inode, loff_t size); | 2315 | int btrfs_cont_expand(struct inode *inode, loff_t size); |
2316 | int btrfs_invalidate_inodes(struct btrfs_root *root); | ||
2317 | extern struct dentry_operations btrfs_dentry_operations; | ||
2278 | 2318 | ||
2279 | /* ioctl.c */ | 2319 | /* ioctl.c */ |
2280 | long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 2320 | long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg); |
@@ -2290,7 +2330,7 @@ extern struct file_operations btrfs_file_operations; | |||
2290 | int btrfs_drop_extents(struct btrfs_trans_handle *trans, | 2330 | int btrfs_drop_extents(struct btrfs_trans_handle *trans, |
2291 | struct btrfs_root *root, struct inode *inode, | 2331 | struct btrfs_root *root, struct inode *inode, |
2292 | u64 start, u64 end, u64 locked_end, | 2332 | u64 start, u64 end, u64 locked_end, |
2293 | u64 inline_limit, u64 *hint_block); | 2333 | u64 inline_limit, u64 *hint_block, int drop_cache); |
2294 | int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, | 2334 | int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, |
2295 | struct btrfs_root *root, | 2335 | struct btrfs_root *root, |
2296 | struct inode *inode, u64 start, u64 end); | 2336 | struct inode *inode, u64 start, u64 end); |