diff options
author | Miao Xie <miaox@cn.fujitsu.com> | 2012-09-20 03:51:59 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-10-09 09:15:38 -0400 |
commit | a698d0755adb6f27289d1e6610b2240595d27e8c (patch) | |
tree | bf54f9bcd6941a459be5aeaf22299547c693c0aa /fs/btrfs/transaction.h | |
parent | e8830e606ffee383f073e32313f11fc5692813fe (diff) |
Btrfs: add a type field for the transaction handle
This patch add a type field into the transaction handle structure,
in this way, we needn't implement various end-transaction functions
and can make the code more simple and readable.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r-- | fs/btrfs/transaction.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h index fbf8313b9d67..0630bd19396a 100644 --- a/fs/btrfs/transaction.h +++ b/fs/btrfs/transaction.h | |||
@@ -47,6 +47,14 @@ struct btrfs_transaction { | |||
47 | int aborted; | 47 | int aborted; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | enum btrfs_trans_type { | ||
51 | TRANS_START, | ||
52 | TRANS_JOIN, | ||
53 | TRANS_USERSPACE, | ||
54 | TRANS_JOIN_NOLOCK, | ||
55 | TRANS_JOIN_FREEZE, | ||
56 | }; | ||
57 | |||
50 | struct btrfs_trans_handle { | 58 | struct btrfs_trans_handle { |
51 | u64 transid; | 59 | u64 transid; |
52 | u64 bytes_reserved; | 60 | u64 bytes_reserved; |
@@ -58,8 +66,9 @@ struct btrfs_trans_handle { | |||
58 | struct btrfs_transaction *transaction; | 66 | struct btrfs_transaction *transaction; |
59 | struct btrfs_block_rsv *block_rsv; | 67 | struct btrfs_block_rsv *block_rsv; |
60 | struct btrfs_block_rsv *orig_rsv; | 68 | struct btrfs_block_rsv *orig_rsv; |
61 | int aborted; | 69 | short aborted; |
62 | int adding_csums; | 70 | short adding_csums; |
71 | enum btrfs_trans_type type; | ||
63 | /* | 72 | /* |
64 | * this root is only needed to validate that the root passed to | 73 | * this root is only needed to validate that the root passed to |
65 | * start_transaction is the same as the one passed to end_transaction. | 74 | * start_transaction is the same as the one passed to end_transaction. |
@@ -94,8 +103,6 @@ static inline void btrfs_set_inode_last_trans(struct btrfs_trans_handle *trans, | |||
94 | 103 | ||
95 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, | 104 | int btrfs_end_transaction(struct btrfs_trans_handle *trans, |
96 | struct btrfs_root *root); | 105 | struct btrfs_root *root); |
97 | int btrfs_end_transaction_nolock(struct btrfs_trans_handle *trans, | ||
98 | struct btrfs_root *root); | ||
99 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, | 106 | struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root, |
100 | int num_items); | 107 | int num_items); |
101 | struct btrfs_trans_handle *btrfs_start_transaction_noflush( | 108 | struct btrfs_trans_handle *btrfs_start_transaction_noflush( |