diff options
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r-- | fs/btrfs/transaction.h | 41 |
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 | ||
46 | struct btrfs_trans_handle { | 48 | struct 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 | ||
57 | struct btrfs_pending_snapshot { | 60 | struct 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 | ||
68 | static 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 | |||
74 | static 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 | |||
81 | static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, | 72 | static 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 | ||
88 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 79 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
89 | struct btrfs_root *root); | 80 | struct btrfs_root *root); |
81 | int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans, | ||
82 | struct btrfs_root *root); | ||
90 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, | 83 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, |
91 | int num_items); | 84 | int num_items); |
92 | struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root, | 85 | struct btrfs_trans_handle *btrfs_join_transaction(struct btrfs_root *root); |
93 | int num_blocks); | 86 | struct btrfs_trans_handle *btrfs_join_transaction_nolock(struct btrfs_root *root); |
94 | struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *r, | 87 | struct btrfs_trans_handle *btrfs_start_ioctl_transaction(struct btrfs_root *root); |
95 | int num_blocks); | 88 | int btrfs_wait_for_commit(struct btrfs_root *root, u64 transid); |
96 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, | 89 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, |
97 | struct btrfs_root *root); | 90 | struct btrfs_root *root); |
98 | int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans, | ||
99 | struct btrfs_root *root); | ||
100 | 91 | ||
101 | int btrfs_add_dead_root(struct btrfs_root *root); | 92 | int btrfs_add_dead_root(struct btrfs_root *root); |
102 | int btrfs_drop_dead_root(struct btrfs_root *root); | ||
103 | int btrfs_defrag_root(struct btrfs_root *root, int cacheonly); | 93 | int btrfs_defrag_root(struct btrfs_root *root, int cacheonly); |
104 | int btrfs_clean_old_snapshots(struct btrfs_root *root); | 94 | int btrfs_clean_old_snapshots(struct btrfs_root *root); |
105 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, | 95 | int btrfs_commit_transaction(struct btrfs_trans_handle *trans, |
106 | struct btrfs_root *root); | 96 | struct btrfs_root *root); |
97 | int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans, | ||
98 | struct btrfs_root *root, | ||
99 | int wait_for_unblock); | ||
107 | int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, | 100 | int btrfs_end_transaction_throttle(struct btrfs_trans_handle *trans, |
108 | struct btrfs_root *root); | 101 | struct btrfs_root *root); |
102 | int btrfs_end_transaction_dmeta(struct btrfs_trans_handle *trans, | ||
103 | struct btrfs_root *root); | ||
109 | int btrfs_should_end_transaction(struct btrfs_trans_handle *trans, | 104 | int btrfs_should_end_transaction(struct btrfs_trans_handle *trans, |
110 | struct btrfs_root *root); | 105 | struct btrfs_root *root); |
111 | void btrfs_throttle(struct btrfs_root *root); | 106 | void btrfs_throttle(struct btrfs_root *root); |