aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 6c093fa98f61..300628795fdb 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -930,7 +930,6 @@ struct btrfs_fs_info {
930 * is required instead of the faster short fsync log commits 930 * is required instead of the faster short fsync log commits
931 */ 931 */
932 u64 last_trans_log_full_commit; 932 u64 last_trans_log_full_commit;
933 u64 open_ioctl_trans;
934 unsigned long mount_opt:20; 933 unsigned long mount_opt:20;
935 unsigned long compress_type:4; 934 unsigned long compress_type:4;
936 u64 max_inline; 935 u64 max_inline;
@@ -947,7 +946,6 @@ struct btrfs_fs_info {
947 struct super_block *sb; 946 struct super_block *sb;
948 struct inode *btree_inode; 947 struct inode *btree_inode;
949 struct backing_dev_info bdi; 948 struct backing_dev_info bdi;
950 struct mutex trans_mutex;
951 struct mutex tree_log_mutex; 949 struct mutex tree_log_mutex;
952 struct mutex transaction_kthread_mutex; 950 struct mutex transaction_kthread_mutex;
953 struct mutex cleaner_mutex; 951 struct mutex cleaner_mutex;
@@ -968,6 +966,13 @@ struct btrfs_fs_info {
968 struct rw_semaphore subvol_sem; 966 struct rw_semaphore subvol_sem;
969 struct srcu_struct subvol_srcu; 967 struct srcu_struct subvol_srcu;
970 968
969 spinlock_t trans_lock;
970 /*
971 * the reloc mutex goes with the trans lock, it is taken
972 * during commit to protect us from the relocation code
973 */
974 struct mutex reloc_mutex;
975
971 struct list_head trans_list; 976 struct list_head trans_list;
972 struct list_head hashers; 977 struct list_head hashers;
973 struct list_head dead_roots; 978 struct list_head dead_roots;
@@ -980,6 +985,7 @@ struct btrfs_fs_info {
980 atomic_t async_submit_draining; 985 atomic_t async_submit_draining;
981 atomic_t nr_async_bios; 986 atomic_t nr_async_bios;
982 atomic_t async_delalloc_pages; 987 atomic_t async_delalloc_pages;
988 atomic_t open_ioctl_trans;
983 989
984 /* 990 /*
985 * this is used by the balancing code to wait for all the pending 991 * this is used by the balancing code to wait for all the pending
@@ -1044,6 +1050,7 @@ struct btrfs_fs_info {
1044 int closing; 1050 int closing;
1045 int log_root_recovering; 1051 int log_root_recovering;
1046 int enospc_unlink; 1052 int enospc_unlink;
1053 int trans_no_join;
1047 1054
1048 u64 total_pinned; 1055 u64 total_pinned;
1049 1056
@@ -1065,7 +1072,6 @@ struct btrfs_fs_info {
1065 struct reloc_control *reloc_ctl; 1072 struct reloc_control *reloc_ctl;
1066 1073
1067 spinlock_t delalloc_lock; 1074 spinlock_t delalloc_lock;
1068 spinlock_t new_trans_lock;
1069 u64 delalloc_bytes; 1075 u64 delalloc_bytes;
1070 1076
1071 /* data_alloc_cluster is only used in ssd mode */ 1077 /* data_alloc_cluster is only used in ssd mode */
@@ -1172,6 +1178,14 @@ struct btrfs_root {
1172 u32 type; 1178 u32 type;
1173 1179
1174 u64 highest_objectid; 1180 u64 highest_objectid;
1181
1182 /* btrfs_record_root_in_trans is a multi-step process,
1183 * and it can race with the balancing code. But the
1184 * race is very small, and only the first time the root
1185 * is added to each transaction. So in_trans_setup
1186 * is used to tell us when more checks are required
1187 */
1188 unsigned long in_trans_setup;
1175 int ref_cows; 1189 int ref_cows;
1176 int track_dirty; 1190 int track_dirty;
1177 int in_radix; 1191 int in_radix;
@@ -1181,7 +1195,6 @@ struct btrfs_root {
1181 struct btrfs_key defrag_max; 1195 struct btrfs_key defrag_max;
1182 int defrag_running; 1196 int defrag_running;
1183 char *name; 1197 char *name;
1184 int in_sysfs;
1185 1198
1186 /* the dirty list is only used by non-reference counted roots */ 1199 /* the dirty list is only used by non-reference counted roots */
1187 struct list_head dirty_list; 1200 struct list_head dirty_list;
@@ -1340,6 +1353,7 @@ struct btrfs_ioctl_defrag_range_args {
1340#define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) 1353#define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14)
1341#define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) 1354#define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15)
1342#define BTRFS_MOUNT_AUTO_DEFRAG (1 << 16) 1355#define BTRFS_MOUNT_AUTO_DEFRAG (1 << 16)
1356#define BTRFS_MOUNT_INODE_MAP_CACHE (1 << 17)
1343 1357
1344#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) 1358#define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
1345#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) 1359#define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
@@ -2238,6 +2252,9 @@ int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
2238void btrfs_block_rsv_release(struct btrfs_root *root, 2252void btrfs_block_rsv_release(struct btrfs_root *root,
2239 struct btrfs_block_rsv *block_rsv, 2253 struct btrfs_block_rsv *block_rsv,
2240 u64 num_bytes); 2254 u64 num_bytes);
2255int btrfs_truncate_reserve_metadata(struct btrfs_trans_handle *trans,
2256 struct btrfs_root *root,
2257 struct btrfs_block_rsv *rsv);
2241int btrfs_set_block_group_ro(struct btrfs_root *root, 2258int btrfs_set_block_group_ro(struct btrfs_root *root,
2242 struct btrfs_block_group_cache *cache); 2259 struct btrfs_block_group_cache *cache);
2243int btrfs_set_block_group_rw(struct btrfs_root *root, 2260int btrfs_set_block_group_rw(struct btrfs_root *root,
@@ -2350,6 +2367,15 @@ int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
2350 struct btrfs_root *root, 2367 struct btrfs_root *root,
2351 struct extent_buffer *node, 2368 struct extent_buffer *node,
2352 struct extent_buffer *parent); 2369 struct extent_buffer *parent);
2370static inline int btrfs_fs_closing(struct btrfs_fs_info *fs_info)
2371{
2372 /*
2373 * Get synced with close_ctree()
2374 */
2375 smp_mb();
2376 return fs_info->closing;
2377}
2378
2353/* root-item.c */ 2379/* root-item.c */
2354int btrfs_find_root_ref(struct btrfs_root *tree_root, 2380int btrfs_find_root_ref(struct btrfs_root *tree_root,
2355 struct btrfs_path *path, 2381 struct btrfs_path *path,
@@ -2512,8 +2538,7 @@ int btrfs_set_extent_delalloc(struct inode *inode, u64 start, u64 end,
2512int btrfs_writepages(struct address_space *mapping, 2538int btrfs_writepages(struct address_space *mapping,
2513 struct writeback_control *wbc); 2539 struct writeback_control *wbc);
2514int btrfs_create_subvol_root(struct btrfs_trans_handle *trans, 2540int btrfs_create_subvol_root(struct btrfs_trans_handle *trans,
2515 struct btrfs_root *new_root, 2541 struct btrfs_root *new_root, u64 new_dirid);
2516 u64 new_dirid, u64 alloc_hint);
2517int btrfs_merge_bio_hook(struct page *page, unsigned long offset, 2542int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
2518 size_t size, struct bio *bio, unsigned long bio_flags); 2543 size_t size, struct bio *bio, unsigned long bio_flags);
2519 2544