aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r--fs/btrfs/transaction.h41
1 files changed, 18 insertions, 23 deletions
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index e104986d0bfd..02564e6230ac 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -27,11 +27,13 @@ struct btrfs_transaction {
27 * total writers in this transaction, it must be zero before the 27 * total writers in this transaction, it must be zero before the
28 * transaction can end 28 * transaction can end
29 */ 29 */
30 unsigned long num_writers; 30 atomic_t num_writers;
31 atomic_t use_count;
31 32
32 unsigned long num_joined; 33 unsigned long num_joined;
34
35 spinlock_t commit_lock;
33 int in_commit; 36 int in_commit;
34 int use_count;
35 int commit_done; 37 int commit_done;
36 int blocked; 38 int blocked;
37 struct list_head list; 39 struct list_head list;
@@ -45,13 +47,14 @@ struct btrfs_transaction {
45 47
46struct btrfs_trans_handle { 48struct btrfs_trans_handle {
47 u64 transid; 49 u64 transid;
48 u64 block_group;
49 u64 bytes_reserved; 50 u64 bytes_reserved;
51 unsigned long use_count;
50 unsigned long blocks_reserved; 52 unsigned long blocks_reserved;
51 unsigned long blocks_used; 53 unsigned long blocks_used;
52 unsigned long delayed_ref_updates; 54 unsigned long delayed_ref_updates;
53 struct btrfs_transaction *transaction; 55 struct btrfs_transaction *transaction;
54 struct btrfs_block_rsv *block_rsv; 56 struct btrfs_block_rsv *block_rsv;
57 struct btrfs_block_rsv *orig_rsv;
55}; 58};
56 59
57struct btrfs_pending_snapshot { 60struct btrfs_pending_snapshot {
@@ -62,22 +65,10 @@ struct btrfs_pending_snapshot {
62 struct btrfs_block_rsv block_rsv; 65 struct btrfs_block_rsv block_rsv;
63 /* extra metadata reseration for relocation */ 66 /* extra metadata reseration for relocation */
64 int error; 67 int error;
68 bool readonly;
65 struct list_head list; 69 struct list_head list;
66}; 70};
67 71
68static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans,
69 struct inode *inode)
70{
71 trans->block_group = BTRFS_I(inode)->block_group;
72}
73
74static inline void btrfs_update_inode_block_group(
75 struct btrfs_trans_handle *trans,
76 struct inode *inode)
77{
78 BTRFS_I(inode)->block_group = trans->block_group;
79}
80
81static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, 72static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
82 struct inode *inode) 73 struct inode *inode)
83{ 74{
@@ -87,25 +78,29 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans,
87 78
88int btrfs_end_transaction(struct btrfs_trans_handle *trans, 79int btrfs_end_transaction(struct btrfs_trans_handle *trans,
89 struct btrfs_root *root); 80 struct btrfs_root *root);
81int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans,
82 struct btrfs_root *root);
90struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, 83struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
91 int num_items); 84 int num_items);
92struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root, 85struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root);
93 int num_blocks); 86struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root);
94struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *r, 87struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *root);
95 int num_blocks); 88int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid);
96int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, 89int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
97 struct btrfs_root *root); 90 struct btrfs_root *root);
98int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
99 struct btrfs_root *root);
100 91
101int btrfs_add_dead_root(struct btrfs_root *root); 92int btrfs_add_dead_root(struct btrfs_root *root);
102int btrfs_drop_dead_root(struct btrfs_root *root);
103int btrfs_defrag_root(struct btrfs_root *root, int cacheonly); 93int btrfs_defrag_root(struct btrfs_root *root, int cacheonly);
104int btrfs_clean_old_snapshots(struct btrfs_root *root); 94int btrfs_clean_old_snapshots(struct btrfs_root *root);
105int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 95int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
106 struct btrfs_root *root); 96 struct btrfs_root *root);
97int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
98 struct btrfs_root *root,
99 int wait_for_unblock);
107int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, 100int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans,
108 struct btrfs_root *root); 101 struct btrfs_root *root);
102int btrfs_end_transaction_dmeta(struct btrfs_trans_handle *trans,
103 struct btrfs_root *root);
109int btrfs_should_end_transaction(struct btrfs_trans_handle *trans, 104int btrfs_should_end_transaction(struct btrfs_trans_handle *trans,
110 struct btrfs_root *root); 105 struct btrfs_root *root);
111void btrfs_throttle(struct btrfs_root *root); 106void btrfs_throttle(struct btrfs_root *root);