aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-22 15:59:16 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-22 15:59:16 -0400
commit79154b1b5bcf87903db7ff16a30b360b78d6fe4f (patch)
tree7c752c350abd28060c5bd7aa364323051aecac90 /fs/btrfs/transaction.h
parente20d96d64f9cf9288ffecc9ad4714e91c3b97ca8 (diff)
Btrfs: transaction rework
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/transaction.h')
-rw-r--r--fs/btrfs/transaction.h35
1 files changed, 19 insertions, 16 deletions
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index 9ab27b7491c5..7e6c08a0accd 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -1,27 +1,30 @@
1#ifndef __TRANSACTION__ 1#ifndef __TRANSACTION__
2#define __TRANSACTION__ 2#define __TRANSACTION__
3 3
4struct btrfs_transaction {
5 u64 transid;
6 unsigned long num_writers;
7 int in_commit;
8 int use_count;
9 int commit_done;
10 wait_queue_head_t writer_wait;
11 wait_queue_head_t commit_wait;
12};
13
4struct btrfs_trans_handle { 14struct btrfs_trans_handle {
5 u64 transid; 15 u64 transid;
6 unsigned long blocks_reserved; 16 unsigned long blocks_reserved;
7 unsigned long blocks_used; 17 unsigned long blocks_used;
18 struct btrfs_transaction *transaction;
8}; 19};
9 20
10static inline struct btrfs_trans_handle *
11btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
12{
13 struct btrfs_trans_handle *h = kmalloc(sizeof(*h), GFP_NOFS);
14 h->transid = root->root_key.offset;
15 h->blocks_reserved = num_blocks;
16 h->blocks_used = 0;
17 return h;
18}
19
20static inline void btrfs_free_transaction(struct btrfs_root *root,
21 struct btrfs_trans_handle *handle)
22{
23 memset(handle, 0, sizeof(*handle));
24 kfree(handle);
25}
26 21
22int btrfs_end_transaction(struct btrfs_trans_handle *trans,
23 struct btrfs_root *root);
24struct btrfs_trans_handle *btrfs_start_transaction(struct btrfs_root *root,
25 int num_blocks);
26int btrfs_write_and_wait_transaction(struct btrfs_trans_handle *trans,
27 struct btrfs_root *root);
28int btrfs_commit_tree_roots(struct btrfs_trans_handle *trans,
29 struct btrfs_root *root);
27#endif 30#endif