Commit | Line | Data |
---|---|---|
e089f05c CM |
1 | #ifndef __TRANSACTION__ |
2 | #define __TRANSACTION__ | |
31f3c99b | 3 | #include "btrfs_inode.h" |
e089f05c | 4 | |
79154b1b CM |
5 | struct btrfs_transaction { |
6 | u64 transid; | |
7 | unsigned long num_writers; | |
8 | int in_commit; | |
9 | int use_count; | |
10 | int commit_done; | |
8fd17795 | 11 | struct list_head list; |
7c4452b9 | 12 | struct radix_tree_root dirty_pages; |
08607c1b | 13 | unsigned long start_time; |
79154b1b CM |
14 | wait_queue_head_t writer_wait; |
15 | wait_queue_head_t commit_wait; | |
16 | }; | |
17 | ||
e089f05c CM |
18 | struct btrfs_trans_handle { |
19 | u64 transid; | |
20 | unsigned long blocks_reserved; | |
21 | unsigned long blocks_used; | |
79154b1b | 22 | struct btrfs_transaction *transaction; |
31f3c99b | 23 | struct btrfs_block_group_cache *block_group; |
e089f05c CM |
24 | }; |
25 | ||
e089f05c | 26 | |
31f3c99b CM |
27 | static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans, |
28 | struct inode *inode) | |
29 | { | |
30 | trans->block_group = BTRFS_I(inode)->block_group; | |
31 | } | |
32 | ||
33 | static inline void btrfs_update_inode_block_group(struct | |
34 | btrfs_trans_handle *trans, | |
35 | struct inode *inode) | |
36 | { | |
37 | BTRFS_I(inode)->block_group = trans->block_group; | |
38 | } | |
39 | ||
79154b1b CM |
40 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
41 | struct btrfs_root *root); | |
42 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, | |
43 | int num_blocks); | |
44 | int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans, | |
45 | struct btrfs_root *root); | |
46 | int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans, | |
47 | struct btrfs_root *root); | |
08607c1b CM |
48 | |
49 | void btrfs_transaction_cleaner(struct work_struct *work); | |
50 | void btrfs_transaction_flush_work(struct btrfs_root *root); | |
51 | void btrfs_transaction_queue_work(struct btrfs_root *root, int delay); | |
52 | void btrfs_init_transaction_sys(void); | |
53 | void btrfs_exit_transaction_sys(void); | |
54 | ||
e089f05c | 55 | #endif |