Btrfs: d_type optimization
[linux-2.6-block.git] / fs / btrfs / transaction.h
CommitLineData
e089f05c
CM
1#ifndef __TRANSACTION__
2#define __TRANSACTION__
31f3c99b 3#include "btrfs_inode.h"
e089f05c 4
79154b1b
CM
5struct btrfs_transaction {
6 u64 transid;
7 unsigned long num_writers;
8 int in_commit;
9 int use_count;
10 int commit_done;
2c90e5d6 11 int magic;
8fd17795 12 struct list_head list;
7c4452b9 13 struct radix_tree_root dirty_pages;
79154b1b
CM
14 wait_queue_head_t writer_wait;
15 wait_queue_head_t commit_wait;
16};
17
e089f05c 18struct btrfs_trans_handle {
2c90e5d6 19 int magic;
e089f05c
CM
20 u64 transid;
21 unsigned long blocks_reserved;
22 unsigned long blocks_used;
79154b1b 23 struct btrfs_transaction *transaction;
31f3c99b 24 struct btrfs_block_group_cache *block_group;
2c90e5d6 25 int magic2;
e089f05c
CM
26};
27
e089f05c 28
31f3c99b
CM
29static inline void btrfs_set_trans_block_group(struct btrfs_trans_handle *trans,
30 struct inode *inode)
31{
32 trans->block_group = BTRFS_I(inode)->block_group;
33}
34
35static inline void btrfs_update_inode_block_group(struct
36 btrfs_trans_handle *trans,
37 struct inode *inode)
38{
39 BTRFS_I(inode)->block_group = trans->block_group;
40}
41
79154b1b
CM
42int btrfs_end_transaction(struct btrfs_trans_handle *trans,
43 struct btrfs_root *root);
44struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
45 int num_blocks);
46int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
47 struct btrfs_root *root);
48int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
49 struct btrfs_root *root);
e089f05c 50#endif